Bjørn Forsman
2016-10-12 13:24:52 UTC
Hi all,
On Ubuntu, I can compile static binaries with "gcc -static foo.c". But on NixOS:
$ nix-shell -p gcc
$ gcc -static foo.c
/nix/store/nm9r5lymydnsrlxjn30ym2kix6mbyr19-binutils-2.27/bin/ld:
cannot find -lc
collect2: error: ld returned 1 exit status
How to fix it?
Things I tried:
* Googling "nixpkgs static gcc". Found nothing.
* Grepping the nixpkgs tree, hoping to see stdenvStatic or something.
Found reference to dontDisableStatic for autotools packages. (Do I
have to rebuild GCC for static linking?)
* Looked in the NixOS and nixpkgs manual. Found references to static
Haskell binaries, but not for plain old C.
Best regards,
Bjørn Forsman
On Ubuntu, I can compile static binaries with "gcc -static foo.c". But on NixOS:
$ nix-shell -p gcc
$ gcc -static foo.c
/nix/store/nm9r5lymydnsrlxjn30ym2kix6mbyr19-binutils-2.27/bin/ld:
cannot find -lc
collect2: error: ld returned 1 exit status
How to fix it?
Things I tried:
* Googling "nixpkgs static gcc". Found nothing.
* Grepping the nixpkgs tree, hoping to see stdenvStatic or something.
Found reference to dontDisableStatic for autotools packages. (Do I
have to rebuild GCC for static linking?)
* Looked in the NixOS and nixpkgs manual. Found references to static
Haskell binaries, but not for plain old C.
Best regards,
Bjørn Forsman