From: Helmut Grohne Date: Thu, 10 Aug 2017 12:00:39 +0000 (+0200) Subject: make mklib work with cross compilation X-Git-Tag: archive/raspbian/2.1.18-4+rpi1^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3da38a0b8fc7c5b27f84f189f6a754fd00c76057;p=xpa.git make mklib work with cross compilation The first hunk makes it use the compiler discovered by ./configure and thus will work with cross compilers. Since Makefile.in exports CC and CXX, it seems like mklib should be picking these up and not doing so is an upstream bug. Then remove insertion of -m32, because this is not universally understood by cross compilers. On Debian, the provided compiler will always choose the correct ABI, so no -m32 or -m64 is necessary. This part likely is not upstreamable. Gbp-Pq: Name make-mklib-work-with-cross-compilation.patch --- diff --git a/mklib b/mklib index c900b3e..bb070ac 100755 --- a/mklib +++ b/mklib @@ -211,9 +211,9 @@ case $ARCH in if [ "x$LINK" = "x" ] ; then # -linker was not specified so set default link command now if [ $CPLUSPLUS = 1 ] ; then - LINK=g++ + LINK=${CXX:-g++} else - LINK=gcc + LINK=${CC:-gcc} fi fi @@ -228,14 +228,6 @@ case $ARCH in ;; esac - # Check if objects are 32-bit and we're running in 64-bit - # environment. If so, pass -m32 flag to linker. - set ${OBJECTS} - ABI32=`file $1 | grep 32-bit` - if [ "${ABI32}" -a `uname -m` = "x86_64" ] ; then - OPTS="-m32 ${OPTS}" - fi - if [ "${ALTOPTS}" ] ; then OPTS=${ALTOPTS} fi @@ -281,13 +273,6 @@ case $ARCH in # exptmp is removed below fi - # Check if objects are 32-bit and we're running in 64-bit - # environment. If so, pass -m32 flag to linker. - set ${OBJECTS} - ABI32=`file $1 | grep 32-bit` - if [ "${ABI32}" -a `uname -m` = "x86_64" ] ; then - OPTS="-m32 ${OPTS}" - fi if [ "${ALTOPTS}" ] ; then OPTS=${ALTOPTS} fi @@ -355,15 +340,7 @@ case $ARCH in OPTS="-G" else # gcc linker - # Check if objects are 32-bit and we're running in 64-bit - # environment. If so, pass -m32 flag to linker. - set ${OBJECTS} - ABI32=`file $1 | grep 32-bit` - if [ "${ABI32}" ] ; then - OPTS="-m32 -shared -Wl,-Bdynamic" - else - OPTS="-m64 -shared -Wl,-Bdynamic" - fi + OPTS="-shared -Wl,-Bdynamic" fi # Check if objects are SPARC v9