Bug 43416

Summary: Cannot compile spice-gtk
Product: Spice Reporter: Olav Vitters <bugzilla-freedesktop>
Component: spice-gtkAssignee: Spice Bug List <spice-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: buildlog
patch from another packager
Better way of fixing this
Fix build issue
build: fix linking with -Wl,--as-needed -Wl,--no-undefined etc..

Description Olav Vitters 2011-12-01 04:20:44 UTC
While trying to package spice-gtk version 0.7.81 I get a compilation error.

Error message:

libtool: link: gcc -shared -Wl,--as-needed  -fPIC -DPIC  .libs/spice-gtk-session.o .libs/spice-widget.o .libs/vncdisplaykeymap.o .libs/spice-grabsequence.o .libs/spice-widget-cairo.o .libs/spice-widget-enums.o   -O2 -Wl,--version-script=./map-file -Wl,--as-needed -Wl,--no-undefined -Wl,-z -Wl,relro -Wl,-O1 -Wl,--build-id -Wl,--enable-new-dtags -pthread   -pthread  -Wl,-rpath -Wl,/home/src/pkgs/spice-gtk/BUILD/spice-gtk-0.7.81-4f76/gtk/.libs ./.libs/libspice-client-glib-2.0.so -L/usr/lib64/ -L/lib64 -L/usr/local/lib -lcelt051 -lm -ljpeg -lz -lpixman-1 -lssl -lcrypto -lpulse-mainloop-glib -lpulse -lsasl2 -lcacard -lssl3 -lsmime3 -lnss3 -lsoftokn3 -lnssutil3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl -lgudev-1.0 -lusb-1.0 -lusbredirhost -lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lgmodule-2.0 -lrt -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0 -lcairo -Wl,-soname -Wl,libspice-client-gtk-3.0.so.1 -o .libs/libspice-client-gtk-3.0.so.1.0.2
.libs/spice-widget.o: In function `get_keyboard_lock_modifiers':
/home/src/pkgs/spice-gtk/BUILD/spice-gtk-0.7.81-4f76/gtk/spice-widget.c:1735: undefined reference to `XGetKeyboardControl'
.libs/vncdisplaykeymap.o: In function `vnc_display_keymap_gdk2xtkbd_table':
/home/src/pkgs/spice-gtk/BUILD/spice-gtk-0.7.81-4f76/gtk/vncdisplaykeymap.c:153: undefined reference to `XkbGetKeyboard'
/home/src/pkgs/spice-gtk/BUILD/spice-gtk-0.7.81-4f76/gtk/vncdisplaykeymap.c:162: undefined reference to `XkbFreeClientMap'
.libs/vncdisplaykeymap.o: In function `check_for_xquartz':
/home/src/pkgs/spice-gtk/BUILD/spice-gtk-0.7.81-4f76/gtk/vncdisplaykeymap.c:122: undefined reference to `XListExtensions'
/home/src/pkgs/spice-gtk/BUILD/spice-gtk-0.7.81-4f76/gtk/vncdisplaykeymap.c:130: undefined reference to `XFreeExtensionList'
collect2: ld returned 1 exit status


I'll attach the full build log in a few minutes (from the Mageia build bot).
Comment 2 Olav Vitters 2011-12-01 06:10:31 UTC
Created attachment 54012 [details] [review]
patch from another packager
Comment 3 Christophe Fergeau 2011-12-01 06:50:48 UTC
Created attachment 54014 [details] [review]
Better way of fixing this

This (untested) patch should fix the issue too. However it seems we don't have a way to get X flags on the link line if xrandr is disabled/not present, which would need fixing too
Comment 4 Marc-Andre Lureau 2011-12-01 11:09:45 UTC
Olav, can you check Christophe patch? thanks
Comment 5 Olav Vitters 2011-12-02 01:11:20 UTC
2nd patch fails with:


/bin/sh ../libtool  --tag=CC   --mode=link gcc -std=gnu99  -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -version-info 1:2:0 -no-undefined -Wl,--version-script=./map-file  -Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,-O1 -Wl,--build-id -Wl,--enable-new-dtags -o libspice-client-gtk-3.0.la -rpath /usr/lib64 spice-gtk-session.lo spice-widget.lo vncdisplaykeymap.lo spice-grabsequence.lo   spice-widget-cairo.lo  spice-widget-enums.lo  libspice-client-glib-2.0.la -pthread -lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lcairo -lgmodule-2.0 -lrt -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0   -lcairo·····
libtool: link: gcc -shared -Wl,--as-needed  -fPIC -DPIC  .libs/spice-gtk-session.o .libs/spice-widget.o .libs/vncdisplaykeymap.o .libs/spice-grabsequence.o .libs/spice-widget-cairo.o .libs/spice-widget-enums.o   -O2 -Wl,--version-script=./map-file -Wl,--as-needed -Wl,--no-undefined -Wl,-z -Wl,relro -Wl,-O1 -Wl,--build-id -Wl,--enable-new-dtags -pthread   -pthread  -Wl,-rpath -Wl,/home/src/pkgs/spice-gtk/BUILD/spice-gtk-0.7.81-4f76/gtk/.libs ./.libs/libspice-client-glib-2.0.so -L/usr/lib64/ -L/lib64 -L/usr/local/lib -lcelt051 -lm -ljpeg -lz -lpixman-1 -lssl -lcrypto -lpulse-mainloop-glib -lpulse -lsasl2 -lcacard -lssl3 -lsmime3 -lnss3 -lsoftokn3 -lnssutil3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl -lgudev-1.0 -lusb-1.0 -lusbredirhost -lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lgmodule-2.0 -lrt -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0 -lcairo -Wl,-soname -Wl,libspice-client-gtk-3.0.so.1 -o .libs/libspice-client-gtk-3.0.so.1.0.2
.libs/spice-widget.o: In function `get_keyboard_lock_modifiers':
/home/src/pkgs/spice-gtk/BUILD/spice-gtk-0.7.81-4f76/gtk/spice-widget.c:1735: undefined reference to `XGetKeyboardControl'
.libs/vncdisplaykeymap.o: In function `vnc_display_keymap_gdk2xtkbd_table':
/home/src/pkgs/spice-gtk/BUILD/spice-gtk-0.7.81-4f76/gtk/vncdisplaykeymap.c:153: undefined reference to `XkbGetKeyboard'
/home/src/pkgs/spice-gtk/BUILD/spice-gtk-0.7.81-4f76/gtk/vncdisplaykeymap.c:162: undefined reference to `XkbFreeClientMap'
.libs/vncdisplaykeymap.o: In function `check_for_xquartz':
/home/src/pkgs/spice-gtk/BUILD/spice-gtk-0.7.81-4f76/gtk/vncdisplaykeymap.c:122: undefined reference to `XListExtensions'
/home/src/pkgs/spice-gtk/BUILD/spice-gtk-0.7.81-4f76/gtk/vncdisplaykeymap.c:130: undefined reference to `XFreeExtensionList'
collect2: ld returned 1 exit status
make[2]: *** [libspice-client-gtk-3.0.la] Error 1
make[2]: *** Waiting for unfinished jobs....
Comment 6 Christophe Fergeau 2011-12-02 04:08:10 UTC
Created attachment 54068 [details] [review]
Fix build issue

This issue can be reproduced with make LDFLAGS="-Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,-O1 -Wl,--build-id -Wl,--enable-new-dtags"

I put the added XRANDR_LIBS in the wrong part of a conditional in the makefile :) I'd go with this patch actually, on win32 XRANDR_LIBS will be empty so this won't hurt, and this is already done with spicy anyway

I've tested that this patch works this time.
Comment 7 Marc-Andre Lureau 2011-12-02 04:47:47 UTC
Created attachment 54070 [details] [review]
build: fix linking with -Wl,--as-needed -Wl,--no-undefined etc..

Mageia is using linker flags and miss symbols when linking.
The error can be reproduced with:

make LDFLAGS="-Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,-O1 -Wl,--build-id -Wl,--enable-new-dtags"

Based on patch by Christophe Fergeau.
Comment 8 Marc-Andre Lureau 2011-12-02 07:51:53 UTC
commit ae0b95039949fc94523490dc62940d0626a240f7
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date:   Fri Dec 2 13:44:40 2011 +0100

    build: fix linking with -Wl,--as-needed -Wl,--no-undefined etc..

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.