[lsb-discuss] Problem building an LSB package which includes its own copy of the CUPS library
Till Kamppeter
till.kamppeter at gmail.com
Mon Jul 14 11:18:38 PDT 2008
Hi,
I am trying to make LSB packages of HPLIP (http://hplip.sf.net/). HPLIP
uses many libraries which are not part of the LSB. So the package has to
bring its own copies of these libraries.
It also needs interfaces of the CUPS library which are not included in
the LSB 3.2. Therefore I am also including a statically linked private
copy of the CUPS library.
In Gutenprint I am doing this already. See the spec file here:
http://www.openprinting.org/download/printdriver/SPECS/gutenprint5.2.spec
I have tried the same in HPLIP, but HPLIP does a special test for the
presence of the CUPS library. It is the line
AC_CHECK_LIB([cups], [cupsDoFileRequest], [LIBS="$LIBS"],
[AC_MSG_ERROR([cannot find libcups support], 9)])
in the congigure.in file. This line is a macro which gets replaced by
shell code which compiles a little program. The program looks like this
------------------------------------------------------------------------
char cupsDoFileRequest ();
int
main ()
{
return cupsDoFileRequest ();
;
return 0;
}
------------------------------------------------------------------------
and the compilation command line contains my extended CFLAGS and LDFLAGS:
------------------------------------------------------------------------
till at till-laptop:~/rpm/BUILD/hplip-2.8.6$ /opt/lsb/bin/lsbcc -o conftest
-L/home/till/rpm/BUILD/hplip-2.8.6/cups-1.3.7/cups/
/home/till/rpm/BUILD/hplip-2.8.6/cups-1.3.7/cups/libcups.a -lcups
-lpthread -lcrypt -lz conftest.c
/tmp/ccYyAwjV.o: In function `main':
conftest.c:(.text+0xa): undefined reference to `cupsDoFileRequest'
collect2: ld returned 1 exit status
till at till-laptop:~/rpm/BUILD/hplip-2.8.6$
------------------------------------------------------------------------
The command gives an error because the compilation did not find a
function named cupsDoFileRequest in the libraries referenced by the
command line. I know that the CUPS livrary of the LSB Build Environment,
/opt/lsb/lib64/libcups.so does not contain this function, but
"-L/home/till/rpm/BUILD/hplip-2.8.6/cups-1.3.7/cups/
/home/till/rpm/BUILD/hplip-2.8.6/cups-1.3.7/cups/libcups.a" should make
the compiler using my static CUPS library, and the static CUPS library
contains this function.
Below you see parts of my spec file, the code to create a static CUPS
library, and the "./configure" command line for HPLIP.
Is there a simple trick to get this working?
Till
This generates the static CUPS library:
------------------------------------------------------------------------
cd cups-*
# Additions to make the CUPS library build
# Remove non-LSB function "getpass()"
perl -p -i -e 's/return\s*\(getpass\(prompt\)\)/NULL/g' cups/usersys.c
# Add definitions for additional IOCTLs
perl -p -i -e 's/(\#include\s+\"http-private\.h\")/#define
_SYS_IOCTL_H\n#include <bits\/ioctls.h>\n$1/' cups/getifaddrs.c
# Let's look at the compilation command lines of CUPS
perl -p -i -e "s,^.SILENT:,," Makedefs.in
%configure --enable-static --disable-shared --disable-dbus --without-php \
--disable-slp --disable-gssapi --disable-ldap --disable-ssl \
--disable-cdsassl --disable-gnutls --disable-openssl --disable-pam \
--disable-dnssd --disable-launchd
cd cups
make
cd ..
cd ..
cupssrc=`ls -d cups*`
export CFLAGS="-I`pwd`/$cupssrc $CFLAGS"
export LDFLAGS="-L`pwd`/$cupssrc/cups `pwd`/$cupssrc/cups/libcups.a
-lpthread -lcrypt -lz -lcupsimage $LDFLAGS"
------------------------------------------------------------------------
This is the "./configure" command for HPLIP in my HPLIP spec file:
------------------------------------------------------------------------
%configure \
--prefix=%{_prefix} \
--mandir=%{_mandir} \
--infodir=%{_infodir} \
--docdir=%{_docdir} \
--with-docdir=%{_docdir} \
--disable-foomatic-drv-install \
--enable-foomatic-rip-hplip-install \
--with-drvdir=\$${prefix}/share/cups/drv \
--with-hpppddir=\$${prefix}/share/ppd/hpijs/HP \
--datadir=\$${prefix}/share \
--libexecdir=\$${prefix}/lib \
--localstatedir=/var \
--sysconfdir=/etc \
--enable-debug \
--without-icondir \
--disable-foomatic-xml-install \
--enable-foomatic-ppd-install \
--enable-network-build \
--enable-pp-build \
--enable-scan-build \
--enable-gui-build \
--enable-fax-build
------------------------------------------------------------------------
More information about the lsb-discuss
mailing list