-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verify SwiftPM dependencies that contain C and C++ #595
Comments
One example when buiding OpenCombine:
|
FYI: |
I understand that, was a bit more confused by this part:
I'm currently trying to fix OpenCombine by enabling conditional target dependencies from swiftlang/swift-package-manager#2428 so that it avoids building |
I can confirm that building C++ code does not work with our toolchain, probably due to the inclusion of pthread headers in our builds:
|
What I don't understand here is why WASI includes headers which reference setjmp.h, if they exclude it? It may be that these are the compiler's headers, and they are actually what need to be changed? |
For the setjmp issue specifically, it looks like perhaps setjmp.h, csetjmp and related entries in the module.modulemap for the compiler internal headers should just be removed? I also had to work around a bogus reference to ::signal from |
Interesting, apparently wasi-sdk omits some headers (including Also, as far as I know, the only substantial difference between our wasi-sdk fork and the upstream repo is the inclusion of pthread headers. I'm not sure whether we should actually include them, omitting them would require updating a lot more code probably. Maybe it's worth sticking to it and waiting until wasm32/WASI get proper threading support? We do provide pthread stubs, but those are only linked when you build with SwiftPM, which is not applicable for standalone C++ executables like the invocation of |
Upstream probably just forgot about the C++ setjmp headers... modules is what is causing it to break and that is rare to use |
My vote would be to drop pthread and match what WASI is doing, but I don’t really know what I am talking about |
There's an issue upstream that tracks this inconsistency, doesn't seem like there were any updates recently WebAssembly/wasi-sdk#93
That's my vote too, I'd actually prefer to use upstream |
Just to confirm, C packages build ok, I've got a fork of |
@MaxDesiatov Sorry for waiting a long time for this issue. In short, you can link pthread things with $ clang++ main.cpp \
--sysroot=$(dirname $(swiftenv which swiftc))/../share/wasi-sysroot \
-L$(dirname $(swiftenv which swiftc))/../lib/swift_static/wasi \
-lswiftWasiPthread But in the long run, it's essential to support pthread in wasi-libc. |
Update WASI SDK to fix C++ setjmp/signal headers Fixes the issue #595 with C++ packages for the development snapshots made from the `swiftwasm` branch. Previously C++ dependencies couldn't be built as default Clang headers weren't tailored to support WASI, WebAssembly/wasi-sdk#93 being one of the examples. This should also unblock TokamakUI/Tokamak#170.
Such packages don't seem to be successfully building as of
DEVELOPMENT-SNAPSHOT-2020-04-06-a
The text was updated successfully, but these errors were encountered: