-
Notifications
You must be signed in to change notification settings - Fork 192
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
Update how wasi-sdk uses cmake #161
Conversation
Makefile
Outdated
# run the compiler to see if it produces working binaries succeed. | ||
mkdir -p $(PREFIX)/lib/clang/$(CLANG_VERSION)/lib/wasi | ||
$(AR) cr $(PREFIX)/share/wasi-sysroot/lib/wasm32-wasi/libc++.a | ||
$(AR) cr $(PREFIX)/share/wasi-sysroot/lib/wasm32-wasi/libc++abi.a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a little gross.. but I don't know that right way to bootstrap here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think its slightly better to do -DCMAKE_C_COMPILER_WORKS=ON
on the command line here. Basically saying "we are bootstrapping here so skip compiler checks".
Doing it in the wasi-sdk.cmake globally was wrong but going it locally is not so bad IMHO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that idea. I've now updated the PR to do this, and removed all the empty-archive hacks.
@@ -155,6 +157,8 @@ build/libcxx.BUILT: build/llvm.BUILT build/compiler-rt.BUILT build/wasi-libc.BUI | |||
|
|||
# Flags for libcxxabi. | |||
LIBCXXABI_CMAKE_FLAGS = \ | |||
-DCMAKE_C_COMPILER_WORKS=ON \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh.. looks like these were already specified below!
Change `CMAKE_SYSTEM_NAME` to `WASI`, use a `CMAKE_MODULE_PATH`, remove `CACHE` usage, and fix the compiler autodetection code so that the "compiler works" hacks are no longer needed, following the advice in [this comment](https://gitlab.kitware.com/cmake/cmake/-/issues/19223#note_567327). This is hopefully a step towards re-submitting WASI support to upstream cmake.
This ensures that it finds the built sysroot when testing whether the C compiler works.
compiler-rt depends on some libc headers, so it needs a sysroot.
fc51f5f
to
985879e
Compare
It appears with the removal of the AR checks cmake is no longer autodetecting CMAKE_AR, so set it explicitly.
…bly#161) This is a minor code-size optimization.
This change was mostly generated by changing the upstream llvm branch to 9.x and running: $ git submodule update --remote As well as switching the llvm 9 this change also bring in the following wasi-libc changes: 5933c20 fix macos filename, use https 7c39519 CI: upgrade to llvm 9.0.0 9ca5187 remove no-self-update workaround for windows azure 9580a25 deprecate azure pipelines CI, build libc on GH Actions 2c2fc9a Don't call `free` on paths which are about to call `_Exit`. (WebAssembly#161) c6f2c05 gen-headers: Generate assertions of layout from witx (WebAssembly#149) 37c663f Correct minor typo in c_headers.rs (WebAssembly#166) 12f5832 Convert more wasi-libc code to `//`-style comments. (WebAssembly#153) ec86d4d Improvements to wasi-headers tool (WebAssembly#160) 1fad338 Fix environment variable init to exit successfully. (WebAssembly#159) a280fea Move math source files. (WebAssembly#151) dd010be Avoid using cast expressions in WASI API constants. (WebAssembly#148) Fixes: WebAssembly#101
Change
CMAKE_SYSTEM_NAME
toWASI
, use aCMAKE_MODULE_PATH
,remove
CACHE
usage, and fix the compiler autodetection code so thatthe "compiler works" hacks are no longer needed, following the advice in
this comment.
This is hopefully a step towards re-submitting WASI support to upstream cmake.