llvmPackages_*.stdenv: use top-level libc++ on Darwin#264091
Closed
reckenrode wants to merge 18 commits intoNixOS:stagingfrom
Closed
llvmPackages_*.stdenv: use top-level libc++ on Darwin#264091reckenrode wants to merge 18 commits intoNixOS:stagingfrom
reckenrode wants to merge 18 commits intoNixOS:stagingfrom
Conversation
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
13 tasks
Member
|
Can confirm that this PR fixes #244319. |
Contributor
Author
|
Converting this to draft since it missed the deadline for breaking LLVM changes. I’ll pick it back up post-23.11. |
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.
52 tasks
Contributor
|
Closed by #346043 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)