Consider linking nixpkgs' libc and libstdc++
Opened this issue · 0 comments
Is your feature request related to a problem? Please describe.
As far as I can tell, "the way" to approach both libc and libstdc++ compatibility is to build against the oldest standard libraries available, but load the newest at runtime. The FHS programs built against the old libc and libstdc++ are going to work fine with the newer libraries from nixpkgs. If however, by accident, the FHS standard libraries get loaded first, programs from Nixpkgs are going to start failing with missing (versioned) symbols. This is relevant e.g. when using the cuda_compat
driver on NVidia Jetsons, because it impurely depends on host libraries that are apparently written in C++:
$ ldd .cache/nix-gl-host/5793af273d0c11962b96e631a0ecb699ab6df9663a424b6df70854cabe88c3ea/cuda/libcuda.so
linux-vdso.so.1 (0x0000ffff913b0000)
libstdc++.so => not found
libnvrm_host1x.so => /usr/lib/aarch64-linux-gnu/tegra/libnvrm_host1x.so (0x0000ffff8f7df000)
libnvrm_chip.so => /usr/lib/aarch64-linux-gnu/tegra/libnvrm_chip.so (0x0000ffff8f7cb000)
libnvsocsys.so => /usr/lib/aarch64-linux-gnu/tegra/libnvsocsys.so (0x0000ffff8f7b7000)
libnvsciipc.so => /usr/lib/aarch64-linux-gnu/tegra/libnvsciipc.so (0x0000ffff8f792000)
libnvos.so => /usr/lib/aarch64-linux-gnu/tegra/libnvos.so (0x0000ffff8f772000)
libnvrm_sync.so => /usr/lib/aarch64-linux-gnu/tegra/libnvrm_sync.so (0x0000ffff8f75b000)
libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffff8f5e8000)
libnvrm_gpu.so => /usr/lib/aarch64-linux-gnu/tegra/libnvrm_gpu.so (0x0000ffff8f57b000)
libnvrm_mem.so => /usr/lib/aarch64-linux-gnu/tegra/libnvrm_mem.so (0x0000ffff8f563000)
libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000ffff8f4b8000)
libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000ffff8f4a4000)
librt.so.1 => /lib/aarch64-linux-gnu/librt.so.1 (0x0000ffff8f48c000)
libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000ffff8f45b000)
/lib/ld-linux-aarch64.so.1 (0x0000ffff91380000)
libstdc++.so.6 => /lib/aarch64-linux-gnu/libstdc++.so.6 (0x0000ffff8f276000)
libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000ffff8f252000)
Describe the solution you'd like
Just remember glibc
and stdenv.cc.cc.lib
from the Nixpkgs revision nixglhost was built with.
This comes with the disadvantage that the users should, in principle, use github:numtide/nix-gl-host
with something like --override-input nixpkgs nixpkgs
to ensure they're not linking libc older than the current system's.
In practice, however, it is an edge case that cuda_compat
loads libstdc++ first
Describe alternatives you've considered
Additional context