diff options
Diffstat (limited to 'pkgs/development/compilers/llvm/12/compiler-rt/default.nix')
-rw-r--r-- | pkgs/development/compilers/llvm/12/compiler-rt/default.nix | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/pkgs/development/compilers/llvm/12/compiler-rt/default.nix b/pkgs/development/compilers/llvm/12/compiler-rt/default.nix index b880a0071b9..8ca01e44a54 100644 --- a/pkgs/development/compilers/llvm/12/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/12/compiler-rt/default.nix @@ -4,14 +4,15 @@ let useLLVM = stdenv.hostPlatform.useLLVM or false; bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none"; + haveLibc = stdenv.cc.libc != null; inherit (stdenv.hostPlatform) isMusl; in stdenv.mkDerivation rec { - pname = "compiler-rt"; + pname = "compiler-rt" + lib.optionalString (haveLibc) "-libc"; inherit version; - src = fetch pname "0d444qihq9jhqnfv003cr704v363va72zl6qaw2algj1c85cva45"; + src = fetch "compiler-rt" "0d444qihq9jhqnfv003cr704v363va72zl6qaw2algj1c85cva45"; nativeBuildInputs = [ cmake python3 llvm.dev ]; buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi; @@ -29,14 +30,15 @@ stdenv.mkDerivation rec { "-DCOMPILER_RT_BUILD_XRAY=OFF" "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF" "-DCOMPILER_RT_BUILD_PROFILE=OFF" - ] ++ lib.optionals (useLLVM || bareMetal) [ + ] ++ lib.optionals ((useLLVM || bareMetal) && !haveLibc) [ "-DCMAKE_C_COMPILER_WORKS=ON" "-DCMAKE_CXX_COMPILER_WORKS=ON" "-DCOMPILER_RT_BAREMETAL_BUILD=ON" "-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}" + ] ++ lib.optionals (useLLVM && !haveLibc) [ + "-DCMAKE_C_FLAGS=-nodefaultlibs" ] ++ lib.optionals (useLLVM) [ "-DCOMPILER_RT_BUILD_BUILTINS=ON" - "-DCMAKE_C_FLAGS=-nodefaultlibs" #https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY" ] ++ lib.optionals (bareMetal) [ |