GNOME Bugzilla – Bug 684787
gtk+-2.24.13 fails to build due to underlinking; libgtk-x11-2.0 need to link to gmodule
Last modified: 2013-02-10 14:19:19 UTC
When using GNU gold as the linker, the gtk tests in gtk+-2.24.13 fail to build: /bin/sh ../../libtool --tag=CC --mode=link x86_64-pc-linux-gnu-gcc -DGDK_PIXBUF_DISABLE_DEPRECATED -march=native -O2 -pipe -ggdb -Wall -Wl,--as-needed -Wl,-O1 -o testing testing.o ../../gdk/libgdk-x11-2.0.la ../../gtk/libgtk-x11-2.0.la -lpangocairo-1.0 -lX11 -lXcomposite -lXdamage -lXfixes -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0 -lm libtool: link: x86_64-pc-linux-gnu-gcc -DGDK_PIXBUF_DISABLE_DEPRECATED -march=native -O2 -pipe -ggdb -Wall -Wl,-O1 -o .libs/testing testing.o -Wl,--as-needed ../../gdk/.libs/libgdk-x11-2.0.so -L/usr/lib64 -L/lib64 ../../gtk/.libs/libgtk-x11-2.0.so /var/tmp/portage/x11-libs/gtk+-2.24.13/work/gtk+-2.24.13/gdk/.libs/libgdk-x11-2.0.so -lXext -lXrender -lXinerama -lXi -lXrandr -lXcursor -lpangocairo-1.0 -lXcomposite /usr/lib64/libXdamage.so -lX11 -lxcb -lXau -lXdmcp -ldl -lXfixes -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0 -lm ../../gtk/.libs/libgtk-x11-2.0.so: error: undefined reference to 'g_module_symbol' ../../gtk/.libs/libgtk-x11-2.0.so: error: undefined reference to 'g_module_open' ../../gtk/.libs/libgtk-x11-2.0.so: error: undefined reference to 'g_module_supported' ../../gtk/.libs/libgtk-x11-2.0.so: error: undefined reference to 'g_module_close' ../../gtk/.libs/libgtk-x11-2.0.so: error: undefined reference to 'g_module_error' ../../gtk/.libs/libgtk-x11-2.0.so: error: undefined reference to 'g_module_build_path' collect2: error: ld returned 1 exit status This is happening because libgtk-x11-2.0 uses gmodule functions in many places, but does not explicitly link to it. To fix the problem, GMODULE_LIBS should be added libadd in gtk+-2.24.x's gtk/Makefile.am, like was already done in gtk+-3.4/3.6.
Created attachment 225138 [details] [review] proposed patch
Alexandre's fix works for me, and allows me to build GTK+ 2 in jhbuild. For reference, the (similar) GTK+ 3 fix was in bug 665326. This patch would also allow Fedora to drop a downstream patch in the GTK+ 2 package: http://pkgs.fedoraproject.org/cgit/gtk2.git/tree/gtk2-fixdso.patch
*** This bug has been marked as a duplicate of bug 692810 ***