Bug in configure script for PPC64 machines

Myria myriachan at cox.net
Wed Jan 31 05:15:41 CET 2007

As "Fuzzy Logic" ran into on January 25, there is a bug in configure for 
PowerPC Linux machines.  I ran into it as well and diagnosed some of it.

On these machines, "configure" identifies the machine type as 
powerpc64-unknown-linux-gnu.  This causes it to select the 64-bit assembly 
code.  However, GCC on these machines is set to do a 32-bit compile by 
default.  configure recognizes that GCC is 32-bit by default, but it doesn't 
switch to using the 32-bit PowerPC assembly code.  The result is that "make 
check" failed because some code is 32-bit and some code is 64-bit.  Unlike 
x86-32 and x86-64, such mixed code will compile and link.

Here's the workarounds I found for this:

If you want 32-bit:

make distclean
export CFLAGS=-m32
export CXXFLAGS=-m32
./configure --enable-cxx --host=powerpc-unknown-linux-gnu
make check

If you want 64-bit:

make distclean
export CFLAGS=-m64
export CXXFLAGS=-m64
./configure --enable-cxx --host=powerpc64-unknown-linux-gnu
make check

The "make distclean" is necessary if you had a failed compile before.  If 
you get errors in fib_*.c, you didn't do it.  --enable-cxx adds the C++ 
wrapper; delete that if you don't care.

Having both 32-bit and 64-bit on the same machine is possible, but difficult 
because gmp.h has definitions that change between the two.  You have to 
manually edit it, then put the libraries in the correct places on disk.

Considering that the executables on these machines are mostly 32-bit, and 
GCC defaults to 32-bit, you'll probably want the 32-bit one.


More information about the gmp-bugs mailing list