Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Linux newbie - symbol lookup error?

This thread is locked; no one can reply to it. rss feed Print
Linux newbie - symbol lookup error?
Craig Harrison
Member #5,255
November 2004
avatar

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
avatar

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
avatar

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
avatar

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
avatar

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
avatar

Yes. Compile statically.

Craig Harrison
Member #5,255
November 2004
avatar

Ok, well, I must be doing something wrong here.

This works fine:
g++ -o tri_linux main.cpp `allegro-config --libs`

But when I try to staticlly link them:
g++ -o tri_linux main.cpp `allegro-config --static`

it says:
/usr/bin/ld: cannot find -lalleg
collect2: ld returned 1 exit status

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
avatar

Yeah, you'll have to rebuild allegro with the static libs enabled. By default only the dynamic lib is built.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Craig Harrison
Member #5,255
November 2004
avatar

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
avatar

The unix build docs spell it out for you :)

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Craig Harrison
Member #5,255
November 2004
avatar

Ok got it. Thanks! That should be the last of my questions (for a little while).

Go to: