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

ci: Add WASI SDK build #175

Merged
merged 3 commits into from
May 25, 2021
Merged

ci: Add WASI SDK build #175

merged 3 commits into from
May 25, 2021

Conversation

chfast
Copy link
Owner

@chfast chfast commented May 24, 2021

No description provided.

set(CMAKE_SYSROOT ${WASI_SDK_PREFIX}/share/wasi-sysroot)
endif()

include(${WASI_SDK_PREFIX}/share/cmake/wasi-sdk.cmake)
Copy link
Collaborator

@axic axic May 24, 2021

Choose a reason for hiding this comment

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

The reason the upstream toolchain did not work for me, is because it uses Platform/wasi which is non-existent.

However the bigger problem is, in that case it falls back to the host settings and on macOS it will not work. The macOS platform file adds some linker flags:

$ cmake -DTOOLCHAIN=wasm32-wasi -DETHASH_BUILD_TESTS=NO -DETHASH_BUILD_GLOBAL_CONTEXT=NO -DWASI_SDK_PREFIX=/Users/alex/Projects/evmone/wasi-sdk-12.0 ..
-- [cable ] Cable 0.4.1 initialized
-- [cable ] Build type: Release
-- The C compiler identification is Clang 11.0.0
-- The CXX compiler identification is Clang 11.0.0
-- Check for working C compiler: /Users/alex/Project/evmone/wasi-sdk-12.0/bin/clang
-- Check for working C compiler: /Users/alex/Projects/evmone/wasi-sdk-12.0/bin/clang - broken
CMake Error at /usr/local/Cellar/cmake/3.19.2/share/cmake/Modules/CMakeTestCCompiler.cmake:66 (message):
  The C compiler

    "/Users/alex/Projects/evmone/wasi-sdk-12.0/bin/clang"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/alex/Projects/ethash/build/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/usr/bin/make cmTC_975d6/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/cmTC_975d6.dir/build.make CMakeFiles/cmTC_975d6.dir/build
    Building C object CMakeFiles/cmTC_975d6.dir/testCCompiler.c.o
    /Users/alex/Projects/evmone/wasi-sdk-12.0/bin/clang --target=wasm32-wasi --sysroot=/Users/alex/Projects/evmone/wasi-sdk-12.0/share/wasi-sysroot   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -o CMakeFiles/cmTC_975d6.dir/testCCompiler.c.o -c /Users/alex/Projects/ethash/build/CMakeFiles/CMakeTmp/testCCompiler.c
    Linking C executable cmTC_975d6
    /usr/local/Cellar/cmake/3.19.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_975d6.dir/link.txt --verbose=1
    /Users/alex/Projects/evmone/wasi-sdk-12.0/bin/clang --target=wasm32-wasi --sysroot=/Users/alex/Projects/evmone/wasi-sdk-12.0/share/wasi-sysroot  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_975d6.dir/testCCompiler.c.o -o cmTC_975d6 
    wasm-ld: error: unknown argument: -search_paths_first
    wasm-ld: error: unknown argument: -headerpad_max_install_names
    clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
    make[1]: *** [cmTC_975d6] Error 1
    make: *** [cmTC_975d6/fast] Error 2

That's why I used linux explicitly in ethereum/evmone#328

Copy link
Owner Author

Choose a reason for hiding this comment

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

It looks it passes some macos specific flags to wasm-ld.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yep:

However the bigger problem is, in that case it falls back to the host settings and on macOS it will not work. The macOS platform file adds some linker flags:

@codecov-commenter
Copy link

codecov-commenter commented May 24, 2021

Codecov Report

Merging #175 (2b4d601) into master (425f9cb) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##            master      #175   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines         1652      1652           
=========================================
  Hits          1652      1652           
Flag Coverage Δ
be 89.31% <ø> (ø)
default 99.81% <ø> (ø)
x86_64 89.06% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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