Skip to content

Commit

Permalink
llvmPackages_{12,13,14,15,16,17,18,git}.clang: fix libLTO.dylib path
Browse files Browse the repository at this point in the history
Clang assumes that `libLTO.dylib` is located at `../lib` in the same
prefix as `clang`, but that’s not true in nixpkgs. `libLTO.dylib` is
actually located at `libllvm^lib/lib.libLTO.dylib`.
  • Loading branch information
reckenrode committed Apr 15, 2024
1 parent 8326783 commit 6011c50
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkgs/development/compilers/llvm/common/clang/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ let
"-DCLANG_PSEUDO_GEN=${buildLlvmTools.libclang.dev}/bin/clang-pseudo-gen"
]);

postPatch = (if lib.versionOlder release_version "13" then ''
postPatch = ''
# Make sure clang passes the correct location of libLTO to ld64
substituteInPlace lib/Driver/ToolChains/Darwin.cpp \
--replace-fail 'StringRef P = llvm::sys::path::parent_path(D.Dir);' 'StringRef P = "${lib.getLib libllvm}";'
'' + (if lib.versionOlder release_version "13" then ''
sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \
-e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' \
lib/Driver/ToolChains/*.cpp
Expand Down

0 comments on commit 6011c50

Please sign in to comment.