Libgdiplus Linker Errors for Libglib

I was building libgdiplus (in order to build Mono) on Ubuntu 13.04 and hit the following error during the make step:

1
2
3
4
5
6
7
8
Making all in tests
make[2]: Entering directory `/home/neil/monobuild/libgdiplus/tests'
/bin/bash ../libtool --tag=CC   --mode=link gcc  -g -O2 -pthread   -o testgdi testgdi.o ../src/libgdiplus.la -lpthread -lfontconfig
libtool: link: gcc -g -O2 -pthread -o .libs/testgdi testgdi.o  ../src/.libs/libgdiplus.so -lpthread -lfontconfig -pthread
/usr/bin/ld: testgdi.o: undefined reference to symbol 'g_print'
/usr/bin/ld: note: 'g_print' is defined in DSO /lib/x86_64-linux-gnu/libglib-2.0.so.0 so try adding it to the linker command line
/lib/x86_64-linux-gnu/libglib-2.0.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status

This is on the 2.10.8 tag of libgdiplus from github.

Based on this little snippet related to libgdiplus on Slackware, I was able to fix the error (and a subsequent one for X11) by amending tests/Makefile:

tests/Makefile
1
LIBS = -lpthread -lfontconfig -lglib-2.0 -lX11

That allows the build to complete.

Comments