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 }:
|
{ 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;
|
with pkgs;
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "wasi-libc";
|
name = "wasi-libc";
|
||||||
version = "21";
|
version = "21";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "WebAssembly";
|
owner = "WebAssembly";
|
||||||
repo = "wasi-libc";
|
repo = "wasi-libc";
|
||||||
|
|
@ -25,8 +33,8 @@ stdenv.mkDerivation rec {
|
||||||
"CC=${wasm-llvm}/bin/clang"
|
"CC=${wasm-llvm}/bin/clang"
|
||||||
"NM=${wasm-llvm}/bin/nm"
|
"NM=${wasm-llvm}/bin/nm"
|
||||||
"AR=${wasm-llvm}/bin/ar"
|
"AR=${wasm-llvm}/bin/ar"
|
||||||
"SYSROOT_LIB=${builtins.placeholder "out"}/lib"
|
"SYSROOT_LIB=${builtins.placeholder "out"}/${sysroot_path}/lib/${triple}"
|
||||||
"SYSROOT_INC=${builtins.placeholder "dev"}/include"
|
"SYSROOT_INC=${builtins.placeholder "dev"}/${sysroot_path}/include/${triple}"
|
||||||
"SYSROOT_SHARE=${builtins.placeholder "share"}/share"
|
"SYSROOT_SHARE=${builtins.placeholder "share"}/${sysroot_path}/share/${triple}"
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,8 @@ stdenv.mkDerivation rec {
|
||||||
-DLIBCXXABI_USE_LLVM_UNWINDER:BOOL=OFF \
|
-DLIBCXXABI_USE_LLVM_UNWINDER:BOOL=OFF \
|
||||||
-DUNIX:BOOL=ON \
|
-DUNIX:BOOL=ON \
|
||||||
--debug-trycompile \
|
--debug-trycompile \
|
||||||
-DCMAKE_SYSROOT_COMPILE=${wasi-libc.dev} \
|
-DCMAKE_SYSROOT_COMPILE=${wasi-libc.dev}/share/wasi-sysroot/ \
|
||||||
-DCMAKE_SYSROOT_LINK=${wasi-libc} \
|
-DCMAKE_SYSROOT_LINK=${wasi-libc}/share/wasi-sysroot \
|
||||||
-DCMAKE_CXX_FLAGS="-fno-exceptions" \
|
-DCMAKE_CXX_FLAGS="-fno-exceptions" \
|
||||||
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
|
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
|
||||||
${src}/runtimes
|
${src}/runtimes
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue