4 ms·
LD_PRELOAD is too global to be useful, it's hard to scope it to one process (and not child processes). macOS is better in the sense that it clears DYLD_* variab
by stabbles 3y ago
LD_PRELOAD is too global to be useful, it's hard to scope it to one process (and not child processes). macOS is better in the sense that it clears DYLD_* variables when the dynamic linker has done its work and the process starts. (Although that can also be painful when you want to run a shell script and set DYLD_* outside)
- nly 3y agoYou can compile binaries with additional relative library paths in to them that will take priority over /usr/lib64
- josephg 3y agoHow? Maybe this should be better documented & recommended. I suppose at some point you're just statically linking with more steps - though for a problem like this it might be worth it.
- xioxox 3y agoSee the ELF rpath, which can be set by the linker. This can be modified after using patchelf.
- rkeene2 3y ago$ORIGIN has been pretty well-known and documented for a very long time
- yrro 3y agohttps://sourceware.org/binutils/docs-2.40/ld/Options.html#index-runtime-library-search-path https://sourceware.org/binutils/docs-2.40/ld/Options.html#in...
- ywei3410 3y agoThe other comments have already covered the how, but I'd like to add that the mechanism used extensively in Nix [1]. [1] https://nixos.org/ https://nixos.org/
- ungamedplayer 3y agoYou can set it in the environment for a single process.