Bug#907266: Bug#907358: ncbi-vdb: fix broken library on i386

2018-08-28 Thread Steve Langasek
On Tue, Aug 28, 2018 at 09:38:50PM +0200, Andreas Tille wrote:
> > Also, this broken library package would have been detectable at build time
> > if you were building with -Wl,-z,defs in LDFLAGS, as that would have
> > prevented ever generating a shared library with missing symbols.  That's a
> > good idea to do anyway, but in particular it would mean that if you didn't
> > want to support i386 anymore, you could just add this to build flags and not
> > have to worry about changing the architecture list explicitly.

> So I did but was running into new problems which are caused by the hand
> craftet build system (yes, I tried to convince upstream to use some of
> the usual candidates but failed :-((( ).  I was able to add some missing
> libs in pbuilder chroot but whatever trick I try[1] the build system
> always constructs a different command line than I tested inside the
> pbuilder chroot.

> Do you have any idea to stop this insane messing up with library options?

> [1] 
> https://salsa.debian.org/med-team/ncbi-vdb/blob/master/debian/patches/fix_linking.patch

Failure I see in a local build is:

Try to add extra libs to LDFLAGS ... unfortunately this fails as well
CMD=gcc -shared -o 
/tmp/ncbi-vdb/debian/tmp/usr/ncbi-vdb/linux/gcc/x86_64/dbg/lib/libkdf5.so.2.9.2 
-Wl,-soname,libkdf5.so.2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now 
-Wl,-z,defs -Wl,--as-needed -g-ghdf5dir.pic.o hdf5file.pic.o 
hdf5arrayfile.pic.o 
-L/tmp/ncbi-vdb/debian/tmp/usr/ncbi-vdb/linux/gcc/x86_64/dbg/lib 
-L/tmp/ncbi-vdb/debian/tmp/usr/ncbi-vdb/linux/gcc/x86_64/dbg/ilib -lhdf5_serial 
-lz -lmbedx509 -lmbedtls -lmbedcrypto -Wl,-Bstatic -Wl,-whole-archive -lklib 
-lkfs -Wl,-no-whole-archive -Wl,-Bdynamic -lbz2 -ldl -lpthread -lm -lkproc 
-lkfs -lkdb -lkns -lkfg
gcc -shared -o 
/tmp/ncbi-vdb/debian/tmp/usr/ncbi-vdb/linux/gcc/x86_64/dbg/lib/libkdf5.so.2.9.2 
-Wl,-soname,libkdf5.so.2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now 
-Wl,-z,defs -Wl,--as-needed -g-ghdf5dir.pic.o hdf5file.pic.o 
hdf5arrayfile.pic.o 
-L/tmp/ncbi-vdb/debian/tmp/usr/ncbi-vdb/linux/gcc/x86_64/dbg/lib 
-L/tmp/ncbi-vdb/debian/tmp/usr/ncbi-vdb/linux/gcc/x86_64/dbg/ilib -lhdf5_serial 
-lz -lmbedx509 -lmbedtls -lmbedcrypto -Wl,-Bstatic -Wl,-whole-archive -lklib 
-lkfs -Wl,-no-whole-archive -Wl,-Bdynamic -lbz2 -ldl -lpthread -lm
/tmp/ncbi-vdb/debian/tmp/usr/ncbi-vdb/linux/gcc/x86_64/dbg/ilib/libklib.a(hashfile.pic.o):
 In function `map_calloc':
/tmp/ncbi-vdb/libs/klib/hashfile.c:288: undefined reference to `KLockAcquire'
/tmp/ncbi-vdb/libs/klib/hashfile.c:321: undefined reference to `KLockUnlock'
/tmp/ncbi-vdb/libs/klib/hashfile.c:328: undefined reference to `KLockUnlock'
[...]

When using -Wl,--as-needed, each object needs to be listed on the
commandline /after/ those objects that use it.

A correct commandline would be:

gcc -shared -o 
/tmp/ncbi-vdb/debian/tmp/usr/ncbi-vdb/linux/gcc/x86_64/dbg/lib/libkdf5.so.2.9.2 
-Wl,-soname,libkdf5.so.2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now 
-Wl,-z,defs -Wl,--as-needed -g-ghdf5dir.pic.o hdf5file.pic.o 
hdf5arrayfile.pic.o 
-L/tmp/ncbi-vdb/debian/tmp/usr/ncbi-vdb/linux/gcc/x86_64/dbg/lib 
-L/tmp/ncbi-vdb/debian/tmp/usr/ncbi-vdb/linux/gcc/x86_64/dbg/ilib -lhdf5_serial 
-lz -Wl,-Bstatic -Wl,-whole-archive -lklib -lkfs -Wl,-no-whole-archive 
-Wl,-Bdynamic -lbz2 -ldl -lpthread -lm -lkfs -lkq -lkproc -lkdb -lkns -lkfg 
-lksproc -lmbedx509 -lmbedtls -lmbedcrypto -lz

So this seems to be sufficient:

CMD="$CMD -lkfs -lkq -lkproc -lkdb -lkns -lkfg -lksproc -lmbedx509 
-lmbedtls -lmbedcrypto -lz"

Though there is another similar error when trying to link libdiagnose.so
later.

-- 
Steve Langasek   Give me a lever long enough and a Free OS
Debian Developer   to set it on, and I can move the world.
Ubuntu Developer   https://www.debian.org/
slanga...@ubuntu.com vor...@debian.org


signature.asc
Description: PGP signature


Bug#907266: Bug#907358: ncbi-vdb: fix broken library on i386

2018-08-28 Thread Andreas Tille
Control: tags -1 help

Hi Steve,

On Sun, Aug 26, 2018 at 03:04:40PM -0700, Steve Langasek wrote:
> Package: ncbi-vdb
> Version: 2.9.1-1+dfsg-1
> Severity: grave
> Tags: patch
> User: ubuntu-de...@lists.ubuntu.com
> Usertags: origin-ubuntu cosmic ubuntu-patch
> 
> Dear Andreas,
> 
> The libncbi-vdb2 library is broken on i386, because while it has managed to
> build, it has unresolvable references:
> ...
> It would also be perfectly reasonable to drop i386 as a supported
> architecture for ncbi-vdb if you prefer; but I suggest you then make sure to
> actually do this, rather than shipping a broken library package on i386.

Thanks to your patch I decided to leave i386 for the moment but its
definitely a candidate for removal.

> Also, this broken library package would have been detectable at build time
> if you were building with -Wl,-z,defs in LDFLAGS, as that would have
> prevented ever generating a shared library with missing symbols.  That's a
> good idea to do anyway, but in particular it would mean that if you didn't
> want to support i386 anymore, you could just add this to build flags and not
> have to worry about changing the architecture list explicitly.

So I did but was running into new problems which are caused by the hand
craftet build system (yes, I tried to convince upstream to use some of
the usual candidates but failed :-((( ).  I was able to add some missing
libs in pbuilder chroot but whatever trick I try[1] the build system
always constructs a different command line than I tested inside the
pbuilder chroot.

Do you have any idea to stop this insane messing up with library options?


[1] 
https://salsa.debian.org/med-team/ncbi-vdb/blob/master/debian/patches/fix_linking.patch

-- 
http://fam-tille.de