GNU bug report logs - #32211
problems with cross-compiling

Previous Next

Package: libtool;

Reported by: Jörg Stucke <stucke <at> informatik.uni-bonn.de>

Date: Thu, 19 Jul 2018 15:04:01 UTC

Severity: normal

To reply to this bug, email your comments to 32211 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-libtool <at> gnu.org:
bug#32211; Package libtool. (Thu, 19 Jul 2018 15:04:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jörg Stucke <stucke <at> informatik.uni-bonn.de>:
New bug report received and forwarded. Copy sent to bug-libtool <at> gnu.org. (Thu, 19 Jul 2018 15:04:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jörg Stucke <stucke <at> informatik.uni-bonn.de>
To: bug-libtool <at> gnu.org
Subject: problems with cross-compiling
Date: Thu, 19 Jul 2018 16:07:10 +0200
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






Information forwarded to bug-libtool <at> gnu.org:
bug#32211; Package libtool. (Thu, 19 Jul 2018 18:46:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Bob Friesenhahn <bfriesen <at> simple.dallas.tx.us>
To: Jörg Stucke <stucke <at> informatik.uni-bonn.de>
Cc: bug-libtool <at> gnu.org, 32211 <at> debbugs.gnu.org
Subject: Re: bug#32211: problems with cross-compiling
Date: Thu, 19 Jul 2018 13:45:00 -0500 (CDT)
[Message part 1 (text/plain, inline)]
On Thu, 19 Jul 2018, Jörg Stucke wrote:
>
> 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.

Libtool only passes through options that it understands.  Otherwise 
one must use -Wc, and -Wl, syntax to pass options to the compiler or 
linker.

Also, usually cross-tools are supposed to be named a particular way 
(including the target triplet in the name) according to autoconf 
conventions (see the autoconf documentation).  This helps autoconf and 
libtool understand that cross-compilation is being performed, and 
assures that the correct tools are used.

On a system here, I see cross tools named like mips-linux-gcc and 
mips-unknown-linux-uclibc-gcc.

Bob
-- 
Bob Friesenhahn
bfriesen <at> simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/

Information forwarded to bug-libtool <at> gnu.org:
bug#32211; Package libtool. (Thu, 19 Jul 2018 18:46:02 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 331 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.