Skip to content
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

use compnerd/cmake's build of wasi-libc #94

Closed
wants to merge 10 commits into from

Conversation

pchickey
Copy link
Collaborator

Using this PR to get the CI system to try building with wasi-libc's new CMamke based build system, by @compnerd

WebAssembly/wasi-libc#154 (comment)

Makefile Outdated
--install \
-DCMAKE_SYSTEM_NAME=Generic \
-DCMAKE_AR=$(ROOT_DIR)/bin/llvm-ar \
-DCMAKE_NM=$(ROOT_DIR)/bin/llvm-nm \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pre-existing, but we can remove the "llvm-" from these commands, as we install a plain "nm" and "ar" now.

Pat Hickey added 4 commits January 16, 2020 17:41
thanks dan for pointing out we dont need the prefix
cmake wont be able to execute the wasm program output by wasi-sdk's
clang
i thought that was what --install would do. oh well
@compnerd
Copy link

compnerd commented Jan 24, 2020

Drop the explicit install target and I think that it should work. I didn't really see an install target previously, so I did not create one. Currently, the CMake build will generate a complete sysroot under the sysroot directory in the build tree. (The last commit should also be unneeded)

@pchickey
Copy link
Collaborator Author

Subsequent build steps (compiler-rt) are calling the clang built prior to build, and requires some headers provided by wasi-libc. Clang's system include path is searching at $(PREFIX)/share/wasi-sysroot. So, we need to install wasi-libc to that location for the rest of the build to work, and for it to end up in the packages created by this repo.

@compnerd
Copy link

compnerd commented Jan 25, 2020

@pchickey sorry if what I was saying was unclear. What I meant is that something like this should work:

cmake -G Ninja \
 		-DCMAKE_SYSTEM_NAME=Generic \
 		-DCMAKE_AR=$(PREFIX)/bin/ar \
 		-DCMAKE_NM=$(PREFIX)/bin/nm \
 		-DCMAKE_C_COMPILER=$(PREFIX)/bin/clang \
 		-DCMAKE_C_COMPILER_WORKS=YES \
		-B build/wasi-libc \
 		-S $(ROOT_DIR)/src/wasi-libc
cmake --build build/wasi-libc

That will generate a proper sysroot in build/wasi-libc/sysroot. A cp -r build/wasi-libc/sysroot $(PREFIX)/share/wasi-sysroot should be sufficient to "install"

@pchickey
Copy link
Collaborator Author

@compnerd thanks, that fix got us through compiler-rt, but now libcxx is failing. Any ideas?

@compnerd
Copy link

-- Performing Test LIBCXX_SUPPORTS_STD_EQ_CXX14_FLAG
-- Performing Test LIBCXX_SUPPORTS_STD_EQ_CXX14_FLAG - Failed
-- Performing Test LIBCXX_SUPPORTS_STD_COLON_CXX14_FLAG
-- Performing Test LIBCXX_SUPPORTS_STD_COLON_CXX14_FLAG - Failed
  C++11 or greater is required but the compiler does not support c++14

Seems that -std=c++14 and /std:c++14 are both failing. Unfortunately, I cannot tell what is failing in the test :(. You could theoretically try -D LIBCXX_SUPPORTS_STD_EQ_CXX14_FLAG=YES as a workaround.

@pchickey
Copy link
Collaborator Author

I never got back to this and it isn't a priority, so closing for now. If anyone else wants to take this work on, feel free to re-open.

@pchickey pchickey closed this Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants