|
Linux newbie - symbol lookup error? |
Craig Harrison
Member #5,255
November 2004
|
Well, I just installed Linux (Fedora Core 6) for the first time and am learning how it all works (so remember... talk dumb). Anyway, I have installed allegro, can compile stuff and everything, but when I go to run any program it gives me this error. This is with the exhello example, but it does it with everything. [root@localhost examples]# ./exhello ./exhello: symbol lookup error: ./exhello: undefined symbol: _install_allegro_version_check Being a Linux newbie, I have no idea what to do. Any help would be appreciated! |
kazzmir
Member #1,786
December 2001
|
Well first of all Id say dont compile and run things as root. Only use root to install things and then only use 'sudo', not 'su'. I vaguelly recall seeing that error before but can't quite remember what it was about. I think you are running with a different version of allegro than you compiled with. Did you install Allegro yourself? If you run these two commands what do you see? $ ls /usr/lib/liballeg* and $ ls /usr/local/lib/liballeg*
|
Peter Wang
Member #23
April 2000
|
You will get this error if you have a program compiled with 4.2.1, run against a 4.2.0 library. Probably you have 4.2.0 installed on your system. Run "ldd exhello" to see which library exhello is picking up.
|
Craig Harrison
Member #5,255
November 2004
|
Ah, ok, I had two versions installed. I did one with yum and one manually. I uninstalled the yum 4.2.0 one and now just have 4.2.1 installed. Now when I go to run exhello (NOT as root ): ./exhello: error while loading shared libraries: liballeg.so.4.2: cannot open shared object file: No such file or directory here is this: [Craig@localhost ~]$ ls /usr/lib/liballeg* ls: /usr/lib/liballeg*: No such file or directory [Craig@localhost ~]$ ls /usr/local/lib/liballeg* /usr/local/lib/liballeg-4.2.1.so /usr/local/lib/liballeg_unsharable.a /usr/local/lib/liballeg.so.4.2 it looks to me like the file is there... is it looking in the wrong place? |
kazzmir
Member #1,786
December 2001
|
In your .bashrc add a line like this $ vi ~/.bashrc export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib Replace vi with your favorite editor, like nano or pico. Someone is going to come along and say you can edit /etc/ld.so.conf but I think this is less noob friendly. After adding that line to your bashrc restart the terminal program and run exhello. What this does is add /usr/local/lib to the list of directories linux looks in when it goes to run a program. Since allegro is a shared library it is loaded at runtime. LD_LIBRARY_PATH is one way to tell the run-time system where things are located. |
Craig Harrison
Member #5,255
November 2004
|
It works! Thanks a bunch! Is there any way to do it so that other people I give the programs to don't have to do this? Something like in Windows giving them the dll with the program? |
Milan Mimica
Member #3,877
September 2003
|
Yes. Compile statically.
-- |
Craig Harrison
Member #5,255
November 2004
|
Ok, well, I must be doing something wrong here. This works fine: But when I try to staticlly link them: it says: I tried finding -lalleg and pasting it into /usr/bin/ld, but I couldn't find it anywhere. I'm sure it's something simple, but I'm not sure what to do. |
Thomas Fjellstrom
Member #476
June 2000
|
Yeah, you'll have to rebuild allegro with the static libs enabled. By default only the dynamic lib is built. -- |
Craig Harrison
Member #5,255
November 2004
|
call make uninstall or make clean or something first, or can I just install static libaries and leave the dynamic ones from before? Then su -c 'make install <something?>' Could someone spell it out for me, please? |
Thomas Fjellstrom
Member #476
June 2000
|
The unix build docs spell it out for you -- |
Craig Harrison
Member #5,255
November 2004
|
Ok got it. Thanks! That should be the last of my questions (for a little while). |
|