From e8f6cba3b0adf639c09681def430ec26f5cd1800 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Thu, 10 Aug 2017 14:00:39 +0200 Subject: [PATCH] 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 --- mklib | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) 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 -- 2.30.2