-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
llvmPackages_*.stdenv: use top-level libc++ on Darwin #264091
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This change treats the top-level libc++ as the “system” libc++ on Darwin, matching the way libstdc++ is used on Linux. The approach it takes is to use the requested version’s libc++ headers while linking against the top-level library. This is safe to do because libc++ is built with the stable ABI on Darwin by default. This change is necessary to support building a package with one version of clang while linking against libraries that are built with different versions. Otherwise, if they both use C++, they will link against different versions of libc++ and (probably) crash at runtime. Examples of where this is an issue include older versions of nodejs building with clang 15 and darktable (which is currently built with clang 13).
This change treats the top-level libc++ as the “system” libc++ on Darwin, matching the way libstdc++ is used on Linux. The approach it takes is to use the requested version’s libc++ headers while linking against the top-level library. This is safe to do because libc++ is built with the stable ABI on Darwin by default. This change is necessary to support building a package with one version of clang while linking against libraries that are built with different versions. Otherwise, if they both use C++, they will link against different versions of libc++ and (probably) crash at runtime. Examples of where this is an issue include older versions of nodejs building with clang 15 and darktable (which is currently built with clang 13).
This change treats the top-level libc++ as the “system” libc++ on Darwin, matching the way libstdc++ is used on Linux. The approach it takes is to use the requested version’s libc++ headers while linking against the top-level library. This is safe to do because libc++ is built with the stable ABI on Darwin by default. This change is necessary to support building a package with one version of clang while linking against libraries that are built with different versions. Otherwise, if they both use C++, they will link against different versions of libc++ and (probably) crash at runtime. Examples of where this is an issue include older versions of nodejs building with clang 15 and darktable (which is currently built with clang 13).
This change treats the top-level libc++ as the “system” libc++ on Darwin, matching the way libstdc++ is used on Linux. The approach it takes is to use the requested version’s libc++ headers while linking against the top-level library. This is safe to do because libc++ is built with the stable ABI on Darwin by default. This change is necessary to support building a package with one version of clang while linking against libraries that are built with different versions. Otherwise, if they both use C++, they will link against different versions of libc++ and (probably) crash at runtime. Examples of where this is an issue include older versions of nodejs building with clang 15 and darktable (which is currently built with clang 13).
This change treats the top-level libc++ as the “system” libc++ on Darwin, matching the way libstdc++ is used on Linux. The approach it takes is to use the requested version’s libc++ headers while linking against the top-level library. This is safe to do because libc++ is built with the stable ABI on Darwin by default. This change is necessary to support building a package with one version of clang while linking against libraries that are built with different versions. Otherwise, if they both use C++, they will link against different versions of libc++ and (probably) crash at runtime. Examples of where this is an issue include older versions of nodejs building with clang 15 and darktable (which is currently built with clang 13).
This change treats the top-level libc++ as the “system” libc++ on Darwin, matching the way libstdc++ is used on Linux. The approach it takes is to use the requested version’s libc++ headers while linking against the top-level library. This is safe to do because libc++ is built with the stable ABI on Darwin by default. This change is necessary to support building a package with one version of clang while linking against libraries that are built with different versions. Otherwise, if they both use C++, they will link against different versions of libc++ and (probably) crash at runtime. Examples of where this is an issue include older versions of nodejs building with clang 15 and darktable (which is currently built with clang 13).
This change treats the top-level libc++ as the “system” libc++ on Darwin, matching the way libstdc++ is used on Linux. The approach it takes is to use the requested version’s libc++ headers while linking against the top-level library. This is safe to do because libc++ is built with the stable ABI on Darwin by default. This change is necessary to support building a package with one version of clang while linking against libraries that are built with different versions. Otherwise, if they both use C++, they will link against different versions of libc++ and (probably) crash at runtime. Examples of where this is an issue include older versions of nodejs building with clang 15 and darktable (which is currently built with clang 13).
This change treats the top-level libc++ as the “system” libc++ on Darwin, matching the way libstdc++ is used on Linux. The approach it takes is to use the requested version’s libc++ headers while linking against the top-level library. This is safe to do because libc++ is built with the stable ABI on Darwin by default. This change is necessary to support building a package with one version of clang while linking against libraries that are built with different versions. Otherwise, if they both use C++, they will link against different versions of libc++ and (probably) crash at runtime. Examples of where this is an issue include older versions of nodejs building with clang 15 and darktable (which is currently built with clang 13).
This change treats the top-level libc++ as the “system” libc++ on Darwin, matching the way libstdc++ is used on Linux. The approach it takes is to use the requested version’s libc++ headers while linking against the top-level library. This is safe to do because libc++ is built with the stable ABI on Darwin by default. This change is necessary to support building a package with one version of clang while linking against libraries that are built with different versions. Otherwise, if they both use C++, they will link against different versions of libc++ and (probably) crash at runtime. Examples of where this is an issue include older versions of nodejs building with clang 15 and darktable (which is currently built with clang 13).
This change treats the top-level libc++ as the “system” libc++ on Darwin, matching the way libstdc++ is used on Linux. The approach it takes is to use the requested version’s libc++ headers while linking against the top-level library. This is safe to do because libc++ is built with the stable ABI on Darwin by default. This change is necessary to support building a package with one version of clang while linking against libraries that are built with different versions. Otherwise, if they both use C++, they will link against different versions of libc++ and (probably) crash at runtime. Examples of where this is an issue include older versions of nodejs building with clang 15 and darktable (which is currently built with clang 13).
This change treats the top-level libc++ as the “system” libc++ on Darwin, matching the way libstdc++ is used on Linux. The approach it takes is to use the requested version’s libc++ headers while linking against the top-level library. This is safe to do because libc++ is built with the stable ABI on Darwin by default. This change is necessary to support building a package with one version of clang while linking against libraries that are built with different versions. Otherwise, if they both use C++, they will link against different versions of libc++ and (probably) crash at runtime. Examples of where this is an issue include older versions of nodejs building with clang 15 and darktable (which is currently built with clang 13).
This change treats the top-level libc++ as the “system” libc++ on Darwin, matching the way libstdc++ is used on Linux. The approach it takes is to use the requested version’s libc++ headers while linking against the top-level library. This is safe to do because libc++ is built with the stable ABI on Darwin by default. This change is necessary to support building a package with one version of clang while linking against libraries that are built with different versions. Otherwise, if they both use C++, they will link against different versions of libc++ and (probably) crash at runtime. Examples of where this is an issue include older versions of nodejs building with clang 15 and darktable (which is currently built with clang 13).
This reverts commit efdf4e9.
This reverts commit 81e4ca5.
Trying to backport the fixes from v8 caused crashes with npm when building other packages, so just build it with clang 15
ofborg
bot
requested review from
lovek323,
Ericson2314,
alyssais,
rrbutani,
primeos,
sternenseemann and
dtzWill
October 29, 2023 04:18
13 tasks
Can confirm that this PR fixes #244319. |
Converting this to draft since it missed the deadline for breaking LLVM changes. I’ll pick it back up post-23.11. |
reckenrode
changed the title
llvmPackages_*.stdenv
llvmPackages_*.stdenv: use top-level libc++ on Darwin
Oct 30, 2023
13 tasks
reckenrode
added a commit
to reckenrode/nixpkgs
that referenced
this pull request
Nov 4, 2023
This was taken from NixOS#264091 to use in the interim before that PR lands (sometime after the release of 23.11). It allows different versions of clang to link the same libc++, allowing dependencies to be linked when they are built with a different version of clang than the stdenv.
wegank
added
the
2.status: merge conflict
This PR has merge conflicts with the target branch
label
Mar 20, 2024
rrbutani
added
the
6.topic: llvm/clang
Issues related to llvmPackages, clangStdenv and related
label
May 27, 2024
wegank
added
the
2.status: stale
https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md
label
Jul 4, 2024
52 tasks
Closed by #346043 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
2.status: merge conflict
This PR has merge conflicts with the target branch
2.status: stale
https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md
6.topic: darwin
Running or building packages on Darwin
6.topic: llvm/clang
Issues related to llvmPackages, clangStdenv and related
6.topic: nodejs
10.rebuild-darwin: 501-1000
10.rebuild-darwin: 501+
10.rebuild-linux: 501+
10.rebuild-linux: 1001-2500
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
This PR is an alternative to #263847 to resolve the nodejs_18 crashes in staging-next #263535.
Instead of overriding the version of libc++ used by clang in each derivation, this PR moves that logic to llvmPackages_*.clang. This allows llvmPackages_*.stdenv to build with one version of clang while linking dependencies built with different versions of clang (because they all use the same libc++), which helps avoid crashes at runtime.
This approach is similar to how the llvmPackages_*.stdenv works with Linux, which uses the same libstdc++ regardless of clang version. While libc++ maintains ABI compatibility, newer headers are not compatible with older compilers. This is addressed by using the original headers with the new libc++ (due to libc++’s ABI stability).
This PR was tested with nodejs_14, nodejs_16, nodejs_18, and Swift (which also performed this override). All built successfully. paperless-ngx.frontend was also built successfully to test node. Other packages built successfully include darktable (clang 13), cone (clang 7), and dar (clang 12).
Users who wish to use a specific version of libc++ with clang can continue using llvmPackages_*.libcxxClang and llvmPackages_*.libcxxStdenv.
Closes #263847.
Things done
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/
)