Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » allegro-config bug in 4.2.2?

This thread is locked; no one can reply to it. rss feed Print
allegro-config bug in 4.2.2?
Danger
Member #9,538
February 2008

I'm working on a project using allegro and g++ in linux. I have version 4.2.0 installed in Ubuntu, which is where I do most of my work; I also have version 4.2.2 installed in Gentoo on my laptop.

Recently I tried to compile my project on my laptop. I was receiving a linker error that was reporting undefined references. I'm linking using `allegro --libs` which returns -lalleg as one of the options, on Ubuntu it returns -lalleg-4.2.0 so I tried -lalleg-4.2.2 which worked correctly.

I've done a bit of poking around on the web, and havn't found anyone mentioning this ... so, possible bug in allegro-config? or did gentoo emerge not setup the libraries correctly?

And as an added note, I do have '/usr/local/lib' as an entry in /etc/ld.so.conf.

Danger

kazzmir
Member #1,786
December 2001
avatar

What undefined references do you get?

Danger
Member #9,538
February 2008

Here's a snipet of a few of the errors I was getting from the following command.

g++ -o run_bluestar `allegro-config --libs release` main.o game.o ticks.o Ship.o Vector2.o init.o imageloader.o map.o mathw.o Entity.o

main.cc:(.text+0xc3): undefined reference to `font'
main.cc:(.text+0xda): undefined reference to `textout_ex'
main.cc:(.text+0x15f): undefined reference to `vsync'
main.cc:(.text+0x164): undefined reference to `gfx_driver'
main.cc:(.text+0x19e): undefined reference to `screen'
main.cc:(.text+0x1b9): undefined reference to `blit'
main.cc:(.text+0x200): undefined reference to `key'
main.cc:(.text+0x400): undefined reference to `remove_mouse'
main.cc:(.text+0x40e): undefined reference to `destroy_bitmap'
main.cc:(.text+0x416): undefined reference to `allegro_exit'

`allegro-config --libs release` and `allegro-config --libs` both output the following.

-L/usr/lib -lalleg -lm -lXxf86vm -lXcursor -lXpm -lXext -lX11 -lpthread -ldl

and if I append -4.2.2 I get this

-L/usr/lib -lalleg-4.2.2 -lm -lXxf86vm -lXcursor -lXpm -lXext -lX11 -lpthread -ldl

which works correctly.

EDIT:

I decided to go into the library (/usr/lib) to see what was there for allegro. I found

liballeg-4.2.2.so
liballeg.a
liballeg.so.4.2 --> liballeg-4.2.2.so
liballeg_unsharable.a

Where liballeg.so.4.2 is a symlink to liballeg-4.2.2.so. so I added the following symlink,

liballeg.so --> liballeg-4.2.2.so

which now lets me use -lalleg because it is symlinked to -lalleg-4.2.2. Now I can continue to use the same Makefile for my project on my laptop and desktop, so I'm happy.

Though was this Gentoo's emerge that forgot the symlink, or was this allegro installing / allegro-config ?

Danger

Julian Guarin
Member #5,787
April 2005
avatar

mmmm

if you are trying to link with the shared lib, perhaps you should use ´allegro-config --shared´ instead of allegro-config --libs release

maybe...

regards

against what are you, hard to know it is,
but which side are you, yet harder.

"You've been neglecting my chickens again, Gwydion. Feed them, and quickly!."

kazzmir
Member #1,786
December 2001
avatar

Quote:

Though was this Gentoo's emerge that forgot the symlink,

Probably, I've had to do equivalent things for opengl libraries.

Quote:

if you are trying to link with the shared lib, perhaps you should use ´allegro-config --shared´ instead of allegro-config --libs release

They are equivalent.

Go to: