Shared Libraries

If you have your own shared libraries with the whole set of your favorite functions, probably you will have seen this common error:

./myapp: error while loading shared libraries: cannot open shared object file: No such file or direct

Let’s take a look inside the binary:

tuxedo@host:$> ldd test =>  (0xb7ef6000) => not found => /lib/i686/cmov/ (0xb7d81000)

By default the system is looking for in the paths defined in the /etc/, which recursively adds the definitions in the folder /etc/ Here’s the quick trick:

tuxedo@host:$> export LD_LIBRARY_PATH=`pwd` 

I use this whereas I’m implementing my library, after that you can put it wherever you feel like.

tuxedo@host:$> ldd test =>  (0xb7f5e000) => /home/tuxedo/syslib/ (0xb7f56000) => /lib/i686/cmov/ (0xb7de3000)
    /lib/ (0xb7f5f000)

Now the executable will work. I’ll retake this issue, I have some interesting things to tell about shared libraries. Happy coding!!