cc-wrapper: Enter C++ mode when -lc++ is passed #269694
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes
When linking C++ programs in LLVM we're currently explicitly passing in -lc++abi as this appears to be required by recent versions of Clang. However, it also appears to b common for packages to use the C compiler to link binaries which uses C++, in which case they do pass in -lc++. This changes the wrapper to also take this into consideration and enter "C++ mode" whenever -lc++ is passed as an argument.
Fixes #166205.
Fixes #150655
Things done
I'm very new to nixpkgs and haven't really tested this change directly. I did manually apply the same patch in a local version of the cc-wrapper script and saw that I was able to link C++ binaries using the C compiler (more specifically: I was able to build Postgis).
I believe this change will cause quite a lot of rebuilds? Hence I targeted the
staging
branch.nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Priorities
Add a 👍 reaction to pull requests you find important.