Error Loading Shared Libraries

Hi guys, first post!

New to C++, Linux (Ubuntu 10.04) and CodeBlocks and wasn't sure whether to put this into the beginner section or here.

Am trying to compile a simple program that uses some acml math library, located in

I also have the respective header file:

Now I create a new empty project on CodeBlocks and Add the Linker file (.so) along with setting the include directories to add the header file. Compilation runs fine in both debug and Release mode, but when I try run the application, I get the error:
./AcmlNIckTry: error while loading shared libraries: cannot open shared object file: No such file or directory

I have tried to find solutions for this problem and what i understand till now is that the program is trying to call the .so file but cant find it. This led me to try learn what a .so file really it turns out to be equivalent to .dll (which I don't know much about either). There is also a ".a" file in the same folder as the ".so" one but using that as a linker file in codeblocks results in errors.

And finally i ran "ldd <myprogram>" and get the following output
8 =>  (0xb781a000) => not found => /usr/lib/ (0xb7709000) => /lib/tls/i686/cmov/ (0xb76e2000) => /lib/ (0xb76c3000) => /lib/tls/i686/cmov/ (0xb7569000) => /lib/tls/i686/cmov/ (0xb7550000)
	/lib/ (0xb781b000)

As I said I am a beginner, so if I haven't provided enough detail here about my problem, please let me know what else I can provide. Thanks in advance

Problem Fixed! I copied to directory /usr/local/lib/ and ran program

Questions: Seems kind of tedious to manually copy the .so file. Is there any way I can tell to program to look at the original directory : "/opt/acml4.4.0/gfortran32_mp/lib/" instead??
Or is this a setting that I can change in Code::Blocks??

Also been looking into LD_LIBRARY_PATH, which I am guessing are the directories for an application to look at for libraries.
To test it out I tried
export LD_LIBRARY_PATH="/opt/acml4.4.0/gfortran32_mp/lib/"
and I still get "not found" for my library when running ldd. Am I doing something wrong?
Is there a way to see all the directories that are already in LD_LIBRARY_PATH ??

According to the one of the Ubuntu posts (,
LD_LIBRARY_PATH can no longer be set unless you are in an interactive shell (don't know what that is)
So a work around is: Folder "/etc/" holds .conf files that contain links to paths of different libraries. Here you can add your own .conf file to support your code.
e.g. from the terminal type in:
echo "<path to libraries>" | sudo tee /etc/<make your name>.conf

So for my acml libraries:
echo "/opt/acml4.4.0/gfortran32_mp/lib" | sudo tee /etc/

and then run sudo ldconfig -v which updates this list

Learning so much :)
Last edited on
closed account (S6k9GNh0)
Why is the library in such a strange place?
Basically, if you want to use LD_LIBRARY_PATH to find the .so in the directory where it was, you should add it somewhere like your .bashrc file:

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/acml4.4.0/gfortran32_mp/lib

(To see what is in LD_LIBRARY_PATH at any given time, just do:

Modifications to environment variables only take effect in the shell in which the modification is made and any subshell created by that shell.
interactive shell (don't know what that is)

It's something that often looks like this:

It's the command line.
Topic archived. No new replies allowed.