-
Notifications
You must be signed in to change notification settings - Fork 93
Open
Description
LD_LIBRARY_PATH
breaks users' executable in the following ways:
- Executables not part of devshell might pick up libraries from LD_LIBRARY_PATH, this can lead to incompatible libraries being loaded and crash executables. This is very likely to happen on NixOS with different release channels or on Non-NixOS distributions
- Executables compiled in devshell won't run if the environment is unset or users tries to start them outside of devshell
Instead a minimal cc/ld wrapper could set an rpath and interpreter:
#!/usr/bin/env bash
exec /nix/store/xxxxx-gcc-unwrapped/bin/gcc -Wl,-rpath=$DEVSHELL_ROOT/lib" -Wl,-dynamic-linker=$NIX_DYNAMIC_LINKER "$@"
#!/usr/bin/env bash
exec /nix/store/xxxxx-binutils-unwrapped/bin/ld -rpath "$DEVSHELL_ROOT/lib" -dynamic-linker "$NIX_DYNAMIC_LINKER" "$@"
Dynamic linker can be obtained from the wrapped version at build time: $(cat $NIX_CC/nix-support/dynamic-linker)
Congee, xanderio, kai-tub and jnv
Metadata
Metadata
Assignees
Labels
No labels