I'm trying to compile a simple program into a static executable:
$ cat hello.c
#include <stdio.h>
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
pkgsStatic
attribute. Many packages already just work, simply by building e.g. thepkgsStatic.hello
attribute.