Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 192323

Summary: dev-libs/gmp-4.2.1-rc1 fails to cross compile
Product: Gentoo Linux Reporter: Christopher Friedt <chrisfriedt>
Component: New packagesAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: VERIFIED WORKSFORME    
Severity: normal    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Christopher Friedt 2007-09-12 17:25:36 UTC
gmp has a configure script that follows the non-convention of using a CC_FOR_BUILD variable instead determining it automatically by either a --build= parameter or a CBUILD environment variable. This patch has fixed that issue:

--- gmp-4.2.1-r1.ebuild.old     2007-09-12 13:15:26.000000000 -0400
+++ gmp-4.2.1-r1.ebuild 2007-09-12 13:16:17.000000000 -0400
@@ -50,6 +50,10 @@
                [ "${ABI}" = "n32" ] && export GMPABI=n32
        fi
 
+       tc-is-cross-compiler && \
+               export CC_FOR_BUILD="${CBUILD}-gcc" && \
+               export CC="${CHOST}-gcc"
+
        econf \
                --localstatedir=/var/state/gmp \
                --disable-mpfr \

Reproducible: Always
Comment 1 SpanKY gentoo-dev 2007-09-13 07:25:13 UTC
use the toolchain-funcs eclass

really though, the configure script should be fixed
Comment 2 Christopher Friedt 2007-09-13 16:49:10 UTC
You're very right, i just started doing that... 

The patch should be:

--- gmp-4.2.1-r1.ebuild.old     2007-09-12 13:15:26.000000000 -0400
+++ gmp-4.2.1-r1.ebuild 2007-09-12 13:16:17.000000000 -0400
@@ -50,6 +50,10 @@
                [ "${ABI}" = "n32" ] && export GMPABI=n32
        fi

+       tc-is-cross-compiler && \
+               export CC_FOR_BUILD="$(tc-getBUILD_CC)" && \
+               export CC="$(tc-getCC)"
+
        econf \
                --localstatedir=/var/state/gmp \
                --disable-mpfr \


(In reply to comment #1)
> use the toolchain-funcs eclass
> 
> really though, the configure script should be fixed
> 

Comment 3 SpanKY gentoo-dev 2007-09-13 20:16:06 UTC
usually using those funcs are only when executing another command ... if you're just exporting, use:
tc-export CC

also, no point in quoting:
foo=$(moo)
Comment 4 SpanKY gentoo-dev 2007-10-06 23:30:29 UTC
gmp-4.2.1 cross-compiles just fine for me, and reading the GMP_PROG_CC_FOR_BUILD macro in acinclude.m4 looks like it does the right thing