diff options
author | Randy Eckenrode <randy@largeandhighquality.com> | 2023-11-15 19:02:46 -0500 |
---|---|---|
committer | Adam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com> | 2023-11-30 08:53:50 +0000 |
commit | 34da65ba2a6fc0e0c6c54397a4aaab4213ec2c72 (patch) | |
tree | d4f6df0f2c96b0876cef2882f4d485d0f62d5f14 /pkgs/development | |
parent | 0881edb66aa4b27e5894898bb2844aee79a5761a (diff) | |
download | nixlib-34da65ba2a6fc0e0c6c54397a4aaab4213ec2c72.tar nixlib-34da65ba2a6fc0e0c6c54397a4aaab4213ec2c72.tar.gz nixlib-34da65ba2a6fc0e0c6c54397a4aaab4213ec2c72.tar.bz2 nixlib-34da65ba2a6fc0e0c6c54397a4aaab4213ec2c72.tar.lz nixlib-34da65ba2a6fc0e0c6c54397a4aaab4213ec2c72.tar.xz nixlib-34da65ba2a6fc0e0c6c54397a4aaab4213ec2c72.tar.zst nixlib-34da65ba2a6fc0e0c6c54397a4aaab4213ec2c72.zip |
gcc6: don’t link libstdc++ to CoreFoundation
Using flat namespaces causes libstdc++ to link CoreFoundation, but that fails after #265102. Since CoreFoundation is not actually needed, disable flat namespaces to avoid linking it unnecessarily. Disabling flat namespaces matches the behavior of newer versions of libstdc++ (GCC 7+) when building for newer Darwin hosts (10.5+).
Diffstat (limited to 'pkgs/development')
-rw-r--r-- | pkgs/development/compilers/gcc/patches/6/libstdc++-disable-flat_namespace.patch | 26 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/patches/default.nix | 3 |
2 files changed, 29 insertions, 0 deletions
diff --git a/pkgs/development/compilers/gcc/patches/6/libstdc++-disable-flat_namespace.patch b/pkgs/development/compilers/gcc/patches/6/libstdc++-disable-flat_namespace.patch new file mode 100644 index 000000000000..571644410def --- /dev/null +++ b/pkgs/development/compilers/gcc/patches/6/libstdc++-disable-flat_namespace.patch @@ -0,0 +1,26 @@ +Backported from GCC 7. + +diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host +index 304a7f5aff6..d1a189d93d0 100644 +--- a/libstdc++-v3/configure.host ++++ b/libstdc++-v3/configure.host +@@ -234,7 +234,7 @@ case "${host_os}" in + os_include_dir="os/newlib" + OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)" + ;; +- darwin | darwin[1-7] | darwin[1-7].*) ++ darwin[1-7] | darwin[1-7].*) + # On Darwin, performance is improved if libstdc++ is single-module. + # Up to at least 10.3.7, -flat_namespace is required for proper + # treatment of coalesced symbols. +@@ -252,6 +252,10 @@ case "${host_os}" in + esac + os_include_dir="os/bsd/darwin" + ;; ++ darwin*) ++ # Post Darwin8, defaults should be sufficient. ++ os_include_dir="os/bsd/darwin" ++ ;; + *djgpp*) # leading * picks up "msdosdjgpp" + os_include_dir="os/djgpp" + error_constants_dir="os/djgpp" diff --git a/pkgs/development/compilers/gcc/patches/default.nix b/pkgs/development/compilers/gcc/patches/default.nix index c4b0dbf91b66..9eda241f6d3a 100644 --- a/pkgs/development/compilers/gcc/patches/default.nix +++ b/pkgs/development/compilers/gcc/patches/default.nix @@ -259,6 +259,9 @@ in # This patch can be dropped should darwin.cctools-llvm ever implement support. ++ optional (!atLeast7 && hostPlatform.isDarwin && lib.versionAtLeast (lib.getVersion stdenv.cc) "12") ./4.9/darwin-clang-as.patch +# Building libstdc++ with flat namespaces results in trying to link CoreFoundation, which +# defaults to the impure, system location and causes the build to fail. +++ optional (is6 && hostPlatform.isDarwin) ./6/libstdc++-disable-flat_namespace.patch ## gcc 4.9 and older ############################################################################## |