Nixpkgs: gcc fails to build on OS X

Created on 9 Jul 2016  Â·  6Comments  Â·  Source: NixOS/nixpkgs

Issue description

With a completely fresh install of OS X 10.11, nixpkgs.gcc6, nixpkgs.gcc46, nixpkgs.gcc48, nixpkgs.gcc49 and nixpkgs.gcc fail to build. In fact, I've been unable to get any gcc package to build successfully. I tried before and after installing XCode and the command line tools, and regenerating the locate database with no changes in the results.

Attempting nix-env -iA nixpkgs.gcc6 results in the following error:

ld: library not found for -lc
collect2: error: ld returned 1 exit status
Makefile:945: recipe for target 'libgcc_s.dylib' failed
make[3]: *** [libgcc_s.dylib] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/private/var/folders/mt/c_dppb2s51bbvm3yy67mns080000gn/T/nix-build-gcc-6.1.0.drv-0/build/x86_64-apple-darwin15.5.0/libgcc'

and

make[3]: Leaving directory '/private/var/folders/mt/c_dppb2s51bbvm3yy67mns080000gn/T/nix-build-gcc-6.1.0.drv-0/build/x86_64-apple-darwin15.5.0/libgcc'
Makefile:14906: recipe for target 'all-stage1-target-libgcc' failed
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory '/private/var/folders/mt/c_dppb2s51bbvm3yy67mns080000gn/T/nix-build-gcc-6.1.0.drv-0/build'
Makefile:19116: recipe for target 'stage1-bubble' failed
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory '/private/var/folders/mt/c_dppb2s51bbvm3yy67mns080000gn/T/nix-build-gcc-6.1.0.drv-0/build'
Makefile:19420: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2

yet locate libc.dylib returns

/nix/store/d6pmsgblamr0wfvpdzikv8xnlfs5sjym-Libsystem-osx-10.9.5/lib/libc.dylib
/nix/store/w090w1675pg26kcwj7ka9f42c0a87wg9-Libsystem-osx-10.9.5/lib/libc.dylib
/usr/lib/libc.dylib

Steps to reproduce

nix-env -i nixpkgs.gcc6 on OS X 10.11.

Technical details

  • System: OS X 10.11 - completely fresh install (wiped, and then reinstalled)
  • Nix version: nix-env (Nix) 1.11.2
  • Nixpkgs version: 16.09pre83147.df89584
bug darwin

Most helpful comment

@knedlsepp It compiles fine if you have the "Command Line Tools" installed. If you don't (which includes Hydra), it fails with

The directory that should contain system headers does not exist:
  /usr/include

I've got it working in #18327 but it's not a very elegant solution.

All 6 comments

So, you should be able to build it on the latest Git master version, but it looks like there's some issue on Hydra:

http://hydra.nixos.org/build/37137502/nixlog/2/tail-reload

I ran a nix-channel --update today and then re-ran nix-env -iA nixpkgs.gcc6, and it got further in the installation process, but it finished with this error:

installing ‘gcc-wrapper-6.1.0’
building path(s) ‘/nix/store/mc7nx4j4y4ffyf1i97nn91skl5bak37l-user-environment’
Wide character in die at /nix/store/64jc9gd2rkbgdb4yjx3nrgc91bpjj5ky-buildenv.pl line 87.
error creating link ‘/nix/store/mc7nx4j4y4ffyf1i97nn91skl5bak37l-user-environment/share’: File exists at /nix/store/64jc9gd2rkbgdb4yjx3nrgc91bpjj5ky-buildenv.pl line 87.
builder for ‘/nix/store/j9lw52i3km4f4ghrnlilnyzh2a5sxb8n-user-environment.drv’ failed with exit code 17
error: build of ‘/nix/store/j9lw52i3km4f4ghrnlilnyzh2a5sxb8n-user-environment.drv’ failed

Any ideas?

For me it fails trying to do some odd variable name substitution in setup.sh:

building path(s) ‘/nix/store/bix7wn2c1cy4bmcpm6558cac7z10z5dh-gcc-wrapper-6.1.0’
WARNING: substitution variables should be valid bash names,
  "ccLDFlags+" isn't and therefore was skipped; it might be caused
  by multi-line phases in variables - see #14907 for details.
WARNING: substitution variables should be valid bash names,
  "ccCFlags+" isn't and therefore was skipped; it might be caused
  by multi-line phases in variables - see #14907 for details.
...

See: https://github.com/NixOS/nixpkgs/pull/14907

Just tried this and gcc6 compiles fine for me on 10.11.6. @rprechelt: Can you confirm this is not an issue anymore?

@knedlsepp It compiles fine if you have the "Command Line Tools" installed. If you don't (which includes Hydra), it fails with

The directory that should contain system headers does not exist:
  /usr/include

I've got it working in #18327 but it's not a very elegant solution.

We fixed this in recent master I believe.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tomberek picture tomberek  Â·  3Comments

ob7 picture ob7  Â·  3Comments

copumpkin picture copumpkin  Â·  3Comments

chris-martin picture chris-martin  Â·  3Comments

lverns picture lverns  Â·  3Comments