pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: courier-imap / couriertcpd libtool failure



On Sat, Mar 13, 2010 at 03:30:07PM +0000, Brian Candler wrote:
> libtool: link: gcc -I./.. -I.. -Wall -Wno-error -Wno-format -fno-builtin
...
> tcpd.o tcpdaccess.o tcpremoteinfo.o -Wl,-ldb ./.libs/libspipe.a
...
> /usr/bin/ld: cannot find -ldb
> collect2: ld returned 1 exit status

I re-ran this with 'ECHO_WRAPPER_MSG=echo WRAPPER_DEBUG=yes' (see end of
mail).

As far as I can tell, it looks like work/.wrapper/tmp/transform.sed doesn't
handle transforming the option '-Wl,-ldb'

$ echo "-ldb" | sed -f work/.wrapper/tmp/transform.sed 
-ldb4
$ echo "-Wl,-ldb" | sed -f work/.wrapper/tmp/transform.sed 
-Wl,-ldb

Now, the only documentation I've been able to find so far is
mk/wrapper/NOTES which isn't particularly helpful.  But by tracing it
through I've found that:

- mail/couriertcpd depends on db via ../../mail/courier-mta/Makefile.common
  which in turn includes ../../mk/bdb.buildlink3.mk

- I think this pulls in ../../databases/db4/buildlink3.mk which has
  BUILDLINK_TRANSFORM+=           l:db:db4

- this ends up in _WRAP_TRANSFORM_CMDS which becomes an argument to
  work/.wrapper/tmp/gen-transform

- this in turn comes from mk/wrapper/gen-transform.sh

So one option might be to change gen-transform.sh so that transform
'l:db:db4' implies both -ldb => -ldb4 and -Wl,-ldb => -Wl,-ldb4. 
That's a pretty major global change though.

Another might be to add BUILDLINK_TRANSFORM+= opt:-Wl,-ldb:-Wl,-ldb4 to
the db4 package, or to mail/courier-mta/Makefile.common, or just to the
couriertcpd Makefile. So I tried the smallest possible change:

--- net/couriertcpd/Makefile.orig       2008-02-21 15:50:29.000000000 +0000
+++ net/couriertcpd/Makefile    2010-03-14 10:27:49.809772092 +0000
@@ -48,6 +48,9 @@
 REQD_DIRS=             ${DOCDIR}
 MAKE_DIRS+=            ${COURIER_STATEDIR}
 
+# Temporary frig
+BUILDLINK_TRANSFORM+=  opt:-Wl,-ldb:-Wl,-ldb4
+
 do-install:
        ${INSTALL_PROGRAM} ${WRKSRC}/tcpd/couriertcpd                   \
                ${DESTDIR}${PREFIX}/sbin/couriertcpd

and hey presto, it made the couriertcpd package build!

$ ldd /u/home/brian/pkg/sbin/couriertcpd
        linux-vdso.so.1 =>  (0x00007fff6b59a000)
        libdb4-4.7.so.7 => /u/home/brian/pkg/lib/libdb4-4.7.so.7 
(0x00007f622e965000)
        libc.so.6 => /lib/libc.so.6 (0x00007f622e5f6000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f622ed41000)

But as this is clearly a frig, I'd appreciate some advice about how to deal
with this properly. Maybe the solution it to patch couriertcp's tcpd/configure
which has
        LIBDB="-Wl,$LIBDB"

Interestingly, I was able to build security/courier-authlib without such
a frig, even though it also uses -ldb. This also hints that tcpd is wrong.

Regards,

Brian.

-----------------------
$ build ECHO_WRAPPER_MSG=echo WRAPPER_DEBUG=yes package
...
gcc -DHAVE_CONFIG_H -I.   -I/usr/include -I/u/home/brian/pkg/include/db4 
-I/u/home/brian/pkg/include  -I./.. -I.. -Wall -Wno-error -Wno-format 
-fno-builtin -I/usr/include -I/u/home/brian/pkg/include/db4 
-I/u/home/brian/pkg/include -MT tcpremoteinfo.o -MD -MP -MF 
.deps/tcpremoteinfo.Tpo -c -o tcpremoteinfo.o tcpremoteinfo.c
mv -f .deps/tcpremoteinfo.Tpo .deps/tcpremoteinfo.Po
/bin/bash ./libtool --tag=CC   --mode=link gcc  -I./.. -I.. -Wall -Wno-error 
-Wno-format -fno-builtin -I/usr/include -I/u/home/brian/pkg/include/db4 
-I/u/home/brian/pkg/include -static -L/usr/lib64 -Wl,-R/usr/lib64 
-Wl,-R/u/home/brian/pkg/lib -o couriertcpd argparse.o tcpd.o tcpdaccess.o 
tcpremoteinfo.o libspipe.la ../rfc1035/librfc1035.a ../bdbobj/libbdbobj.la 
../liblock/liblock.la ../numlib/libnumlib.la ../waitlib/libwaitlib.a 
../soxwrap/libsoxwrap.a ../md5/libmd5.la ../random128/librandom128.la -Wl,-ldb  
libtool: link: gcc -I./.. -I.. -Wall -Wno-error -Wno-format -fno-builtin 
-I/v/brian/build/pkgsrc/net/couriertcpd/work/.buildlink/include/db4 
-I/v/brian/build/pkgsrc/net/couriertcpd/work/.buildlink/include 
-Wl,-R/usr/lib64 -Wl,-R/u/home/brian/pkg/lib -o couriertcpd argparse.o tcpd.o 
tcpdaccess.o tcpremoteinfo.o -Wl,-ldb  ./.libs/libspipe.a 
-L/v/brian/build/pkgsrc/net/couriertcpd/work/.buildlink/lib 
../rfc1035/librfc1035.a ../bdbobj/.libs/libbdbobj.a ../liblock/.libs/liblock.a 
../numlib/.libs/libnumlib.a ../waitlib/libwaitlib.a ../soxwrap/libsoxwrap.a 
../md5/.libs/libmd5.a ../random128/.libs/librandom128.a
/usr/bin/ld: cannot find -ldb
collect2: ld returned 1 exit status

[wrapper.sh] note: The real command line, after the pkgsrc wrapper, was:
/v/brian/build/pkgsrc/net/couriertcpd/work/.gcc/bin/gcc -I./.. -I.. -Wall 
-Wno-error -Wno-format -fno-builtin 
-I/v/brian/build/pkgsrc/net/couriertcpd/work/.buildlink/include/db4 
-I/v/brian/build/pkgsrc/net/couriertcpd/work/.buildlink/include 
-Wl,-R/usr/lib64 -Wl,-R/u/home/brian/pkg/lib -o couriertcpd argparse.o tcpd.o 
tcpdaccess.o tcpremoteinfo.o -Wl,-ldb ./.libs/libspipe.a 
-L/v/brian/build/pkgsrc/net/couriertcpd/work/.buildlink/lib 
../rfc1035/librfc1035.a ../bdbobj/.libs/libbdbobj.a ../liblock/.libs/liblock.a 
../numlib/.libs/libnumlib.a ../waitlib/libwaitlib.a ../soxwrap/libsoxwrap.a 
../md5/.libs/libmd5.a ../random128/.libs/librandom128.a 

[wrapper.sh] note: The real command line, after the pkgsrc wrapper, was:
/u/home/brian/pkg/bin/libtool --tag=CC --mode=link gcc -I./.. -I.. -Wall 
-Wno-error -Wno-format -fno-builtin 
-I/v/brian/build/pkgsrc/net/couriertcpd/work/.buildlink/include/db4 
-I/v/brian/build/pkgsrc/net/couriertcpd/work/.buildlink/include -static 
-Wl,-R/usr/lib64 -Wl,-R/u/home/brian/pkg/lib -o couriertcpd argparse.o tcpd.o 
tcpdaccess.o tcpremoteinfo.o libspipe.la ../rfc1035/librfc1035.a 
../bdbobj/libbdbobj.la ../liblock/liblock.la ../numlib/libnumlib.la 
../waitlib/libwaitlib.a ../soxwrap/libsoxwrap.a ../md5/libmd5.la 
../random128/librandom128.la -Wl,-ldb 
-L/v/brian/build/pkgsrc/net/couriertcpd/work/.buildlink/lib 
make[1]: *** [couriertcpd] Error 1
make[1]: Leaving directory 
`/v/brian/build/pkgsrc/net/couriertcpd/work/courier-0.58.0/tcpd'
make: *** [all] Error 2
*** Error code 2

Stop.
bmake: stopped in /u/home/brian/build/pkgsrc/net/couriertcpd
*** Error code 1

Stop.
bmake: stopped in /u/home/brian/build/pkgsrc/net/couriertcpd


Home | Main Index | Thread Index | Old Index