Gcclib not working

Im just new to NixOS and tried to use gcc / g++ etc, so i’ve googled and found the package libgcc.

now i added it to my NixOS config and rebuilded multiple times, but nothing works.
the error messages are similar to:
gcc: command not found.

here are some informations about my NixOS:

  • shell: zsh
  • NixOS version: 23.11 (Tapir)
  • GNOME Version: 45.5

would be wery happy about someone who knows how to fix this.

Try gcc instead. libgcc doesn’t contain any binaries, just libraries, as the name suggests (though I wonder why that package isn’t just gcc.dev, historic reasons I guess?).

You’ll probably find that adding gcc to your system won’t actually let you build very much, though, you’ll need a devshell and explicitly depend on all your dependencies in that shell to be able to link against anything.

Don’t use mkShellNoCC for C/++ development of course.

I think nixpkgs’ stdenv.mkShell comes with a gcc stdenv by default, so you wouldn’t need to explicitly add gcc. If you want to use clang or a different version of gcc, search for stdenv on search.nixos.org and use the mkShell of one of those.

1 Like

thanks. its just that i typed in gcc at NixOS Search and the first thing i’ve got was libgcc.

should i install libgcc anyway or can i just remove it

very thanks!

Up to you, but I believe it literally does nothing (except take some disk space) when added to environment.systemPackages.