The Allegro Wiki is migrating to github at

Difference between revisions of "Unix Issues"

From Allegro Wiki
Jump to: navigation, search
m (UnixIssues moved to Unix Issues: {{redirect from twiki name}})
(No difference)

Revision as of 14:18, January 25, 2008

Q. When I run my program in Linux/BSD/Whatever Unix I get this error Error while loading shared libraries: cannot open shared object file: No such file or directory

A. Short answer: the os can't find the Allegro library. You have two options

Option 1. Add the path to the allegro library to a system wide place permanently.

$ sudo vi /etc/
## Add /usr/local/lib here, or wherever is
$ sudo /sbin/ldconfig

If you don't know where Allegro is installed you can try to find it with

$ allegro-config --libs
-L/usr/local/lib -L/usr/lib64 -Wl,--export-dynamic -lalleg-4.2.3 -lalleg_unsharable

That first part, -L/usr/local/lib, is where Allegro is installed to.

Option 2. Set the path for loading dynamic libraries in your .bashrc

$ vi ~/.bashrc
## add this line
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

Long answer: Executables on *NIX OS's load the code into memory as well as any shared libraries that executable is linked with. Since the executable only lists the shared library by name and not path( instead of /usr/local/lib/ ), usually, you have to specify which directories to look in for shared libraries.