Build problems with Allegro 4.4.1.1
Edgar Reynaldo

Building Allegro 4.4.1.1 on a VirtualBox VM running openSUSE 11.3 on a Vista host. All addon library dependencies (zlib, libpng, libogg, libvorbis) were compiled and installed sucessfully.

I started with :

cmake -DWANT_ALLEGROGL=on -DWANT_LOADPNG=on -DWANT_LOGG=on -DWANT_JPGALLEG=on -DCMAKE_BUILD_TYPE=Profile -DSHARED=on -G "Unix Makefiles" ..

and ran make. Allegro itself built fine, but loadpng failed to build because of :

[ 36%] Building C object addons/loadpng/CMakeFiles/loadpng.dir/loadpng.c.o
/home/edgar/Build/allegro-4.4.1.1/addons/loadpng/loadpng.c:22:30: error: ‘Z_BEST_COMPRESSION’ undeclared here (not in a function)
make[2]: *** [addons/loadpng/CMakeFiles/loadpng.dir/loadpng.c.o] Error 1
make[1]: *** [addons/loadpng/CMakeFiles/loadpng.dir/all] Error 2
make: *** [all] Error 2

This is because loadpng.c includes png.h, but not zlib.h.

Continuiing on, the example program ex12bit failed to build because of :

[ 62%] Building C object examples/CMakeFiles/ex12bit.dir/ex12bit.c.o
Linking C executable ex12bit
../lib/liballeg-profile.so.4.4.1: undefined reference to `_colorconv_rgb_scale_5x35'
../lib/liballeg-profile.so.4.4.1: undefined reference to `dlsym'
../lib/liballeg-profile.so.4.4.1: undefined reference to `_colorconv_rgb_map'
../lib/liballeg-profile.so.4.4.1: undefined reference to `_colorconv_indexed_palette'
../lib/liballeg-profile.so.4.4.1: undefined reference to `dlopen'
../lib/liballeg-profile.so.4.4.1: undefined reference to `dlclose'
collect2: ld returned 1 exit status
make[2]: *** [examples/ex12bit] Error 1
make[1]: *** [examples/CMakeFiles/ex12bit.dir/all] Error 2
make: *** [all] Error 2

Edit -
This is because during linking, it does not link to allegro and ltdl.
Taking a closer look at the error messages, from the undefined references to dlsym, dlopen, and dlclose, it appears when you link to allegro, you need to link to ltdl as well. I found this is because allegro/src/unix/umodules.c uses those symbols. Building from the latest SVN version (14595) gets rid of the undefined references to dlopen, dlclose, and dlsym though.

The undefined references to _colorconv* must be because either colconv.c or ccolconv.c was not linked during construction of the Allegro library. From looking at the build output, ccolconv.c is built though, so I don't know what is wrong.

[ 28%] Building C object CMakeFiles/allegro.dir/src/misc/ccolconv.c.o

so I don't know what the problem is.

So the current errors are :

[ 62%] Building C object examples/CMakeFiles/ex12bit.dir/ex12bit.c.o
Linking C executable ex12bit
../lib/liballeg-profile.so.4.4.2: undefined reference to `_colorconv_rgb_scale_5x35'
../lib/liballeg-profile.so.4.4.2: undefined reference to `_colorconv_rgb_map'
../lib/liballeg-profile.so.4.4.2: undefined reference to `_colorconv_indexed_palette'
collect2: ld returned 1 exit status
make[2]: *** [examples/ex12bit] Error 1
make[1]: *** [examples/CMakeFiles/ex12bit.dir/all] Error 2
make: *** [all] Error 2

The fix for loadpng is easy, but I still don't know what cmake files to edit (and how) to fix the ex12bit linking error.

Anyone know what I should do?
I submitted this to the allegro development mailing list [AD] in case I get more responses there.

Append -
Okay, I think everything is sorted out now.
1) Add '#include <zlib.h>' to loadpng.c
2) Change allegro/cmake/FileList.cmake so that

  • ALLEGRO_SRC_C_FILES has an entry 'src/misc/colconv.c'

  • All other references to 'src/misc/colconv.c' are removed.

3) Both 1) and 2) should be fixed in SVN Allegro 4.4 soon.
4) On openSUSE, to make Allegro support X11, you need the xorg-x11-devel package.
5) On openSUSE, to have AllegroGL support, you need the Mesa-devel package.

Thread #606591. Printed from Allegro.cc