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
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
nix-dev mailing list

Reply via email to