It requires libc.a Maybe you have to add glibc into the environment.
This will work only if glibc is built with static library support, or
you are able to alter it.

2016-10-12 16:24 GMT+03:00 Bjørn Forsman <bjorn.fors...@gmail.com>:
> 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
> _______________________________________________
> nix-dev mailing list
> nix-dev@lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
_______________________________________________
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to