Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider linking nixpkgs' libc and libstdc++ #9

Open
SomeoneSerge opened this issue Dec 19, 2023 · 0 comments
Open

Consider linking nixpkgs' libc and libstdc++ #9

SomeoneSerge opened this issue Dec 19, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@SomeoneSerge
Copy link

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

@SomeoneSerge SomeoneSerge added the enhancement New feature or request label Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant