mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-26 05:57:28 +00:00
Merge #263876: pkgsCross.wasi32.stdenv: fix build with LLVM 16
...into staging-next
This commit is contained in:
commit
1046dc0255
@ -119,9 +119,9 @@ stdenv.mkDerivation {
|
||||
'';
|
||||
|
||||
# Hack around weird upsream RPATH bug
|
||||
postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) ''
|
||||
postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin) ''
|
||||
ln -s "$out/lib"/*/* "$out/lib"
|
||||
'' + lib.optionalString (useLLVM) ''
|
||||
'' + lib.optionalString (useLLVM && !stdenv.hostPlatform.isWasm) ''
|
||||
ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o
|
||||
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
|
||||
# Note the history of crt{begin,end}S in previous versions of llvm in nixpkg:
|
||||
|
@ -62,7 +62,7 @@ stdenv.mkDerivation rec {
|
||||
|
||||
buildInputs =
|
||||
lib.optionals (!headersOnly) [ cxxabi ]
|
||||
++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [ libunwind ];
|
||||
++ lib.optionals (stdenv.hostPlatform.useLLVM or false && !stdenv.hostPlatform.isWasm) [ libunwind ];
|
||||
|
||||
cmakeFlags = let
|
||||
# See: https://libcxx.llvm.org/BuildingLibcxx.html#cmdoption-arg-libcxx-cxx-abi-string
|
||||
@ -87,6 +87,7 @@ stdenv.mkDerivation rec {
|
||||
"-DLIBCXX_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
|
||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||
"-DUNIX=ON" # Required otherwise libc++ fails to detect the correct linker
|
||||
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF"
|
||||
# If we're only building the headers we don't actually *need* a functioning
|
||||
# C/C++ compiler:
|
||||
|
@ -28,8 +28,6 @@ stdenv.mkDerivation rec {
|
||||
|
||||
postUnpack = lib.optionalString stdenv.isDarwin ''
|
||||
export TRIPLE=x86_64-apple-darwin
|
||||
'' + lib.optionalString stdenv.hostPlatform.isWasm ''
|
||||
patch -p1 -d llvm -i ${../../common/libcxxabi/wasm.patch}
|
||||
'';
|
||||
|
||||
prePatch = ''
|
||||
@ -65,7 +63,7 @@ stdenv.mkDerivation rec {
|
||||
# CMake however checks for this anyways; this flag tells it not to. See:
|
||||
# https://github.com/llvm/llvm-project/blob/4bd3f3759259548e159aeba5c76efb9a0864e6fa/llvm/runtimes/CMakeLists.txt#L243
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [
|
||||
] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false && !stdenv.hostPlatform.isWasm) [
|
||||
"-DLLVM_ENABLE_LIBCXX=ON"
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
|
||||
# libcxxabi's CMake looks as though it treats -nostdlib++ as implying -nostdlib,
|
||||
@ -74,8 +72,11 @@ stdenv.mkDerivation rec {
|
||||
"-DCMAKE_EXE_LINKER_FLAGS=-nostdlib"
|
||||
"-DCMAKE_SHARED_LINKER_FLAGS=-nostdlib"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DLIBCXXABI_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
|
||||
"-DUNIX=ON" # Required otherwise libc++ fails to detect the correct linker
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
let
|
||||
pname = "wasilibc";
|
||||
version = "19";
|
||||
version = "20";
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
inherit pname version;
|
||||
@ -17,7 +17,7 @@ stdenv.mkDerivation {
|
||||
owner = "WebAssembly";
|
||||
repo = "wasi-libc";
|
||||
rev = "refs/tags/wasi-sdk-${version}";
|
||||
hash = "sha256-yQSKoSil/C/1lIHwEO9eQKC/ye3PJIFGYjHyNDn61y4=";
|
||||
hash = "sha256-H92PDrH1FL7S3eMCK1+wqclryjhwghl21bOlRCAr1U4=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user