From 7b7ffc4999ba4b38f8090aab48a78ace0eb3424a Mon Sep 17 00:00:00 2001 From: Joe Hermaszewski Date: Wed, 26 Apr 2017 14:01:35 +0000 Subject: [PATCH] LLVM-3.9: disable shared libraries in cross builds The current cc-wrapper script seems to have trouble setting the rpath correctly. Hopefully #25047 will fix this. --- pkgs/development/compilers/llvm/3.9/llvm.nix | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pkgs/development/compilers/llvm/3.9/llvm.nix b/pkgs/development/compilers/llvm/3.9/llvm.nix index 380abc0b9b47..96efc97323c6 100644 --- a/pkgs/development/compilers/llvm/3.9/llvm.nix +++ b/pkgs/development/compilers/llvm/3.9/llvm.nix @@ -15,13 +15,15 @@ , compiler-rt_src , libcxxabi , debugVersion ? false -, enableSharedLibraries ? true +, enableSharedLibraries ? (buildPlatform == hostPlatform) , darwin , buildPackages , buildPlatform , hostPlatform }: +assert (hostPlatform != buildPlatform) -> !enableSharedLibraries; + let src = fetch "llvm" "1vi9sf7rx1q04wj479rsvxayb6z740iaz3qniwp266fgp5a07n8z"; shlib = if stdenv.isDarwin then "dylib" else "so"; @@ -84,12 +86,6 @@ in stdenv.mkDerivation rec { preBuild = '' mkdir -p $out/ ln -sv $PWD/lib $out - '' - + # This is a good candidate for using the `placeholder` primitive when it's released - # This should hopefully be unnecessary once - # https://github.com/NixOS/nixpkgs/pull/25047 is merged - stdenv.lib.optionalString (buildPlatform != hostPlatform && enableSharedLibraries) '' - export NIX_CROSS_LDFLAGS="-rpath $lib/lib -rpath $lib/lib64 $NIX_CROSS_LDFLAGS" ''; cmakeFlags = with stdenv; [