[opensuse-buildservice] Strange build problem
I'm facing a strang behaviour on obs: https://build.opensuse.org/package/rawlog/home:e9925248:darwin/headerdoc/ope... It installs libxml2-devel: [ 36s] [98/99] cumulate libxml2-devel-2.9.0-2.1.1 [ 37s] libxml2-devel-2.9.0-2.1.1 ######################################## 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' [ 44s] /home/abuild/rpmbuild/BUILD/headerdoc-8.9.14/xmlman/xml2man.c:738: undefined reference to `xmlFreeNode' [ 44s] xml2man.o: In function `main': [ 44s] /home/abuild/rpmbuild/BUILD/headerdoc-8.9.14/xmlman/xml2man.c:116: undefined reference to `xmlCheckVersion' [ 44s] /home/abuild/rpmbuild/BUILD/headerdoc-8.9.14/xmlman/xml2man.c:126: undefined reference to `xmlParseFile' [ 44s] /home/abuild/rpmbuild/BUILD/headerdoc-8.9.14/xmlman/xml2man.c:147: undefined reference to `xmlParseMemory' [ 44s] /home/abuild/rpmbuild/BUILD/headerdoc-8.9.14/xmlman/xml2man.c:149: undefined reference to `xmlDocGetRootElement' [ 44s] /home/abuild/rpmbuild/BUILD/headerdoc-8.9.14/xmlman/xml2man.c:173: undefined reference to `xmlFreeDoc' [ 44s] /home/abuild/rpmbuild/BUILD/headerdoc-8.9.14/xmlman/xml2man.c:174: undefined reference to `xmlCleanupParser' This means, that cc does not find libxml2. On a openSuSE 12.3 chroot: $rpm -ql libxml2-devel |grep -v include /usr/bin/xml2-config /usr/lib64/libxml2.la /usr/lib64/libxml2.so /usr/lib64/pkgconfig/libxml-2.0.pc /usr/lib64/xml2Conf.sh /usr/share/aclocal /usr/share/aclocal/libxml.m4 /usr/share/man/man1/xml2-config.1.gz /usr/share/man/man3/libxml.3.gz So /usr/lib64/libxml2.so, which is necessary to link libxml2, should be in the obs chroot. /usr/lib64 is the default search path for libraries, so it should be found by the compiler via -lxml2. Executing the same command (as well as building the package via rpmbuild directly) in the openSuSE 12.3 chroot finds the library. I currently don't have any clue, what could be different. Regards, Martin -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
Martin Koegler
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. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
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@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
Martin Koegler
I know, that this happen for static libraries. The above command don't use -static, so the dynamic library should be used.
That doesn't make a difference.
* Is there anything, which inserts such a option?
See https://build.opensuse.org/package/view_file/openSUSE:Factory/binutils/binut.... Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
On Sat, Aug 17, 2013 at 08:51:46PM +0200, Andreas Schwab wrote:
Martin Koegler
writes: * Is there anything, which inserts such a option?
See https://build.opensuse.org/package/view_file/openSUSE:Factory/binutils/binut....
Thanks. That patch explains, what happens and how to test/fix the issue. There is still one open question: How is the environment variable SUSE_ASNEEDED injected into the build process? Of the base opensuse packages, just ld of binutils contains that string (caused by the patch above). The obs-build sources as well as the open-build-system sources does not contain that string. I have also not been able to locate it in the project config of Factory, 12.X, Base, Base:System, .... Regards, Martin -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
Martin Koegler
How is the environment variable SUSE_ASNEEDED injected into the build process?
See post-build-checks:/etc/profile.d/suse-buildsystem.sh Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different." -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
participants (3)
-
Andreas Schwab
-
Andreas Schwab
-
Martin Koegler