Author Topic: cannot open shared object file: No such file or directory  (Read 6771 times)

Offline kelo81

  • Multiple posting newcomer
  • *
  • Posts: 86
cannot open shared object file: No such file or directory
« on: April 24, 2007, 04:22:04 am »
Hello everybody. I'm working on a shared lib with codeblocks. I've created a workspace storing two projects, the first one is named casandra, and it's a shared lib (libCasandra.so). And the other project is a console application which uses the shared lib. So, both resulting files (the binary and the shared lib) are under the same directory, I told Codeblocks to put them under the same path, and use it as a working directory for the binary file.
The problem: If I execute the binary file, it runs perfectly, as expected. But if i try to execute the binary file from a terminal, I get a message saying that the file doesn't exist   :( even if the file is under the same directory... I can note this is not like Windows  :( . Here are the results:

Code
bash-3.1# ls
Test libCasandra.so
bash-3.1# ./Test
./Test: error while loading shared libraries: libCasandra.so: cannot open shared object file: No such file or directory
bash-3.1#

I'm not sure about what to do... any ideas?  :(
Ezequiel Ruiz
Tango/04 consultant
www.tango04.com

Offline kelo81

  • Multiple posting newcomer
  • *
  • Posts: 86
Re: cannot open shared object file: No such file or directory
« Reply #1 on: April 24, 2007, 01:20:18 pm »
I mean, If I run the binary project from Codeblocks it works OK, but if I try to execute the file from a terminal with ./ then it doesn't work.
Ezequiel Ruiz
Tango/04 consultant
www.tango04.com

wxLearner

  • Guest
Re: cannot open shared object file: No such file or directory
« Reply #2 on: April 24, 2007, 01:49:55 pm »
The environment variable LD_LIBRARY_PATH can be used.
Code: shell
$ export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2784
Re: cannot open shared object file: No such file or directory
« Reply #3 on: April 24, 2007, 01:52:32 pm »
Google for ldconfig and "linux shared lib search"

wxLearner

  • Guest
Re: cannot open shared object file: No such file or directory
« Reply #4 on: April 24, 2007, 02:03:10 pm »
IMHO here is a good explanation of shared objects.

Offline kelo81

  • Multiple posting newcomer
  • *
  • Posts: 86
Re: cannot open shared object file: No such file or directory
« Reply #5 on: April 24, 2007, 09:06:44 pm »
OK, I thought it was possible to do it like in Windows, bu putting the executable under the same directory than the shared. So I'll set the environment variable into the shell before running the binary  :D

Thanks!!
Ezequiel Ruiz
Tango/04 consultant
www.tango04.com