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 (0x00007fff069a3000) => /usr/lib64/ (0x00007fa97bcf8000) => /lib64/ (0x00007fa97badc000) => /usr/lib64/ (0x00007fa97b8ad000) => /lib64/ (0x00007fa97b500000) => /lib64/ (0x00007fa97b2fc000) => /lib64/ (0x00007fa97b0e6000) => /usr/lib64/ (0x00007fa97aec0000) => /lib64/ (0x00007fa97abc2000)
/lib64/ (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,
* 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.

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

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

< Previous Next >
Follow Ups