GNOME Bugzilla – Bug 610176
Some cups1.2 feature use not shielded by API version-check
Last modified: 2010-03-17 09:27:14 UTC
Building gtk+-2.18.7 on OS X 10.4/ppc, there's a problem in modules/printbackends/cups: libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../.. -I../../../gtk -I../../../gtk -I../../../gdk -I../../../gdk -DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED -I/sw/lib/fontconfig2/include -I/sw/include/glib-2.0 -I/sw/lib/glib-2.0/include -I/sw/include/pango-1.0 -I/sw/include/cairo -I/sw/include/pixman-1 -I/sw/include/freetype2 -I/sw/include -I/sw/include/atk-1.0 -I/usr/X11R6/include -I/usr/X11/include -DG_DISABLE_CAST_CHECKS -DX_LOCALE -I/sw/lib/fontconfig2/include -I/sw/include -DG_DISABLE_SINGLE_INCLUDES -DATK_DISABLE_SINGLE_INCLUDES -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES -I/usr/X11R6/include -DGDK_PIXBUF_DISABLE_DEPRECATED -Os -Wall -MT gtkprintbackendcups.lo -MD -MP -MF .deps/gtkprintbackendcups.Tpo -c gtkprintbackendcups.c -fno-common -DPIC -o .libs/gtkprintbackendcups.o gtkprintbackendcups.c: In function 'gtk_print_backend_cups_set_password': gtkprintbackendcups.c:710: warning: implicit declaration of function 'httpGetHostname' I link with -no-undefined for added safety, which triggers: libtool: link: gcc -o .libs/libprintbackend-cups.so -bundle .libs/gtkprintbackendcups.o .libs/gtkprintercups.o .libs/gtkcupsutils.o -L/sw/lib/fontconfig2/lib -L/sw/lib ../../../gtk/.libs/libgtk-x11-2.0.dylib -L/usr/X11R6/lib /sw/build.build/gtk+2-2.18.7-1/gtk+-2.18.7/gdk/.libs/libgdk-x11-2.0.dylib ../../../gdk/.libs/libgdk-x11-2.0.dylib -lXinerama -lXcursor -lSM -lICE /sw/build.build/gtk+2-2.18.7-1/gtk+-2.18.7/gdk-pixbuf/.libs/libgdk_pixbuf-2.0.dylib /sw/lib/pango-ft219/lib/libpangocairo-1.0.dylib /sw/lib/libatk-1.0.dylib /sw/lib/libcairo.dylib /sw/lib/libgio-2.0.dylib /sw/lib/pango-ft219/lib/libpangoft2-1.0.dylib /sw/lib/pango-ft219/lib/libpango-1.0.dylib /sw/lib/freetype219/lib/libfreetype.dylib /sw/lib/fontconfig2/lib/libfontconfig.dylib /sw/lib/libgobject-2.0.dylib /sw/lib/libgmodule-2.0.dylib /sw/lib/libglib-2.0.dylib -lm -lcups -lXext -lXrender -lX11 /sw/lib/libintl.dylib -Wl,-dylib_file -Wl,/sw/lib/libgdk-x11-2.0.0.dylib:/sw/build.build/gtk+2-2.18.7-1/gtk+-2.18.7/gdk/.libs/libgdk-x11-2.0.dylib -Wl,-dylib_file -Wl,/sw/lib/libgdk_pixbuf-2.0.0.dylib:/sw/build.build/gtk+2-2.18.7-1/gtk+-2.18.7/gdk-pixbuf/.libs/libgdk_pixbuf-2.0.dylib -Wl,-dylib_file -Wl,/sw/lib/libgdk_pixbuf-2.0.0.dylib:/sw/build.build/gtk+2-2.18.7-1/gtk+-2.18.7/gdk-pixbuf/.libs/libgdk_pixbuf-2.0.dylib -Wl,-dylib_file -Wl,/sw/lib/libgdk_pixbuf-2.0.0.dylib:/sw/build.build/gtk+2-2.18.7-1/gtk+-2.18.7/gdk-pixbuf/.libs/libgdk_pixbuf-2.0.dylib /usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: Undefined symbols: _httpGetHostname collect2: ld returned 1 exit status make[4]: *** [libprintbackend-cups.la] Error 1 httpGetHostname() was added to cups in v1.2, but my cups isn't that new. During ./configure, cups is detected and config.h has HAVE_CUPS_API_1_2 undef'ed, which is the correct diagnosis. In gtkprintbackendcups.c, some "new in cup 1.2" features are protected by #HAVE_CUPS_API_1_2, but the code involving httpGetHostname is not. This code seems to have been added in commit 2c5ae21cdc6161dc4cf42b2107d74d92b6f303be for Bug #384940. Right now, cups support needs to be totally disabled on old-cups platforms. If gtk really does want cups1.2 as a minimum, configure should enforce that. If not, need to have a hack-around for this missing function or disable the gtkprint features that use it.
Turns out httpGetHostname() is a pretty simple function in cups source. I copied it from http://svn.easysw.com/public/cups/trunk/cups/http-addr.c into gtkprintbackendcups.c and everything built fine. CUPS is LGPL, so it would be allowed to include that code in gtk+. Could either rename that local implementation and use it directly as a permanent replacement, or have its code-block be controlled by #ifndef HAVE_CUPS_API_1_2 as a workaround for only those that need it. No problem for me to provide a patch if it would help, just need to know what approach the gtk devs prefer.
Created attachment 156192 [details] [review] define httpGetHostname() for CUPS < 1.2 Hi, this patch add the function httpGetHostname() into gtk+ for CUPS version 1.1 and lower. Regards Marek
Looks like what I have in fink's gtk+2 package now, and it seems to work.
Comment on attachment 156192 [details] [review] define httpGetHostname() for CUPS < 1.2 Looks fine to me
Hi, I committed the patch: Define httpGetHostname() for CUPS 1.1 and lower Function httpGetHostname() is in CUPS since version 1.2, that is why we need its equivalent for lower versions of CUPS (#610176). Thank you for this report Marek