User forums > Using Code::Blocks
problem with non-standar-location shared libraries
neich:
Hi,
I have a project that uses some non-standard shared libraries. These are not in /etc/ld.so.conf and I don't want them to be (they are also in development, but outside C::B). When linking I use pkg-config to find them. And then, when I try to run the program from within C::B, then I get a "error while loading shared libraries".
So I understand that C::B assumes that all the shared libraries used during the linking process can be found using /etc/ld.so.conf, right ? If this is true, is there any way to modify LD_LIBRARY_PATH in a per-target execution basis ?
Thanks
Nacho
gzahl:
Hi,
Im have a similar problem. The LD_LIBRARY_PATH variable isnt used. if i run my program from konsole it works fine. but under xterm and c::b i get a shared object not found error. How can set the LD_LIBRARY_PATH Varible? I saw some Threads about similar problem, but nothing helped up to now.
Thank you
Cheers
Manu
Game_Ender:
CB doesn't assume anything, it just doesn't launch executables with its own environment so any customizing of the LD_LIBRARY_PATH you did will no longer be in effect. There is an Environment Variable plugin which should fix this.
MortenMacFly:
--- Quote from: Game_Ender on November 18, 2006, 11:57:14 pm ---There is an Environment Variable plugin which should fix this.
--- End quote ---
Yes, but this doesn't work per-target. I question myself why do you (neich and gzahl) depend on LD_LIBRARY_PATH? In the end you can easily setup the compiler/linker path's yourself (per-target)...?! There should be no need to depend on that - especially if you think cross-platform.
With regards, Morten.
neich:
--- Quote from: MortenMacFly on November 19, 2006, 09:38:14 am ---Yes, but this doesn't work per-target. I question myself why do you (neich and gzahl) depend on LD_LIBRARY_PATH? In the end you can easily setup the compiler/linker path's yourself (per-target)...?! There should be no need to depend on that - especially if you think cross-platform.
With regards, Morten.
--- End quote ---
Maybe I am missing something here, but if you set up the library paths in the linker (-L option), these paths are ignored during execution, and only the ones in /etc/ld.so.conf and $LD_LIBRARY_PATH are used. So you have to take care yourself to include the paths on -L into LD_LIBRARY_PATH. And I think that it would be fairly easy that c::b automatically do this. It is just a matter of collectiong all the -L paths (per target) and insertthem into LD_LIBRARY_PATH during execution. Or at least set up an option to do this.
In my case, I am using some external libraries that have a debug and a release version, so when I execute the debug application inside c::b I want to load the debug version of the library, and when I execute the release version inside c::b I want to load the release version. I can get this setup in the linking stage, but not in the execution step, so I have to execute the application outside c::b, which is a pain. I have solved the problem using static libraries, but then linking takes a lot of time ...
Nacho
Navigation
[0] Message Index
[#] Next page
Go to full version