diff options
author | Calvin Loncaric <marvinx03@gmail.com> | 2020-03-18 21:08:58 -0700 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2020-11-27 13:27:28 +0000 |
commit | 6722d80c1fc9857dea3bfe8d9950b4e288adda11 (patch) | |
tree | 1063dc27116655d3ea1aba6b940037a150fec67d /nixpkgs/pkgs | |
parent | 264f67859c87de433106ff97d00151b79dabc5ed (diff) | |
download | nixlib-6722d80c1fc9857dea3bfe8d9950b4e288adda11.tar nixlib-6722d80c1fc9857dea3bfe8d9950b4e288adda11.tar.gz nixlib-6722d80c1fc9857dea3bfe8d9950b4e288adda11.tar.bz2 nixlib-6722d80c1fc9857dea3bfe8d9950b4e288adda11.tar.lz nixlib-6722d80c1fc9857dea3bfe8d9950b4e288adda11.tar.xz nixlib-6722d80c1fc9857dea3bfe8d9950b4e288adda11.tar.zst nixlib-6722d80c1fc9857dea3bfe8d9950b4e288adda11.zip |
GCC: fix compilation on MacOS 10.15
MacOS 10.15 now includes "aligned_alloc". Disagreement between the headers and the binaries about whether aligned_alloc exists leads to a compilation failure (see #73319 and the detailed comment in this commit). (cherry picked from commit 3a79681eb45df9c89d1de613114394f49582f0d6)
Diffstat (limited to 'nixpkgs/pkgs')
-rw-r--r-- | nixpkgs/pkgs/development/compilers/gcc/common/pre-configure.nix | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/compilers/gcc/common/pre-configure.nix b/nixpkgs/pkgs/development/compilers/gcc/common/pre-configure.nix index 85b854e19b9a..fff490148007 100644 --- a/nixpkgs/pkgs/development/compilers/gcc/common/pre-configure.nix +++ b/nixpkgs/pkgs/development/compilers/gcc/common/pre-configure.nix @@ -17,3 +17,35 @@ lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) '' '' + lib.optionalString langAda '' export PATH=${gnatboot}/bin:$PATH '' + +# NOTE 2020/3/18: This environment variable prevents configure scripts from +# detecting the presence of aligned_alloc on Darwin. There are many facts that +# collectively make this fix necessary: +# - Nix uses a fixed set of standard library headers on all MacOS systems, +# regardless of their actual version. (Nix uses version 10.12 headers.) +# - Nix uses the native standard library binaries for the build system. That +# means the standard library binaries may not exactly match the standard +# library headers. +# - The aligned_alloc procedure is present in MacOS 10.15 (Catalina), but not +# in earlier versions. Therefore on Catalina systems, aligned_alloc is +# linkable (i.e. present in the binary libraries) but not present in the +# headers. +# - Configure scripts detect a procedure's existence by checking whether it is +# linkable. They do not check whether it is present in the headers. +# - GCC throws an error during compilation because aligned_alloc is not +# defined in the headers---even though the linker can see it. +# +# This fix would not be necessary if ANY of the above were false: +# - If Nix used native headers for each different MacOS version, aligned_alloc +# would be in the headers on Catalina. +# - If Nix used the same libary binaries for each MacOS version, aligned_alloc +# would not be in the library binaries. +# - If Catalina did not include aligned_alloc, this wouldn't be a problem. +# - If the configure scripts looked for header presence as well as +# linkability, they would see that aligned_alloc is missing. +# - If GCC allowed implicit declaration of symbols, it would not fail during +# compilation even if the configure scripts did not check header presence. +# ++ lib.optionalString (hostPlatform.isDarwin) '' + export ac_cv_func_aligned_alloc=no +'' |