Author Topic: Shared libraries directories  (Read 4602 times)

mareq

  • Guest
Shared libraries directories
« on: December 29, 2006, 12:28:28 pm »
Ubuntu (6.10)

I have read some posts regarding this problem, but nothing helped.

I have workspace with multiple projects: shared libraries and executable(s).
I have also other third-party shared libraries in a specific folder of my workspace.


Example of built and third-party libs locations:

/home/user/cbtest/lib1proj/Debug/lib1.so
/home/user/cbtest/lib2proj/Debug/lib2.so - these are libraries generated by CB

/home/user/cbtest/libs/libthirdparty1.so
/home/user/cbtest/libs/libthirdparty2.so - these are third party libraries

/home/user/cbtest/executableproj/Debug/executable - this is the executable file generated by CB


There was no problem with building these files using CB. I only had to set the libraries and library directories in CB:
executableproj -> Project build options -> Tab Linker -> Link libraries would be
  1
  2
  thirdparty1
  thirdparty2
executableproj -> Project build options -> Tab Directories -> Tab Linker would be
  ./../lib1proj/Debug
  ./../lib2proj/Debug
  ./../libs

But I am not able to launch this project, neither Debug, nor Run.
I set up the Environment variables in CB -> Settings -> Environment -> Environment variables:
  LD_LIBRARY_PATH=/home/user/cbtest/lib1proj/Debug/:/home/user/cbtest/lib2proj/Debug/:/home/user/cbtest/libs/
but it didn't help.

When I run the executable from CB, the xterm writes that it is not able to locate the shared library.
When I start debugging, there is no console output and the debugger ends with messages:
Program exited with code 0177.
Debugger finished with status 0
In case of debugging I am not able to see what is wrong.

Please help me, to solve it.
1. How to specify the libraries directories for xterm when running from CB. (IMPORTANT)
2. How to change xterm to other terminal.
3. How to specify the libraries directories for debugger when debugging from CB. (IMPORTANT)
4. How to see the console output of my application (it is a GTK2+ GUI application, but I print trace messages to console). (IMPORTANT)

Suggestions:
1. Automatically add the libraries for executable linker options - looking for projects, the executable depends on.
2. Automatically set the library paths when debugging or running the project.
(3. Possibility to set target specific library paths of third-party libs when debugging or running.)
« Last Edit: December 29, 2006, 02:03:45 pm by mareq »

Offline Game_Ender

  • Lives here!
  • ****
  • Posts: 551
Re: Shared libraries directories
« Reply #1 on: December 29, 2006, 07:49:19 pm »
Allowing you to set per target environment variables is something that CB does not support and 'Environment Variables' plugin is a poor solution because it only sets them for CB as a whole.  Berlios is down right now but when its up this should probably be posted as an enhancement request.  This has been talked about before but it never got implemented.  Ideally it would be another tab in the Build Options dialog or be a change of the current list Variables to a list that allows you to select which variables should be set in the environment.

For GBD you can see here on how to set the environment variables.  Once you figure out what commands you need you will have to set them CB wide as debugger startup commands or send them one, by one through that maddening (because it has no history, and is a poor substitute for a GDB shell) send command to debugger functionality.

Also make sure you are using a nightly build.

mareq

  • Guest
Re: Shared libraries directories
« Reply #2 on: December 30, 2006, 01:53:36 pm »
Until this feature is implemented,
I solved this problem by adding the libraries directories paths to ld.so.conf.