Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Missing -lpng when building "ex_audio_chain" - STATIC BUILD

This thread is locked; no one can reply to it. rss feed Print
Missing -lpng when building "ex_audio_chain" - STATIC BUILD
pkrcel
Member #14,001
February 2012

Hi there a.cc....writing this short since I have a little problem when compiling Allegro example ex_audio_chain (as in the thread title).

I'm compiling the allegro library as static monolith with MinGW-w64 gcc, 64 bit flavor.

I get 30 link errors when linking ex_audio_chain.exe regarding freetype.o referring to libpng (I think...I'm using QtCreator and CMAKE, oc);

like this:

C:\MSYS-toolchain\msys2\mingw64\lib\libfreetype.a(sfnt.o):-1: error: undefined 
reference to `png_read_info'

The verbose makefile option shows:

C:\MSYS-toolchain\msys2\mingw64\bin\g++.exe   -msse -W -Wall -Wpointer-arith -g 
-DDEBUGMODE=1 -DD3D_DEBUG_INFO    -mwindows -Wl,--whole-archive 
CMakeFiles\ex_audio_chain.dir/objects.a -Wl,--no-whole-archive  -o 
ex_audio_chain.exe -Wl,--out-implib,libex_audio_chain.dll.a -Wl,--major-image-version,0,
--minor-image-version,0  ..\lib\liballegro_monolith-debug-static.a 
-lkernel32 -luser32 -lgdi32 -lcomdlg32 -lole32 -lwinmm -lpsapi -lshlwapi C:\Windows
\System32\dinput8.dll -lstdc++ -lglu32 -lopengl32 -Wl,-Bstatic -lgdiplus 
-Wl,-Bdynamic -luuid C:\Windows\System32\dsound.dll -lOpenAL32 -Wl,-Bstatic -lFLAC 
-logg -Wl,-Bdynamic -lwsock32 -Wl,-Bstatic -ldumb -lvorbisfile -lvorbis -lfreetype 
-lz -lphysfs -Wl,-Bdynamic -ltheoradec -Wl,-Bstatic -logg -Wl,-Bdynamic -lwsock32 
-Wl,-Bstatic -ldumb -lvorbisfile -lvorbis -lfreetype -lz -lphysfs -Wl,-Bdynamic 
-ltheoradec -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 
-luuid -lcomdlg32 -ladvapi3

Question: No -lpng option is being passed to the linker, I guess it's okay since my build provides png I/O trough GDIplus?

Also Question: I did not build freetype, I'm using the package that MSYS2 provides....does this mean that I should build static freetype myself? is there a way to pass the IMAGE lib dependencies anyway? (I DO have libpng installed)

EDIT: fixed monospaced text, typos.

EDIT after fiddling

Seems rebuilding freetype myself has cleared things up, now it links flawlessly.

Edit3

Being fiddfling around a bit. The MSYS2 freetype2 packages has these dependencies:

$ pkg-config --libs freetype2
-L/mingw64/lib -lfreetype -lbz2 -lpng16 -lz -lharfbuzz

Due to the fact that is has been build with PNG/BZIP2/HARFBUZZ (?) support and thus requires those.

A better implementation of FindFreetype.cmake could help there (correctly populating ....too bad it has no maintainer on CMAKE :P ...seriously thou, Freetype #include tricks are sick!

Edit4

I came up with a pkg-config based FindFreetype.cmake script which is attached for posterity. This finds correctly the deps and populates FREETYPE_LIBRARIES so that when needed to link against allegro_ttf the aforementioned libs are in there. (this could also remove the need for that ZLIB trick in the ttf addon Cmakelists.txt file...haven't checked thou).

Here's the file

It is unlikely that Google shares your distaste for capitalism. - Derezo
If one had the eternity of time, one would do things later. - Johan Halmén

Go to: