For setups without nix, the program I’m working on searches for libgcc_s.so.1
in /usr/lib/x86_64-linux-gnu
, /lib/x86_64-linux-gnu
, /usr/lib
and /usr/lib64
.
I have also set up a flake for the program. in the flake devShell I have the following env var:
NIX_GLIBC_PATH = if pkgs.stdenv.isLinux then "${pkgs.glibc.out}/lib" else "";
The program checks if NIX_GLIBC_PATH
is set before checking the directories I mentioned earlier (/usr/lib/x86_64...
).
Now I’m setting up a default.nix
file for a release on nixpkgs and when testing the binary on NixOS my program failed to find libgcc_s.so.1
which makes sense.
What is the recommended way to provide libgcc_s.so.1
to my program so that it works reliably for a release on nixpkgs and on MacOS, NixOS, Ubuntu, ArchLinux…?
I believe patchelf
is typically used as a workaround for existing executables but perhaps it is not recommended if you can modify the source code of the program. Should I be setting LD_LIBRARY_PATH
in my default.nix
?