GNOME Bugzilla – Bug 559638
Compile failure: missing link against libX11
Last modified: 2010-07-22 22:56:50 UTC
Building zenity-2.24.0 on OS X 10.4 with gtk+-2.14.4 (built for x11 GUI): gcc -I/sw/lib/fontconfig2/include -I/sw/include/glib-2.0 -I/sw/lib/glib-2.0/include -I/sw/lib/freetype219/include/freetype2 -I/sw/lib/freetype219/include -I/sw/lib/pango-ft219/include/pango-1.0 -I/sw/include/libpng12 -I/sw/include -I/sw/include/pixman-1 -I/sw/include/cairo -I/sw/include/gtk-2.0 -I/sw/include/atk-1.0 -I/sw/lib/gtk-2.0/include -I/sw/include/libart-2.0 -I/sw/include/gail-1.0 -I/sw/include/libgnomecanvas-2.0 -I/sw/include/libxml2 -I/sw/include/libglade-2.0 -I/usr/X11R6/include -I/usr/X11/include -Wall -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-sign-compare -Os -L/sw/lib -o zenity zenity-about.o zenity-calendar.o zenity-entry.o zenity-fileselection.o zenity-main.o zenity-msg.o zenity-notification.o zenity-option.o zenity-progress.o zenity-scale.o zenity-text.o zenity-tree.o zenity-util.o -L/sw/lib/fontconfig2/lib -L/sw/lib -L/sw/lib/freetype219/lib -L/sw/lib/pango-ft219/lib -Wl,-framework,CoreServices -Wl,-framework,ApplicationServices -lglade-2.0 -lxml2 -lgnomecanvas-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 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl /usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: Undefined symbols: _XFree _XGetWMName _XGetWindowAttributes _XQueryTree collect2: ld returned 1 exit status make[2]: *** [zenity] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 Yup, zenity is using X11 symbols directly but not linking against libX11. It probably used to work because gtk published -lX11 via pkg-config. But it didn't need to (programs that use gtk don't need to link against libX11 themselves) and recently stopped publishing this flag. So zenity's ./configure needs to determine and use the appropriate X11 flags itself.
Looks like svn revision 424 from long ago fixed this bug, but then the fix got removed: X_LIBS is still passed in src/Makefile.am but that variable isn't set in configure.in. That fix was only half-way though...also need -I flag (again it only "works" as a side effect of gtk leaking some of its internal details). Is there a functional problem with passing multiple -lX11 flags to the linker? Just check for whether gdk is using the x11 GUI, and if so do some standard configure check for X11 flags...
Created attachment 125965 [details] [review] check for X when GDK backend is X11 This check for X (and add appropriate CFLAGS/LIBS) when the GDK backend is X11. (adapted from a check in evolution configure.in).
*** Bug 574437 has been marked as a duplicate of this bug. ***
Pushed to master, thanks!
Tweak needed: now that X_{CFLAGS,LIBS} are appended to ZENITY_{CFLAGS,LIBS}, the explicit X_LIBS is redundant in the following src/Makefile.am recipe: > zenity_LDADD = \ > $(ZENITY_LIBS) \ > $(LIBNOTIFY_LIBS) \ > $(X_LIBS) since ZENITY_LIBS is already there.
Pushed to master! Thanks!