Reputation: 7788
I am working on a project with several modules. The development tree looks like:
/work_home/src/...
/work_home/out/bin/ <Here all the executables are built to>
/work_home/out/foo1/lib/ <one .so is built here>
/work_home/out/foo2/lib/ <another .so is built here>
...
/work_home/out/foo42/lib/ <another .so is built here>
Now, the following question only applies to when i am running an executable which uses the shared libraries in my development environment - as opposed to when we actually deploy our package on our customer's system.
What would be the best way to ensure that when i run an executable (from /work_home/out/bin/) it can load any shared library it needs (which is built to /work_home/out/.../lib/)?
Upvotes: 0
Views: 198
Reputation: 47602
Use LD_LIBRARY_PATH
;
export LD_LIBRARY_PATH=/work_home/out/foo1/lib:/work_home/out/foo2/lib:$LD_LIBRARY_PATH
./your_executable
This will also look into /work_home/out/foo1/lib
and /work_home/out/foo2/lib
directories while resolving libraries.
Upvotes: 1