Since NixOS Warbler upgrade C programs don't compile with gcc

Here is example #1: $ gcc -o sizeof sizeof.c -lm
/nix/store/v63bxfiacw082c7ijshf60alvvrpfxsq-binutils-2.44/bin/ld: cannot find crt1.o: No such file or directory
/nix/store/v63bxfiacw082c7ijshf60alvvrpfxsq-binutils-2.44/bin/ld: cannot find crti.o: No such file or directory
collect2: error: ld returned 1 exit status

example #2: $ gcc -o addressof addressof.c
/nix/store/v63bxfiacw082c7ijshf60alvvrpfxsq-binutils-2.44/bin/ld: cannot find crt1.o: No such file or directory
/nix/store/v63bxfiacw082c7ijshf60alvvrpfxsq-binutils-2.44/bin/ld: cannot find crti.o: No such file or directory
/nix/store/v63bxfiacw082c7ijshf60alvvrpfxsq-binutils-2.44/bin/ld: cannot find -lgcc_s: No such file or directory
collect2: error: ld returned 1 exit status

When using NixOS 24.11 Vicuna no problem compiling C programs. I am learning at home, self study.

What has changed and what do I need to do to use gcc to compile C with?

How do your development shells look like?

And do you have a minimal project to reproduce the issue?

1 Like

I am not at this level of development. Is NixOS no longer a feasible platform to support common use of Bash CLI and GNU GCC?

Use a nix dev shell; that was always the intended way to compile projects ad hoc on NixOS. gcc does not go on your system package list.

See Declarative shell environments with shell.nix — nix.dev documentation

4 Likes