GNOME Bugzilla – Bug 609184
Build failure: doesn't look for some required libs
Last modified: 2010-03-07 17:20:57 UTC
/bin/sh ../libtool --tag=CC --mode=link gcc -Os -pipe -export-dynamic -no-undefined -export-symbols-regex "^[[^_]].*" -L/sw/lib/fontconfig2/lib -L/sw/lib -o eog eog-main.o libeog.la -L/sw/lib/fontconfig2/lib -L/sw/lib -Wl,-framework,CoreServices -Wl,-framework,ApplicationServices -lgnome-desktop-2 -lstartup-notification-1 -lgconf-2 -lart_lgpl_2 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lz -lfontconfig -lgmodule-2.0 -lexif -lm -llcms -ldbus-glib-1 -ldbus-1 -lpthread -lgobject-2.0 -lglib-2.0 -lintl -ljpeg ../cut-n-paste/toolbar-editor/libtoolbareditor.la ../cut-n-paste/totem-screensaver/libtotemscrsaver.la ../jpegutils/libeog-jpegutils.la -lz libtool: link: gcc -Os -pipe -o eog eog-main.o -Wl,-framework -Wl,CoreServices -Wl,-framework -Wl,ApplicationServices -L/sw/lib/fontconfig2/lib -L/sw/lib ./.libs/libeog.a /sw/lib/libgnome-desktop-2.dylib /sw/lib/libstartup-notification-1.dylib /sw/lib/libgconf-2.dylib /sw/lib/libart_lgpl_2.dylib /sw/lib/libgtk-x11-2.0.dylib /sw/lib/libgdk-x11-2.0.dylib /sw/lib/libatk-1.0.dylib /sw/lib/libgio-2.0.dylib /sw/lib/pango-ft219/lib/libpangoft2-1.0.dylib /sw/lib/libgdk_pixbuf-2.0.dylib /sw/lib/pango-ft219/lib/libpangocairo-1.0.dylib /sw/lib/libcairo.dylib /sw/lib/pango-ft219/lib/libpango-1.0.dylib /sw/lib/freetype219/lib/libfreetype.dylib /sw/lib/fontconfig2/lib/libfontconfig.dylib /sw/lib/libgmodule-2.0.dylib /sw/lib/libexif.dylib -lm /sw/lib/liblcms.dylib /sw/lib/libdbus-glib-1.dylib /sw/lib/libdbus-1.dylib -lpthread /sw/lib/libgobject-2.0.dylib /sw/lib/libglib-2.0.dylib /sw/lib/libintl.dylib /sw/lib/libjpeg.dylib ../cut-n-paste/toolbar-editor/.libs/libtoolbareditor.a /sw/lib/libxml2.dylib ../cut-n-paste/totem-screensaver/.libs/libtotemscrsaver.a ../jpegutils/.libs/libeog-jpegutils.a -lz /usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: Undefined symbols: _g_thread_init _XFree _XGetWindowProperty _XGetScreenSaver _XLockDisplay _XSetScreenSaver _XUnlockDisplay collect2: ld returned 1 exit status make[3]: *** [eog] Error 1 This is from eog-2.26.3 but I see same code and build-file segments on git trunk.
Created attachment 153159 [details] [review] Include gthread in EOG pkg-config Several sources use g_thread_init directly, so easiest to include gthread as part of the EOG_{CFLAGS,LIBS} flag-set. This might not be needed on platforms other than OS X (linux allows indirect symbol resolution via directly-listed libs, darwin *only* looks in directly-listed libs). Also, my gtk was built with a ./configure flag that suppresses publishing some internal-use-only dependencies...best for eog not to rely on not-guaranteed-stable/public features of its dependencies.
In src/Makefile.am, eog_LDADD includes $X_LIBS, but that variable is never set anywhere. Perhaps (as in Comment #1) the flags are not required to be passed directly in many build situations? I think X11 is only used in some build configurations (maybe only if lcms is enabled?), so simply hard-coding -lX11 is probably overkill. And the standard autoconf macros (AC_PATH_X and AC_PATH_XTRA) seem to set the -I and -L but not -lX11. If someone can decipher the cases where an X11 function is used, would be easy to patch configure.ac and/or various Makefile.am appropriately.
Review of attachment 153159 [details] [review]: (In reply to comment #1) > Created an attachment (id=153159) [details] [review] > Include gthread in EOG pkg-config > Correct. This is actually mentioned in GLib docs. :) commit 6cebe233786101783ae3e649bc3241e9c490ef22 Author: Daniel Macks <> Date: Mon Feb 8 12:31:07 2010 +0100 Explicitly link to GThread Should fix linker errors related to GThread on systems that don't recursively resolve linked libraries like OS X. See bug #609184. I'll try to take a look on the X11 problem later today.
The $X_LIBS in the Makefile template appears to be a leftover from pre-2.20 days. Currently X11 is used for getting the display profile when lcms is enabled and to inhibit the screensaver as a fallback when running eog in fullscreen modes (when GDK is compiled for the X11 target; see cut-n-paste/totem-screensaver) and you're not using gnome-screensaver over DBus. I guess I could come up with possible configure check for this. libX11 seems to support pkg-config as well now. Does it on OS X as well?
The most recent releases of OS X does have x11.pc and friends. Older-but-in-use don't have all of them, but PKG_CHECK_MODULES provides standard way for user to force-feed results if detection of a certain lib set isn't/won't work for him. The alternative (according to gtk+/configure.in for example) is to AC_PATH_XTRA and then hardcode append a best-guess at the -l flags. gtk+ tries pkg-config, falls back to hardcoded guess if that fails.
*** Bug 609553 has been marked as a duplicate of this bug. ***
Created attachment 153637 [details] [review] Explicitly link to libX11 (with fallback) Please try this one. It's pretty selective where to become explicit with linking to X11 and also has a fallback for X11 releases without pkgconfig support.
Will be a week or so before I'm back to gnome hacking, will follow up as soon as I am on it
Review of attachment 153637 [details] [review]: Putting it into 2.29.91 as the pkg-config part seems to be straight forward enough for me (if I'm wrong there's 2.29.92). Please test the fallback for non-pkg-config X11's.
The alternative (no x11.pc) flag-detection/passing works for me (eog-2.28.2 + Comment #7 patch builds completely)
(In reply to comment #10) > The alternative (no x11.pc) flag-detection/passing works for me (eog-2.28.2 + > Comment #7 patch builds completely) Thanks for confirming. Resolving this then.