Author Topic: dynamic linking problem  (Read 6895 times)

aklavez

  • Guest
dynamic linking problem
« on: February 12, 2006, 03:02:58 pm »
Hello!

First of all thanks to the developers for this great project, and then to my hopefully easy question:

I am trying to build an application with the coin3d libraries (www.coin3d.org), but I keep getting "error while loading shared libraries: libSoQt.so.20: cannot open shared object file: No such file or directory". The libraries are located in /usr/local/lib and normally when running gcc from the command line I can just export HD_LIBRARY_PATH, but this has no effect in codeblocks. Any ideas on how I can fix this?

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: dynamic linking problem
« Reply #1 on: February 12, 2006, 03:59:53 pm »
Does it still not work if you add /usr/local/lib to the linker's directories in build options?
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Game_Ender

  • Lives here!
  • ****
  • Posts: 551
Re: dynamic linking problem
« Reply #2 on: February 12, 2006, 07:25:50 pm »
Does it still not work if you add /usr/local/lib to the linker's directories in build options?

Thomas I believe he is trying to run the program and that he got it to compile fine.  This is an issue I have been talking about for weeks, and it is quite a flaw in the console runner.  Even if you start codeblocks from a terminal that has the proper environmental variables exported, the console runner still does not run your application with the proper environment.  You should be able to set environment variables you want exported per target and then the console runner/codeblocks will export them for you.  This is what Xcode does and think it would be the way to go.  This is a very needed feature in the unix environment.  You can get away without on the windows, but not on unix.

I think the best way to implement this is to be able chose which or your projects "Variables" would be exported to the environment.  It probably also be a good idea to export the variable to GDB when its run too.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: dynamic linking problem
« Reply #3 on: February 12, 2006, 07:55:44 pm »
But...
Quote
when running gcc from the command line I can just export HD_LIBRARY_PATH
To me, this sounds like compilation fails because some library is not found, not like a runtime issue.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

aklavez

  • Guest
Re: dynamic linking problem
« Reply #4 on: February 12, 2006, 09:14:04 pm »
I'll try to make myself clearer.

I have the paths '/usr/local/Trolltech/Qt-4.0.1/lib' and '/usr/local/lib' in the directories section for the linker. Loading the qt libraries actually works well. It is the dynamic coin3d libraries that are not found and loaded during run time. So yes, everything compiles fine and it is when running the app I get the error.

I also can't use environment variables like QTDIR to specify directories. I thought maybe the Settings->Environment would be the answer, but when I try this codeblocks crashes so I guess this is something that is not yet implemented.

aklavez

  • Guest
Re: dynamic linking problem
« Reply #5 on: February 12, 2006, 09:26:48 pm »
I see now that the reason why my qt libraries are loaded is that I have them in /usr/lib as well...  :? This is where the libraries are searched for by default and making links to coin libraries in /usr/lib will probably solve my problem. However, it would be nice to make codeblocks aware of my environment variables.

coiner

  • Guest
Re: dynamic linking problem
« Reply #6 on: June 04, 2009, 05:57:51 pm »
I had (!) the same problem: libSoQt.so.20  could not be loaded. Trigger 'ldconfig' to update the runtime linker cache!