You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
hello: "`GLIBC_2.38' not found" when using LD_PRELOAD with the host system's libstdc++ (higher than nixpkgs') #287764
I installed Nix native package, added the user to the group, and enabled the daemon, as it was stated in the Arch Wiki. For testing I installed the nixpkgs.hello. It was installed successfully but didn't work. The error: hello: /nix/store/whypqfa83z4bsn43n4byvmw80n4mg3r8-glibc-2.37-45/lib/libc.so.6: version GLIBC_2.38' not found (required by /usr/lib/libstdc++.so.6)".
I also tried to install pgadmin4, as it was the reason I installed the Nix. It was also installed successfully but didn't run. The error: "/nix/store/0rwyq0j954a7143p0wzd4rhycny8i967-bash-5.2-p15/bin/bash: /nix/store/whypqfa83z4bsn43n4byvmw80n4mg3r8-glibc-2.37-45/lib/libc.so.6: version `GLIBC_2.38' not found (required by /usr/lib/libstdc++.so.6)"
I also reported this issue on Arch Linux Forum as well, and it seems the problem is related to Nix, as Nix (in stable channel) uses glibc version 2.37-45, but the Arch uses 2.38-7.
Nix being dependent on the libstdc++ might be the root of the issue.
Steps To Reproduce
Install nix package from pacman.
Enable the nix-daemon.service and add the user to the nix-users.
Reboot.
Add the channel nixpkgs-unstable or nixos-23.05 (the problem is present in both versions) and update with nix-.channel --update
Nix being dependent on the libstdc++ might be the root of the issue.
True, it should depend on a libstdc++ inside /nix/store. This is definitely a build issue, but the question is whether it originates from the makefiles in the nix repo or the build instructions in the Arch package repository.
Could you try uninstalling nix with pacman and installing it again with the determinate installer? It allows you to uninstall very easily again, so if you do want to run the version packaged by Arch, you can still do that later.
Could you try uninstalling nix with pacman and installing it again with the determinate installer? It allows you to uninstall very easily again, so if you do want to run the version packaged by Arch, you can still do that later.
I tried both the official Nix installer and the one from Determinate Systems before trying to install the programs I mentioned, and both of them crashed during the installation. I am don't know the reason why they crashed but I didn't bother, as the one that Arch shipped was installed successfully. And I now I don't want to uninstall Nix, as it may delete or corrupt my pgadmin4 configurations. But I may try them again in a VM and comeback with the results.
this issue is not only important on Arch — it also affects old environments on NixOS (e.g if you develop on older haskell versions in direnv, and have your system on unstable)
Reacted by Jakob Schöttl, Ben Brown and Malo Leroy
Hey, I appreciate everyone chiming in, but we should try to keep this relevant and "noise-free". Maybe we should close or lock this issue, and actually open one in Nixpkgs instead.
First off, yes, there has been some work and exploration happening related to this issue, e.g. #248547 and the PRs referenced therein.
The way (glibc's) dynamic loader handles DT_RUNPATH today (compared to DT_RPATH) presents a relatively deep issue to how Nixpkgs chooses to link shared libraries. This is only an issue when using Nixpkgs programs on other (FHS) distributions, and only when they abuse something like LD_LIBRARY_PATH.
Before posting any new reports in this issue, please test which libc and libstdc++ the Nix binary ends up loading: try running LD_DEBUG=libs nix --version (similarly, if reporting to Nixpkgs, LD_DEBUG=libs hello) and gist the logs. Do verify the logs mention loading libc.so* from a FHS location like /usr/lib. The logs will also mention why the loader chose to look up the library in /usr/lib. If the logs say that /usr/lib was in the LD_LIBRARY_PATH, you've encountered the exact same issue and reporting it will add noise:
FWIW, I tried running LD_DEBUG=libs LD_LIBRARY_PATH=/usr/lib nix --version on my NixOS system with nix deployed from Nixpkgs, and it the logs showed an empty LD_LIBRARY_PATH, indicating that nix probably unsets the variable. So I do not expect this specific issue to be encountered in Nix itself, only in other Nixpkgs-built software like hello:
Do report if you get similar errors when using the nix binary and
you've confirmed that your FHS environment doesn't force, in any obvious way, the dynamic loader to use the wrong libc instead of the one Nix directly links to through the RUNPATH;
or you get linkage-related errors with the nixStatic (because it shouldn't involve any dynamic linkage).
@cab404 this shouldn't be an issue if you're not mixing different channels in your dev environment and not mixing the "system" and the dev environment's packages. The issue should only present itself when you try to load a library linked against a newer libc in a process that has already loaded the old libc. This might hypothetically happen with e.g. the impure userspace drivers deployed in /run/opengl-driver/lib in which case you do have to use work-arounds like nixGL. If you're observing this error under different circumstances, please file an issue in Nixpkgs (I'd appreciate a ping too).
@Ashvith10 none of this should ever be required. You would help the community if you had managed to figure out why does the loader "incorrectly" choose the libstdc++ deployed by Guix. It shouldn't.
I don't see what's loading libgioenvironment and why it's a path in /run, but at least we see that /run/current-system is how we reach /gnu
EDIT:
My guess is that we don't see any look-up process for libgioenvironmentproxy because it must've been loaded by absolute path rather than by name. This very likely happens because of some of the global configuration deployed by Guix. I'm not familiar with GIO but I imagine it's something mildly cursed, maybe akin to nsswitch.
You're observing an error because none of the nix-built programs loaded before libgio... depend on libstdc++ so they do not load it. The GIO "plugins" deployed by Guix do, and their libstdc++ is loaded first. The nix-built libwebkitgtk-6.0.so.4 loaded later needs a newer libstdc++ but its space is already occupied
EDIT:
I wish I knew how to read trace from LD_DEBUG=libs setzer
That's quite ok, that's why I suggested reaching out in the chat
@Brogolem35 so in your case, it isn't even able to detect system's shared object, let alone Nix, I presume? But then, since you're on Arch, your system's and Nix's shared object must have a small version gap? What you're doing is still not a fix - it's merely a workaround, just like my suggestion above, and most of the apps on older channels won't work, which can be quite a hindrance for anyone using it for production.
I used set it in .zshrc with export LD_PRELOAD=/usr/lib/libstdc++.so.6.
Ok, so it wasn't a Nixpkgs issue, and it wasn't an Archlinux issue either. Thanks for expounding this! The resolution is that LD_PRELOAD used this way isn't supported, because it overrides the linker's normal behaviour and force-loads the wrong libstdc++. Btw it probably would've worked if you preloaded libc too (bc in the original description you had the nixpkgs' older libc with archlinux's newer libstdc++)
I think we can close this now.
so in your case, it isn't even able to detect system's shared object, let alone Nix, I presume? But then, since you're on Arch, your system's and Nix's shared object must have a small version gap?
The gaps don't matter, what matters is that one must load libstdc++ at least as new as the one used at build/link time
What you're doing is still not a fix - it's merely a workaround
I'd say there's nothing to work around. LD_PRELOAD force-loads the wrong libstdc++ without a compatible libc, so it explicitly breaks the program deployed by nix.
@SomeoneSerge so my issue is different from @Brogolem35 's? At least from my perspective, it looks like I should open a new issue, as it is still not resolved.
@Ashvith10 yes, your issue is different; it's not clear to me yet if there's anything to "fix" about it, but do consider opening an issue under the Nixpkgs repo regarding impure GIO libraries and libstdc++ mismatches
changed the title [-]Nix Package Manager on Arch Linux: "`GLIBC_2.38' not found" Error[/-][+]hello: "`GLIBC_2.38' not found" when using LD_PRELOAD with the host system's libstdc++ (higher than nixpkgs')[/+]on Feb 13, 2024
@Brogolem35 I updated the title to reflect how I understood the problem from your later comments. As mentioned above, I think this is a "wontfix" case. Thank you for reporting this, however, because this will help map the space of edge-cases and navigate people who encounter related errors
With that in mind, I'm closing the issue. Feel free to reopen if you think I misunderstood anything
Activity
abathur commentedon Oct 22, 2023
Sounds similar to:
Brogolem35 commentedon Oct 23, 2023
Unsetting the
LF_PRELOADseems to do the trick, but it feels not like a solution but a work-around.iFreilicht commentedon Oct 24, 2023
True, it should depend on a libstdc++ inside /nix/store. This is definitely a build issue, but the question is whether it originates from the makefiles in the nix repo or the build instructions in the Arch package repository.
Could you try uninstalling nix with pacman and installing it again with the determinate installer? It allows you to uninstall very easily again, so if you do want to run the version packaged by Arch, you can still do that later.
Brogolem35 commentedon Oct 24, 2023
I tried both the official Nix installer and the one from Determinate Systems before trying to install the programs I mentioned, and both of them crashed during the installation. I am don't know the reason why they crashed but I didn't bother, as the one that Arch shipped was installed successfully. And I now I don't want to uninstall Nix, as it may delete or corrupt my pgadmin4 configurations. But I may try them again in a VM and comeback with the results.
nixos-discourse commentedon Nov 6, 2023
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/nixpkgs-nixos-unstable-many-package-fail-with-glibc-2-38-not-found/35078/2
SomeoneSerge commentedon Nov 6, 2023
Maybe we start un-setting the
LD_*variables in the installer scripts 🤔 (as an opt-out behaviour)abathur commentedon Nov 6, 2023
Wouldn't that just shift the failures to post-install? (after the installer has told the user they have a working install)
SomeoneSerge commentedon Nov 6, 2023
Right, the nixpkgs software would still be broken. Then we need
DT_RPATHback, again?nixos-discourse commentedon Nov 27, 2023
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/new-install-nix-wants-glibc-2-38-debian-12-has-2-36/36109/3
nixos-discourse commentedon Dec 20, 2023
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/on-nixpkgs-and-the-ai-follow-up-to-2023-nix-developer-dialogues/37087/2
cab404 commentedon Jan 14, 2024
this issue is not only important on Arch — it also affects old environments on NixOS (e.g if you develop on older haskell versions in direnv, and have your system on unstable)
SomeoneSerge commentedon Jan 19, 2024
Hey, I appreciate everyone chiming in, but we should try to keep this relevant and "noise-free". Maybe we should close or lock this issue, and actually open one in Nixpkgs instead.
First off, yes, there has been some work and exploration happening related to this issue, e.g. #248547 and the PRs referenced therein.
The way (glibc's) dynamic loader handles
DT_RUNPATHtoday (compared toDT_RPATH) presents a relatively deep issue to how Nixpkgs chooses to link shared libraries. This is only an issue when using Nixpkgs programs on other (FHS) distributions, and only when they abuse something likeLD_LIBRARY_PATH.This repo is concerned specifically with the development of Nix. Nixpkgs-specific issues (e.g. dynamic loading errors in
hello, as opposed to thenixbinary) should be reported in https://github.com/NixOS/nixpkgs/issues/.Before posting any new reports in this issue, please test which libc and libstdc++ the Nix binary ends up loading: try running
LD_DEBUG=libs nix --version(similarly, if reporting to Nixpkgs,LD_DEBUG=libs hello) and gist the logs. Do verify the logs mention loadinglibc.so*from a FHS location like/usr/lib. The logs will also mention why the loader chose to look up the library in/usr/lib. If the logs say that/usr/libwas in theLD_LIBRARY_PATH, you've encountered the exact same issue and reporting it will add noise:FWIW, I tried running
LD_DEBUG=libs LD_LIBRARY_PATH=/usr/lib nix --versionon my NixOS system with nix deployed from Nixpkgs, and it the logs showed an emptyLD_LIBRARY_PATH, indicating thatnixprobably unsets the variable. So I do not expect this specific issue to be encountered in Nix itself, only in other Nixpkgs-built software likehello:Do report if you get similar errors when using the
nixbinary andnixStatic(because it shouldn't involve any dynamic linkage).@cab404 this shouldn't be an issue if you're not mixing different channels in your dev environment and not mixing the "system" and the dev environment's packages. The issue should only present itself when you try to load a library linked against a newer libc in a process that has already loaded the old libc. This might hypothetically happen with e.g. the impure userspace drivers deployed in
/run/opengl-driver/libin which case you do have to use work-arounds like nixGL. If you're observing this error under different circumstances, please file an issue in Nixpkgs (I'd appreciate a ping too).If one needs help diagnosing, they should please reach out in the Nix/NixOS support room on matrix, or at https://discourse.nixos.org.
Thanks!
Ashvith10 commentedon Feb 9, 2024
Has this issue been resolved? Because I still have problem launching applications in Nix Flakes on a Guix System.
SomeoneSerge commentedon Feb 9, 2024
DT_RUNPATHhaving a lower priority thanLD_LIBRARY_PATHhas not been resolved yet.LD_PRELOADandLD_LIBRARY_PATH... isn't suggestive of a solution?In which way exactly do applications from nix flakes fail to launch for you on that Guix system?
SomeoneSerge commentedon Feb 9, 2024
@Brogolem35 could you elaborate, what were the contents of
LD_PRELOADand why/how was it set?Could you confirm that you had an
LD_PRELOADset which forced the newer (Archlinux's) libstdc++ to be loaded, but not the newer libc?5 remaining items
SomeoneSerge commentedon Feb 9, 2024
@Ashvith10 none of this should ever be required. You would help the community if you had managed to figure out why does the loader "incorrectly" choose the libstdc++ deployed by Guix. It shouldn't.
Ashvith10 commentedon Feb 10, 2024
@SomeoneSerge I wish I knew how to read trace from
LD_DEBUG=libs setzer. Here's the details from my console: dump.logAshvith10 commentedon Feb 10, 2024
I think the issues probably starts from here?
SomeoneSerge commentedon Feb 10, 2024
I don't see what's loading libgioenvironment and why it's a path in /run, but at least we see that /run/current-system is how we reach /gnu
EDIT:
My guess is that we don't see any look-up process for libgioenvironmentproxy because it must've been loaded by absolute path rather than by name. This very likely happens because of some of the global configuration deployed by Guix. I'm not familiar with GIO but I imagine it's something mildly cursed, maybe akin to nsswitch.
You're observing an error because none of the nix-built programs loaded before libgio... depend on libstdc++ so they do not load it. The GIO "plugins" deployed by Guix do, and their libstdc++ is loaded first. The nix-built
libwebkitgtk-6.0.so.4loaded later needs a newer libstdc++ but its space is already occupiedEDIT:
That's quite ok, that's why I suggested reaching out in the chat
Brogolem35 commentedon Feb 10, 2024
I used set it in .zshrc with
export LD_PRELOAD=/usr/lib/libstdc++.so.6.The reason why I set it was that for some reason the matplotlib that was shipped by conda required it to work.
Ashvith10 commentedon Feb 10, 2024
@Brogolem35 so in your case, it isn't even able to detect system's shared object, let alone Nix, I presume? But then, since you're on Arch, your system's and Nix's shared object must have a small version gap? What you're doing is still not a fix - it's merely a workaround, just like my suggestion above, and most of the apps on older channels won't work, which can be quite a hindrance for anyone using it for production.
SomeoneSerge commentedon Feb 10, 2024
Ok, so it wasn't a Nixpkgs issue, and it wasn't an Archlinux issue either. Thanks for expounding this! The resolution is that
LD_PRELOADused this way isn't supported, because it overrides the linker's normal behaviour and force-loads the wrong libstdc++. Btw it probably would've worked if you preloaded libc too (bc in the original description you had the nixpkgs' older libc with archlinux's newer libstdc++)I think we can close this now.
The gaps don't matter, what matters is that one must load libstdc++ at least as new as the one used at build/link time
I'd say there's nothing to work around.
LD_PRELOADforce-loads the wrong libstdc++ without a compatible libc, so it explicitly breaks the program deployed by nix.Ashvith10 commentedon Feb 10, 2024
@SomeoneSerge so my issue is different from @Brogolem35 's? At least from my perspective, it looks like I should open a new issue, as it is still not resolved.
SomeoneSerge commentedon Feb 10, 2024
@Ashvith10 yes, your issue is different; it's not clear to me yet if there's anything to "fix" about it, but do consider opening an issue under the Nixpkgs repo regarding impure GIO libraries and libstdc++ mismatches
Also consider notifying Guix maintainers
[-]Nix Package Manager on Arch Linux: "`GLIBC_2.38' not found" Error[/-][+]hello: "`GLIBC_2.38' not found" when using LD_PRELOAD with the host system's libstdc++ (higher than nixpkgs')[/+]SomeoneSerge commentedon Feb 13, 2024
@Brogolem35 I updated the title to reflect how I understood the problem from your later comments. As mentioned above, I think this is a "wontfix" case. Thank you for reporting this, however, because this will help map the space of edge-cases and navigate people who encounter related errors
With that in mind, I'm closing the issue. Feel free to reopen if you think I misunderstood anything
remove setting up LD_LIBRARY_PATH in CI setup
Pinned all pkgs