GNOME Bugzilla – Bug 668244
Explicitly depend on cairo
Last modified: 2012-01-20 07:05:10 UTC
We have this path on openSUSE to fix the build: we apparently need to explicitly depend on cairo.
Created attachment 205604 [details] [review] Look for cairo.pc Patch by Atri Bhattacharya <badshah400@gmail.com>
Wy isn't gtk+-3.0 pulling that in? Isn't it just only the cflags typo that causes the problem?
This is what we get without the patch: CCLD cossa-standalone-previewer /usr/lib/gcc/i586-suse-linux/4.6/../../../../i586-suse-linux/bin/ld: /usr/lib/gcc/i586-suse-linux/4.6/../../../libgtk-3.so: undefined reference to symbol 'cairo_clip' /usr/lib/gcc/i586-suse-linux/4.6/../../../../i586-suse-linux/bin/ld: note: 'cairo_clip' is defined in DSO /usr/lib/gcc/i586-suse-linux/4.6/../../../libcairo.so so try adding it to the linker command line /usr/lib/gcc/i586-suse-linux/4.6/../../../libcairo.so: could not read symbols: Invalid operation collect2: ld returned 1 exit status make[3]: *** [cossa-standalone-previewer] Error 1 That's most likely because we use --as-needed. In all cases: if you use an API from a library, really, you have to put the pkg-config check for that library. It's bad to rely on other libraries to bring it in.
Ok, you can call that bad, I can agree to that. It still seems there is also another bug though, because the gtk+ pc file should depend on the cairo pc file. Or maybe something has changed in pkg-config?
It's not a bug with gtk+-3.0.pc missing the cairo dep. If you want the verbose log: libtool: link: gcc -fomit-frame-pointer -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -o cossa-standalone-previewer cossa-application.o cossa-main.o -Wl,--export-dynamic -pthread -lgtksourceview-3.0 -lpeas-gtk-1.0 -lgtk-3 -lpeas-1.0 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lgirepository-1.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lffi -lglib-2.0 ./.libs/libcossa-common.a -pthread /usr/lib/gcc/i586-suse-linux/4.6/../../../../i586-suse-linux/bin/ld: /usr/lib/gcc/i586-suse-linux/4.6/../../../libgtk-3.so: undefined reference to symbol 'cairo_clip' /usr/lib/gcc/i586-suse-linux/4.6/../../../../i586-suse-linux/bin/ld: note: 'cairo_clip' is defined in DSO /usr/lib/gcc/i586-suse-linux/4.6/../../../libcairo.so so try adding it to the linker command line /usr/lib/gcc/i586-suse-linux/4.6/../../../libcairo.so: could not read symbols: Invalid operation You can see the -lcairo coming from gtk+-3.0.pc. Gentoo has some nice doc on --as-needed: http://www.gentoo.org/proj/en/qa/asneeded.xml
I think it's because the gtk .pc file moved its deps in a "private" section that was introduced in newer pkg-config. Anyway, I agree that we should list all libs we are using. The patch looks ok, but please fix the configure.ac indentation before committing (it is using tabs, while the surrounding lines are not).
(In reply to comment #6) > The patch looks ok, but please fix the configure.ac indentation before > committing (it is using tabs, while the surrounding lines are not). Good catch, done.