Mailinglist Archive: opensuse-buildservice (142 mails)

< Previous Next >
Re: [opensuse-buildservice] Re: Strange build problem
  • From: Martin Koegler <martin.koegler@xxxxxxxxx>
  • Date: Sat, 17 Aug 2013 20:11:43 +0200
  • Message-id: <20130817181143.GA14742@mail.zuhause>
On Sat, Aug 17, 2013 at 12:59:53PM +0200, Andreas Schwab wrote:
The build fails with:
[ 44s] cc -lxml2 -lpthread xml2man.o strcompat.o -o xml2man
[ 44s] xml2man.o: In function `writeData_sub':
[ 44s] /home/abuild/rpmbuild/BUILD/headerdoc-8.9.14/xmlman/xml2man.c:730:
undefined reference to `xmlUnlinkNode'

This means, that cc does not find libxml2.

It does, but there are no references to it at this point. They only
come in later on the command line, but then it's already too late.
Object files and libraries are processed in order they are listed, and
if a library doesn't resolve an undefined reference it is ignored.

I know, that this happen for static libraries. The above command don't use
-static, so
the dynamic library should be used.

Dynamic libraries are different: Distributions have been fighting agains not
necessary -lxxx
statements (eg. with -Wl,--as-needed). They are added unconditional, which
result in not
necessary dependencies between packages.

Example in a openSuSE 12.3 chroot:
$ cc -lxml2 -lpthread -lpng xml2man.o strcompat.o -o xml2man
$ ldd ./xml2man
linux-vdso.so.1 (0x00007fff069a3000)
libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00007fa97bcf8000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa97badc000)
libpng15.so.15 => /usr/lib64/libpng15.so.15 (0x00007fa97b8ad000)
libc.so.6 => /lib64/libc.so.6 (0x00007fa97b500000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fa97b2fc000)
libz.so.1 => /lib64/libz.so.1 (0x00007fa97b0e6000)
liblzma.so.5 => /usr/lib64/liblzma.so.5 (0x00007fa97aec0000)
libm.so.6 => /lib64/libm.so.6 (0x00007fa97abc2000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa97c05f000)

So gcc will even include totally unrelated dynamic libraries, regardless of
their position.

The compiler in my chroot is the same as in the obs log, as
$ rpm -V gcc47-4.7.2_20130108-2.1.6 gcc-4.7-7.1.1 binutils-2.23.1-2.2.1
reported no differences.

A -Wl,--as-needed as first argument to cc would result in such a build failure,
but:
* I use the same distribution (and compiler packages) as this OBS build.
* Nothing in the OBS logs shows, that such an option is inserted into the
command line
* rpmbuild in a 12.3 chroot also behaves like -Wl,--as-needed is not used.

So:
* Are there any modified packages used on the OBS workers?
* Is there anything, which inserts such a option?
* Or is there some different happening?

Regards,
Martin
--
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-buildservice+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups