[Mageia-dev] linkingerror with gtk+ 2: missing X11 dep ?

Pascal Terjan pterjan at gmail.com
Mon Dec 24 13:42:45 CET 2012


On Mon, Dec 24, 2012 at 10:49 AM, Guillaume Rousse
<guillomovitch at gmail.com> wrote:
> g++  -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
> -fstack-protector --param=ssp-buffer-size=4 -fPIC -pthread -D_REENTRANT
> -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0
> -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0
> -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
> -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/directfb
> -I/usr/include/libpng15 -I/usr/include/libdrm -I/usr/include/harfbuzz
> -I/usr/include/gconf/2 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include
> -Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,-O1 -Wl,--build-id
> -Wl,--enable-new-dtags -o cryptkeeper encfs_wrapper.o ConfigDialog.o
> ImportStashWizard.o CreateStashWizard.o PasswordChangeDialog.o main.o
> gtkstatusicon.o gtktrayicon-x11.o PasswordEntryDialog.o lsof.o
> -Wl,--export-dynamic -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0
> -lgio-2.0 -lgmodule-2.0 -lrt -lpangoft2-1.0 -lpangocairo-1.0
> -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0
> -lgconf-2 -lglib-2.0
> /usr/bin/ld: gtktrayicon-x11.o: undefined reference to symbol
> 'XUngrabServer'
> /usr/bin/ld: note: 'XUngrabServer' is defined in DSO /lib64/libX11.so.6 so
> try adding it to the linker command line
> /lib64/libX11.so.6: could not read symbols: Invalid operation
>
> I fixed it in the package directly (cryptkeeper). However, shouldn't rather
> gtk+-2.0 directly refers -lX11 instead ?

No it shouldn't, when using gtk you are not supposed to use anything X
specific directly, else your app will not work with another backend
than X.
In this case it seems the app is using X directly (outside of its use
of Gtk) so it should link to X11 itself.

> [guillaume at beria cryptkeeper]$ pkg-config --libs gtk+-2.0
> -Wl,--export-dynamic -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0
> -lgio-2.0 -lgmodule-2.0 -lrt -lpangoft2-1.0 -lpangocairo-1.0
> -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0
> -lglib-2.0


More information about the Mageia-dev mailing list