fix: For compatibilty with WebAssembly/wasi-sdk, adapt sysroot path
This commit is contained in:
parent
d3d714feb6
commit
6dc4cc15d2
2 changed files with 13 additions and 5 deletions
|
|
@ -1,8 +1,16 @@
|
|||
{ pkgs }:
|
||||
let
|
||||
# https://github.com/WebAssembly/wasi-sdk/blob/wasi-sdk-26/cmake/wasi-sdk-sysroot.cmake#L29
|
||||
sysroot_path = "share/wasi-sysroot";
|
||||
|
||||
# https://github.com/WebAssembly/wasi-sdk/blob/wasi-sdk-26/wasi-sdk.cmake#L10
|
||||
triple = "wasm32-wasi";
|
||||
in
|
||||
with pkgs;
|
||||
stdenv.mkDerivation rec {
|
||||
name = "wasi-libc";
|
||||
version = "21";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "WebAssembly";
|
||||
repo = "wasi-libc";
|
||||
|
|
@ -25,8 +33,8 @@ stdenv.mkDerivation rec {
|
|||
"CC=${wasm-llvm}/bin/clang"
|
||||
"NM=${wasm-llvm}/bin/nm"
|
||||
"AR=${wasm-llvm}/bin/ar"
|
||||
"SYSROOT_LIB=${builtins.placeholder "out"}/lib"
|
||||
"SYSROOT_INC=${builtins.placeholder "dev"}/include"
|
||||
"SYSROOT_SHARE=${builtins.placeholder "share"}/share"
|
||||
"SYSROOT_LIB=${builtins.placeholder "out"}/${sysroot_path}/lib/${triple}"
|
||||
"SYSROOT_INC=${builtins.placeholder "dev"}/${sysroot_path}/include/${triple}"
|
||||
"SYSROOT_SHARE=${builtins.placeholder "share"}/${sysroot_path}/share/${triple}"
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ stdenv.mkDerivation rec {
|
|||
-DLIBCXXABI_USE_LLVM_UNWINDER:BOOL=OFF \
|
||||
-DUNIX:BOOL=ON \
|
||||
--debug-trycompile \
|
||||
-DCMAKE_SYSROOT_COMPILE=${wasi-libc.dev} \
|
||||
-DCMAKE_SYSROOT_LINK=${wasi-libc} \
|
||||
-DCMAKE_SYSROOT_COMPILE=${wasi-libc.dev}/share/wasi-sysroot/ \
|
||||
-DCMAKE_SYSROOT_LINK=${wasi-libc}/share/wasi-sysroot \
|
||||
-DCMAKE_CXX_FLAGS="-fno-exceptions" \
|
||||
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
|
||||
${src}/runtimes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue