GNOME Bugzilla – Bug 456513
Libs line in pc file needs to mention gailutil library
Last modified: 2008-06-25 02:22:54 UTC
While building libbonoboui 2.19.4 it fails when linking with libgnomecanvas library (2.19.1) Undefined first referenced symbol in file gail_text_util_new /usr/lib/libgnomecanvas-2.so gail_text_util_get_text /usr/lib/libgnomecanvas-2.so gail_text_util_text_setup /usr/lib/libgnomecanvas-2.so gail_text_util_buffer_setup /usr/lib/libgnomecanvas-2.so gail_misc_buffer_get_run_attributes /usr/lib/libgnomecanvas-2.so gail_misc_get_origins /usr/lib/libgnomecanvas-2.so ld: fatal: Symbol referencing errors. No output written to .libs/bonobo-hello Adding '-lgailutil' to the libgonmecanvas-2.0.pc.in file fixes this. This is required because libgnomecanvas now requires gail.
Created attachment 91723 [details] [review] Add -lgailutil to libgnomecanvas-2.0.pc.in file.
Does libgnomecanvas really need to instruct everything that links against it to link against gailutil, or is a cleaner solution to have only libgnomecanvas itself link agsinst gailutil? Based on the error message, the latter. I see the .pc already lists Requires:gail, so the intent here (probably:) is that libgnomecanvas itself is compiled with 'pkg-config gail'.
Actually the .pc file only mentions gail in the 'Requires.private' line, not the 'Requires' line. AFAIK, this is for static linking. Maybe adding 'gail' to 'Requires' will fix the issue.
Ah yeah. Having it .private is consistent with the apparent intent of having libgnomecanvas itself link gail, not instruct all who link against libgnomecanvas users to link against gail also. configure.in does: CANVAS_MODULES="dnl gtk+-2.0 >= gtk_required_version dnl gail >= gail_required_version dnl libart-2.0 >= libart_required_version dnl pango >= pango_required_version dnl pangoft2 >= pango_required_version" PKG_PROG_PKG_CONFIG([0.18]) PKG_CHECK_MODULES(LIBGNOMECANVAS, $CANVAS_MODULES) and libgnomecanvas/Makefile.am does: libgnomecanvas_2_la_LIBADD = \ $(LIBGNOMECANVAS_LIBS) so libgnomecanvas-2.so *should be* being compiled with gail.pc's flags. What the heck?? gail as a stand-alone lib is apparently being deprecated, so it's probably not a good idea to be publishing instructions to link against gail. Actually, it looks like gail's source is being copied into libgnomecanvas (bug #363103)...maybe something went wrong (or is not complete) there?
According to http://build.gnome.org:8080/libbonoboui/ everything builds fine on Linux. Did you build GNOME with jhbuild? If not, how did you build it? (I think it's more likely to be a problem on your side than with gnome canvas.) I also reject this patch as -lgailutil is not supposed to be mentioned in libgnomecanvas-2.0.pc because the whole pkg-config system is supposed to track dependencies (otherwise -lgtk-2.0 would have to be there since ages). Li, are you aware of any solaris-related build failures due to the migration?
I tried a new patch where I add gail to the Requires line. This works for me. I build with pkgbuild (rpm-like interface for package building on Solaris: http://pkgbuild.sourceforge.net/). See: http://www.opensolaris.org/os/project/jds/contributing/building/#jds-cbe
Created attachment 92290 [details] [review] Add gail to Requires instead of Libs line of .pc file.
This may because we doesn't ship *.la files on Solaris which can be found on Linux. In /usr/lib/libgnomecanvas-2.la we can find "/usr/lib/libgailutil.la" in dependency_libs.
What are your opinions on the new patch that adds gail to the Requires line?
Still opposed--still no evidence that packages linking against gnomecanvas need to link gail. Based on the errors, it appears that you're trying to solve a problem involving a linking against b linking against c by instructing a to link against c...seems contrary to the whole idea of dynamic linking (or do some platforms have a linker that insists on every symbol being defined explicitly instead of in sub-linked libs). Does ldd indicate that the latest gnomecanvas not link libgail?
You are right, the root cause seems to be that when I build libgnomecanvas with a not-yet-installed gail (and therefore using gail-uninstalled.pc) the uninstalled.pc file was pointing to the wrong .la file and therefore not linking correctly. The mistaken was (re)introduced with bug #536430 and I will add the correct patch for gail-uninstalled.pc file there. Thanks for the critical review of my patches. This bug can be closed as NotABug or Invalid.