Sample Header Ad - 728x90

How to compile a program statically on NixOS?

2 votes
1 answer
2722 views
I'm trying to compile a simple program into a static executable:
$ cat hello.c
#include 
int main() {
    puts("Hello, world!");
}
However, I'm met with the following error:
$ gcc -static hello.c -o hello
/nix/store/p792j5f44l3f0xi7ai5jllwnxqwnka88-binutils-2.31.1/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
Asked by Maya (408 rep)
Oct 21, 2020, 01:53 PM