After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 668244 - Explicitly depend on cairo
Explicitly depend on cairo
Status: RESOLVED FIXED
Product: gedit
Classification: Applications
Component: cossa
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Carlos Garnacho
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2012-01-19 06:43 UTC by Vincent Untz
Modified: 2012-01-20 07:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Look for cairo.pc (988 bytes, patch)
2012-01-19 06:44 UTC, Vincent Untz
committed Details | Review

Description Vincent Untz 2012-01-19 06:43:13 UTC
We have this path on openSUSE to fix the build: we apparently need to explicitly depend on cairo.
Comment 1 Vincent Untz 2012-01-19 06:44:41 UTC
Created attachment 205604 [details] [review]
Look for cairo.pc

Patch by Atri Bhattacharya <badshah400@gmail.com>
Comment 2 jessevdk@gmail.com 2012-01-19 07:00:02 UTC
Wy isn't gtk+-3.0 pulling that in? Isn't it just only the cflags typo that causes the problem?
Comment 3 Vincent Untz 2012-01-19 08:59:55 UTC
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.
Comment 4 jessevdk@gmail.com 2012-01-19 12:31:27 UTC
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?
Comment 5 Vincent Untz 2012-01-19 12:46:42 UTC
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
Comment 6 Paolo Borelli 2012-01-19 13:29:22 UTC
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).
Comment 7 Vincent Untz 2012-01-20 07:05:10 UTC
(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.