error while loading shared libraries: Not found

General questions regarding the usage of CodeLite
burton247
CodeLite Curious
Posts: 2
Joined: Sun Jan 22, 2012 2:04 am
Genuine User: Yes
IDE Question: c++
Contact:

error while loading shared libraries: Not found

Post by burton247 » Sun Jan 22, 2012 2:30 am

Hi,

This is my first post here. I have happily been using codelite without issue for a while now but there is something I just cannot figure out. I have finally got around to playing with shared objects :) I plan to have a simple vector maths library as a shared object so I can dynamically link to it from other projects.

I created a class with no real purpose yet and compiled + linked to a shared object. I have then exported the directory this is in and link to it when compiling my main class (which has a reference to the class in the shared object). This actually all works perfectly when I compile, link and run from the terminal.

So I began moving this process over to codelite. Everything compiles and links without error but I have an issue where it will not run I believe it's similar to the below post:

viewtopic.php?f=11&t=1528&start=0&st=0& ... +libraries

As with that post if I run the program from the terminal it all works fine, no issues, but trying to debug in codelite it does nothing and if I try to run it from codelite I get:
error while loading shared libraries: libmaths.so: cannot open shared object file:No such file of directory

Running the same executable from the terminal works fine though. It is definitely the same file as if I delete it and go back to codelite then it says the executable does not exist. I have loading codelite from inside the terminal but I still get the same issue.

Any ideas of what to try next would be great.

Thanks

User avatar
eranif
CodeLite Plugin
Posts: 6110
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: error while loading shared libraries: Not found

Post by eranif » Sun Jan 22, 2012 12:46 pm

You need to update your LD_LIBRARY_PATH to include the path of your library.
In the "project settings => Common Settings => Environment => Additional environment variables" add line similar to:

Code: Select all

LD_LIBRARY_PATH=/path/to/myshared/library:$(LD_LIBRARY_PATH)
Note that codelite expanded variables surrounded with parenthesis:
$(VARIABLE_NAME) => expanded to the content of VARIABLE_NAME
while:
$VARIABLE_NAME => expand to empty string...

Eran
Make sure you have read the HOW TO POST thread

burton247
CodeLite Curious
Posts: 2
Joined: Sun Jan 22, 2012 2:04 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: error while loading shared libraries: Not found

Post by burton247 » Sun Jan 22, 2012 5:04 pm

That did the trick :)
I had LD_LIBRARY_PATH="PATH" added but was missing the :$LD_LIBRARY_PATH) on the end.

Thanks a lot

Post Reply