0

When i run through the compile process of a project, quite often i need to use a custom library compiled and stored somewhere that is not in the path. At the start of the compile, I can specify the path to the include headers and the library directly, and the project compiles fine.

However, when i check later using ldd, very often ldd shows the library is not found. Usually i will use patchelf to change the runpath to point to the correct library directory and this resolves itself. Still why does this happen?

2
  • The environment variables you are changing with patchelf may also, or may not also, have been defined in either the, likely Makefile or also by environment variables defined in the shell. Check the output of, 'env' .. or variables defined in whatever constitutes the Makefile in this case. I'm smartphoning this in and am pretty rusty/reference material dependant or I'd grab some more specifics for it but roughly, that's it and may be a decent starting point for ya. – rhoyerboat Apr 19 at 19:27
  • No i don't think that's the case. With a g++ and an explicit -L, the linking process should work. It's just that i'd have expected it to link explicitly without depending on the configured paths in ld.so.conf.d. In any case there's also the -Wl,-rpath that should include the rpath in the sofile, so that will be the first paths to search for other libraries. – placid chat Apr 22 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.