bug#32211: problems with cross-compiling
Jörg Stucke <[email protected]>
| Newsgroups | gmane.comp.gnu.libtool.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hi, I was trying to cross-compile lighttpd using a mips cross-compiling toolchain and clang. lighttpd uses libtool to compile some libraries. I got an error when libtool tried to link with clang: /bin/bash ../libtool --tag=CC --mode=link /usr/bin/clang-6.0 -target mips-linux-gnu -I/usr/mips-linux-gnu/include/ -Wall -W -Wshadow -pedantic -module -export-dynamic -avoid-version -target mips-linux-gnu -o mod_flv_streaming.la -rpath /usr/local/lib mod_flv_streaming.lo libtool: link: rm -fr .libs/mod_flv_streaming.la .libs/mod_flv_streaming.lai .libs/mod_flv_streaming.so libtool: link: /usr/bin/clang-6.0 -shared -fPIC -DPIC .libs/mod_flv_streaming.o -Wl,-soname -Wl,mod_flv_streaming.so -o .libs/mod_flv_streaming.so /usr/bin/ld: .libs/mod_flv_streaming.o: Relocations in generic ELF (EM: 8) /usr/bin/ld: .libs/mod_flv_streaming.o: Relocations in generic ELF (EM: 8) /usr/bin/ld: .libs/mod_flv_streaming.o: Relocations in generic ELF (EM: 8) .libs/mod_flv_streaming.o: error adding symbols: File in wrong format clang: error: linker command failed with exit code 1 (use -v to see invocation) It seems that the linking flag "-target mips-linux-gnu" was removed by libtool which resulted in the linker (clang) assuming the wrong architecture (x86_64). The flag was set in the LDFLAGS environment variable. Before, it gets passed correctly during compiling (with CFLAGS="-target mips-linux-gnu"): /bin/bash ../libtool --tag=CC --mode=compile /usr/bin/clang-6.0 -DHAVE_CONFIG_H -DHAVE_VERSIONSTAMP_H - DLIBRARY_DIR="\"/usr/local/lib\"" -DSBIN_DIR="\"/usr/local/sbin\"" -I. -I.. -D_REENTRANT -D_FILE_OFFSET_ BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -target mips-linux-gnu -I/usr/mips-linux-gnu/include/ -Wall - W -Wshadow -pedantic -MT mod_flv_streaming.lo -MD -MP -MF .deps/mod_flv_streaming.Tpo -c -o mod_flv_stream ing.lo mod_flv_streaming.c libtool: compile: /usr/bin/clang-6.0 -DHAVE_CONFIG_H -DHAVE_VERSIONSTAMP_H -DLIBRARY_DIR=\"/usr/local/lib \" -DSBIN_DIR=\"/usr/local/sbin\" -I. -I.. -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARG E_FILES -target mips-linux-gnu -I/usr/mips-linux-gnu/include/ -Wall -W -Wshadow -pedantic -MT mod_flv_stre aming.lo -MD -MP -MF .deps/mod_flv_streaming.Tpo -c mod_flv_streaming.c -fPIC -DPIC -o .libs/mod_flv_streaming.o I'm not sure if this is intended or an error. The Problem only occurs if the flag "-target mips-linux-gnu" is set in CFLAGS and LDFLAGS. Changing the environment variable CC to "/usr/bin/clang -target mips-linux-gnu" instead, mitigates the problem, since it is then present during linking with libtool. I tried it with lighttpd 1.4.49 which uses the latest release version of libtool (2.4.6). regards, Jörg _______________________________________________ Bug-libtool mailing list [email protected] https://lists.gnu.org/mailman/listinfo/bug-libtool