about summary refs log tree commit diff
path: root/pkgs/development/compilers/rust
diff options
context:
space:
mode:
authorSymphorien Gibol <symphorien+git@xlumurb.eu>2018-11-08 12:58:56 +0100
committerSymphorien Gibol <symphorien+git@xlumurb.eu>2018-11-08 13:10:24 +0100
commit973eca740bec22df9760f9db9e1e66f3e5f6c164 (patch)
treefc25b3947fa69541f30c3ec0b61428c975eb8ab6 /pkgs/development/compilers/rust
parent4b0d441cc4db398222efc17973386ea0fe897a41 (diff)
rustc: fix build with unbundled jemalloc and llvm on darwin
jemalloc with stripped prefix would cause segfaults in free:
https://github.com/NixOS/nixpkgs/pull/49557#issuecomment-436734677

Thanks to @danieldk for darwin testing/debugging.
Diffstat (limited to 'pkgs/development/compilers/rust')
-rw-r--r--pkgs/development/compilers/rust/rustc.nix5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix
index 48710753d803b..3ec08a82d0179 100644
--- a/pkgs/development/compilers/rust/rustc.nix
+++ b/pkgs/development/compilers/rust/rustc.nix
@@ -20,6 +20,8 @@ let
 
   llvmShared = llvm.override { enableSharedLibraries = true; };
 
+  prefixedJemalloc = jemalloc.override { stripPrefix = false; };
+
   target = builtins.replaceStrings [" "] [","] (builtins.toString targets);
 in
 
@@ -43,6 +45,7 @@ stdenv.mkDerivation {
   NIX_LDFLAGS =
        # when linking stage1 libstd: cc: undefined reference to `__cxa_begin_catch'
        optional (stdenv.isLinux && !withBundledLLVM) "--push-state --as-needed -lstdc++ --pop-state"
+    ++ optional (stdenv.isDarwin && !withBundledLLVM) "-lc++"
     ++ optional stdenv.isDarwin "-rpath ${llvmShared}/lib";
 
   # Enable nightly features in stable compiles (used for
@@ -59,7 +62,7 @@ stdenv.mkDerivation {
   configureFlags = configureFlags
                 ++ [ "--enable-local-rust" "--local-rust-root=${rustPlatform.rust.rustc}" "--enable-rpath"
                      "--enable-vendor"
-                     "--jemalloc-root=${jemalloc}/lib"
+                     "--jemalloc-root=${prefixedJemalloc}/lib"
                      "--default-linker=${targetPackages.stdenv.cc}/bin/cc" ]
                 ++ optional (!withBundledLLVM) [ "--enable-llvm-link-shared" "--llvm-root=${llvmShared}" ]
                 ++ optional (targets != []) "--target=${target}";