#18 Build failure with libxml2-2.9.10.
Closed 3 years ago by midipix. Opened 3 years ago by orbea.

slibtool: 0.5.31
libxml2: http://www.xmlsoft.org/sources/libxml2-2.9.10.tar.gz
libtool: 2.4.6

After reading comment https://dev.midipix.org/cross/slibtool/issue/15#comment-23 I tried the libxml2 build where it fails with slibtool, but not libtool. Note that this is a different failure than discussed in the comment by @rossburton.

rlibtool: link: clang .libs/libxml.o .libs/libxml2-py.o .libs/types.o -g -O2 -L../.libs -lxml2 -ldl -lz -llzma -lm -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -shared -fPIC -o .libs/libxml2mod.so -Wl,--export-dynamic
/usr/bin/ld: /usr/bin/../lib64/gcc/x86_64-slackware-linux/9.3.0/../../../../lib64/crt1.o: relocation R_X86_64_32S against symbol `__libc_csu_fini' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: nonrepresentable section on output
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
rlibtool: exec error upon slbt_exec_link_create_library(), line 1446: (see child process error messages).
rlibtool: < returned to > slbt_exec_link(), line 1836.
make[4]: *** [Makefile:600: libxml2mod.la] Error 2
make[4]: Leaving directory '/tmp/libxml2-2.9.10/python'
make[3]: *** [Makefile:694: all-recursive] Error 1
make[3]: Leaving directory '/tmp/libxml2-2.9.10/python'
make[2]: *** [Makefile:528: all] Error 2
make[2]: Leaving directory '/tmp/libxml2-2.9.10/python'
make[1]: *** [Makefile:1479: all-recursive] Error 1
make[1]: Leaving directory '/tmp/libxml2-2.9.10'
make: *** [Makefile:893: all] Error 2

The issue goes away when running the slibtool link command in the python directory when the order of -Xlinker and -shared is reversed.

cd python
clang .libs/libxml.o .libs/libxml2-py.o .libs/types.o -g -O2 -L../.libs -lxml2 -ldl -lz -llzma -lm -lpython2.7 -lpthread -ldl -lutil -lm -shared -Xlinker -fPIC -o .libs/libxml2mod.so -Wl,--export-dynamic

Or if -Xlinker is omitted.

clang .libs/libxml.o .libs/libxml2-py.o .libs/types.o -g -O2 -L../.libs -lxml2 -ldl -lz -llzma -lm -lpython2.7 -lpthread -ldl -lutil -lm -shared -fPIC -o .libs/libxml2mod.so -Wl,--export-dynamic

Or can be avoided entirely when using --with-python=no as a configure argument.

Libtool never passes -Xlinker to the link command.

libtool: link: gcc -shared  -fPIC -DPIC  .libs/libxml.o .libs/libxml2-py.o .libs/types.o   -Wl,-rpath -Wl,/tmp/libxml2-2.9.10/.libs -Wl,-rpath -Wl,/usr/local/lib ../.libs/libxml2.so -lz -llzma -lpython2.7 -lpthread -ldl -lutil -lm  -g -O2 -Wl,-export-dynamic   -Wl,-soname -Wl,libxml2mod.so -o .libs/libxml2mod.so

Reproduction:
1. wget http://www.xmlsoft.org/sources/libxml2-2.9.10.tar.gz
2. tar xvf libxml2-2.9.10.tar.gz
3. cd libxml2-2.9.10
4. export MAKEFLAGS='LIBTOOL=rdlibtool V=1'
5. autoreconf -fi
6../configure
7. make

slibtool log: http://slackless.raccoons.tech/logs/libxml-slibtool-1.log
libtool log: http://slackless.raccoons.tech/logs/libxml-libtool.log


Thanks for the catch! slibtool's driver was missing proper support for -Xlinker (not to be confused with -XCClinker). Implemented in 2c4e5f9 and verified to build libxml2 with python enabled.

Metadata Update from @midipix:
- Issue status updated to: Closed (was: Open)

3 years ago

Login to comment on this ticket.

Metadata