[Nix-dev] Why can't Nix find my C++ compiler? (Mac OS X)

Shea Levy shea at shealevy.com
Tue Dec 16 19:20:38 CET 2014


> On Dec 16, 2014, at 5:45 PM, Rico Huijbers <rix0rrr at gmail.com> wrote:
> 
> Hi,
> 
> I'm new to Nix, and kicking the tires.
> 
> Right now, I'm trying to compile dmd (the D compiler) using Nix, but when I try to compile it, it can't seem to find my C++ compiler:
> 
>     rix0rrr at moloch ~/D/n/nixpkgs(master)> nix-env -i dmd
>     installing `dmd-2.066.1'
>     these derivations will be built:
>     /nix/store/wnpzsw0gjchi891kr60cvaq2r9z6bzq6-dmd-2.066.1.drv
>     .
>     .
>     .
>     building idgen
>     g++ -m64 idgen.c -o idgenn
>     make: g++: Command not found
>     .
>     .
>     .
>     error: build of `/nix/store/wnpzsw0gjchi891kr60cvaq2r9z6bzq6-dmd-2.066.1.drv' failed
> 
> Running a build shell works fine:
> 
>     rix0rrr at moloch ~/D/n/nixpkgs(master)> nix-build '<nixpkgs>' --run-env -A dmd
> 
>     [nix-shell:~/Dev/nix/nixpkgs]$ which gcc
>     /usr/bin/gcc
> 
> But I notice that my regular PATH is still in effect (including /usr/bin), and I figure it won't be in a "pure" Nix build, so I guess that kinda makes sense.
> 
> Question is, why won't the dmd expression pick up the compiler normally? The thing is using regular stdenv, and I guess it must have worked for somebody, sometime.
> 
> I'm still on Mavericks, by the way.
> 

This is the key, on OS X we use clang in stdenv. Probably there is a hard-coded “g++” in the nix expression or the source that needs to be replaced with “c++” or “clang++"

> Thanks for any help.
> 
> Regards,
> Rico
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev



More information about the nix-dev mailing list