The Allegro Wiki is migrating to github at https://github.com/liballeg/allegro_wiki/wiki

Difference between revisions of "Unix Issues"

From Allegro Wiki
Jump to: navigation, search
m (UnixIssues moved to Unix Issues: {{redirect from twiki name}})
m (cat)
Line 27: Line 27:
  
 
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( liballeg.so instead of /usr/local/lib/liballeg.so ), usually, you have to specify which directories to look in for shared libraries.
 
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( liballeg.so instead of /usr/local/lib/liballeg.so ), usually, you have to specify which directories to look in for shared libraries.
 +
 +
[[Category:Allegro documentation]]

Revision as of 14:19, January 25, 2008

Q. When I run my program in Linux/BSD/Whatever Unix I get this error Error while loading shared libraries: liballeg.so.4.2: 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/ld.so.conf
## Add /usr/local/lib here, or wherever liballeg.so 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( liballeg.so instead of /usr/local/lib/liballeg.so ), usually, you have to specify which directories to look in for shared libraries.