GNOME Bugzilla – Bug 701113
3.9.1 fails to build the tests
Last modified: 2013-05-28 13:31:40 UTC
While building gtksourceview 3.9.1, the following build error happens: make[2]: Entering directory `/home/abuild/rpmbuild/BUILD/gtksourceview-3.9.1/tests' CCLD test-completion-words ../gtksourceview/completion-providers/words/.libs/libgtksourcecompletionwords.a(libgtksourcecompletionwords_la-gtksourcecompletionwordsproposal.o): In function `gtk_source_completion_words_proposal_get_type': /home/abuild/rpmbuild/BUILD/gtksourceview-3.9.1/gtksourceview/completion-providers/words/gtksourcecompletionwordsproposal.c:42: undefined reference to `gtk_source_completion_proposal_get_type' collect2: error: ld returned 1 exit status make[2]: *** [test-completion-words] Error 1 (tested on open Build Service)
I can't reproduce this error, it links fine on my machine. And I don't see what could be wrong. Can you please build gtksourceview in verbose mode? The RPM maybe use other LDFLAGS.
A quick check shows that it drips over -Wl,--as-needed, which is the default in various distros by now (openSUSE as well). A bit more context of the build log (even though it does not show --as-needed): [ 75s] /bin/sh ../libtool --tag=CC --mode=link gcc -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -o test-undo-manager test-undo-manager.o ../gtksourceview/libgtksourceview-3.0.la -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lxml2 [ 75s] libtool: link: gcc -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -o .libs/test-completion-words test-completion-words.o -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 /usr/lib64/libxml2.so ../gtksourceview/.libs/libgtksourceview-3.0.so ../gtksourceview/completion-providers/words/.libs/libgtksourcecompletionwords.a -Wl,-rpath -Wl,/usr/lib64 [ 75s] libtool: link: gcc -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -o test-region test-region.o ../gtksourceview/.libs/libgtksourceview-private.a -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 /usr/lib64/libxml2.so -Wl,-rpath -Wl,/usr/lib64 -Wl,-rpath -Wl,/usr/lib64 [ 75s] libtool: link: gcc -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -o .libs/test-undo-manager test-undo-manager.o ../gtksourceview/.libs/libgtksourceview-3.0.so -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 /usr/lib64/libxml2.so -Wl,-rpath -Wl,/usr/lib64 [ 75s] ../gtksourceview/completion-providers/words/.libs/libgtksourcecompletionwords.a(libgtksourcecompletionwords_la-gtksourcecompletionwordsproposal.o): In function `gtk_source_completion_words_proposal_get_type': [ 75s] /home/abuild/rpmbuild/BUILD/gtksourceview-3.9.1/gtksourceview/completion-providers/words/gtksourcecompletionwordsproposal.c:42: undefined reference to `gtk_source_completion_proposal_get_type' [ 75s] collect2: error: ld returned 1 exit status [ 75s] make[2]: *** [test-completion-words] Error 1 [ 75s] make[2]: Leaving directory `/home/abuild/rpmbuild/BUILD/gtksourceview-3.9.1/tests' [ 75s] make[1]: *** [all-recursive] Error 1 [ 75s] make[1]: Leaving directory `/home/abuild/rpmbuild/BUILD/gtksourceview-3.9.1' [ 75s] make: *** [all] Error 2 [ 75s] error: Bad exit status from /var/tmp/rpm-tmp.XKrL0D (%build) [ 75s] [ 75s] [ 75s] RPM build errors: [ 75s] Bad exit status from /var/tmp/rpm-tmp.XKrL0D (%build)
Just an observation... the error lists gtk_source_completion_words_proposal_get_type and gtk_source_completion_proposal_get_type so probably some linking between two .la files missing?
Indeed, with the -Wl,--as-needed added to the LDFLAGS, I'm able to reproduce the bug. I've normally fixed it: https://git.gnome.org/browse/gtksourceview/commit/?id=8bde9d1e0b3efc703b986d7e970599964cae9b0d
Confirmed.. I added this patch to my package, re-bootstrapped (gnome-autogen.sh) and the build succeeds now. Thank you very much for the very quick fix! => closing