4

I'm trying to force a build internal pre-processor used for built-sources to not rely on shared libraries installed in my host machine without having to uninstall them.

Although there is a LD_PRELOAD environment variable which forces the loader (ld-linux) to fetch the specified shared libraries before anything else, I'd like to do quite the opposite, forcing the loader not to fetch the specified libraries during the setup process (kind of LD_NEVERLOAD variable).

Is there some way to do so without breaking my entire system (aka, removing such libraries)?

PS: I've renamed my system libraries to test this specific use case, but this is definitely not an elegant way of doing so.

milton
  • 988
  • 6
  • 19
  • It seems that using `-z nodeflib` in the LDFLAGS makes the loader to skip `/usr/lib` and `/lib` directories, however, this does not work in a per-file basis, making the user to copy all relevant libraries to a separate place to get anything working. – milton Nov 14 '16 at 17:25

1 Answers1

2

Reading the manual pages ld(1) and ld.so(8) you might try playing with LD_LIBRARY_PATH, LD_RUNPATH and options in both manuals which are related to "rpath".

Shahbaz
  • 46,337
  • 19
  • 116
  • 182
A.H.
  • 63,967
  • 15
  • 92
  • 126
  • @Shahbaz, nice, I didn't know there so much options to ld.so. With those options one can say where to look for alternative libraries, however none of them can instruct the loader **not** to fetch a specific library located in the default search path (`/usr/lib` in my case) – milton Nov 07 '12 at 14:10