Build error in gmp 4.2.2

Michael J. Bauer mjbauer at
Tue Mar 25 21:44:38 CET 2008

The pertinent info section was not an absolute order; it was merely 
indicating the environment.  I should have put the setenv before the 
configure; that's how I ran the initial build.

The difference between what I did and the officially approved method of 
setting ABI should make no operative difference in result from my prior 
attempt; both my earlier setenv and the command-line assignment set the 
environment variable ABI to 64 for configure and make.  The only 
difference is that my earlier method set ABI as a global environment 
variable in tcsh; this way I feed it individually to each of the two 
build commands (configure and make).

Note that the same error also happens with no ABI selected (which 
implies 64) and C++ support turned on.  However, there is no problem if 
I leave C++ support disabled, no matter what method I use to set the ABI 
on configuration.

Having just rebuilt with what appears to be the officially approved 
means of setting ABI:

# ./configure --prefix=/usr/local/package2 
--oldincludedir=/usr/local/package2/include --enable-cxx ABI=64
(This time around, ABI is not set as a global environment variable in 
tcsh; it's just fed to configure and later to make.  )

As expected, I still get the identical error on make:

# make ABI=64
...lots removed...
/bin/bash ./libtool --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I. 
-D__GMP_WITHIN_GMP    -g -O2 -c -o dummy.lo `test -f 'cxx/' || 
echo './'`cxx/
 g++ -DHAVE_CONFIG_H -I. -I. -I. -D__GMP_WITHIN_GMP -g -O2 -c 
cxx/  -fPIC -DPIC -o .libs/dummy.o
 g++ -DHAVE_CONFIG_H -I. -I. -I. -D__GMP_WITHIN_GMP -g -O2 -c 
cxx/ -o dummy.o >/dev/null 2>&1
/bin/bash ./libtool --mode=link g++  -g -O2   -o -rpath 
/usr/local/package2/lib -Wc,-m64  -version-info 4:2:0 dummy.lo 
cxx/isfuns.lo cxx/ismpf.lo cxx/ismpq.lo cxx/ismpz.lo cxx/ismpznw.lo 
cxx/osdoprnti.lo cxx/osfuns.lo cxx/osmpf.lo cxx/osmpq.lo cxx/osmpz.lo
g++ -shared -nostdlib  
.libs/dummy.o cxx/.libs/isfuns.o cxx/.libs/ismpf.o cxx/.libs/ismpq.o 
cxx/.libs/ismpz.o cxx/.libs/ismpznw.o cxx/.libs/osdoprnti.o 
cxx/.libs/osfuns.o cxx/.libs/osmpf.o cxx/.libs/osmpq.o 
cxx/.libs/osmpz.o  -Wl,-R -Wl,/tmp/Software/gmp-4.2.2/.libs -Wl,-R 
-Wl,/usr/local/lib/sparcv9 -Wl,-R -Wl,/usr/local/package2/lib -Wl,-R 
-Wl,/usr/local/lib/sparcv9 -Wl,-R -Wl,/usr/local/lib -Wl,-R 
-Wl,/usr/local/ssl/lib -Wl,-R -Wl,/usr/openwin/lib ./.libs/ 
-L/usr/ccs/bin/sparcv9 -L/usr/ccs/bin -L/usr/ccs/lib/sparcv9 
-L/usr/local/lib/gcc/sparc-sun-solaris2.10/3.4.6/../../.. -L/lib/sparcv9 
-L/usr/lib/sparcv9 /usr/local/lib/sparcv9/ 
-L/usr/local/lib -L/usr/local/ssl/lib -L/usr/openwin/lib 
-L/sol10/SOURCES/S10/gcc-3.4.6/objdir/gcc -L/usr/local/lib/sparcv9 -lm 
/usr/local/lib/gcc/sparc-sun-solaris2.10/3.4.6/sparcv9/crtn.o  -m64 
-Wl,-h -Wl, -o .libs/
ld: fatal: file .libs/dummy.o: wrong ELF class: ELFCLASS32
ld: fatal: File processing errors. No output written to 
collect2: ld returned 1 exit status

For comparison, here's an earlier stretch in the non-C++ section:

 gcc -DHAVE_CONFIG_H -I. -I. -I.. -D__GMP_WITHIN_GMP -I.. -O2 -m64 
-mptr64 -mcpu=ultrasparc -c vsscanf.c -o vsscanf.o >/dev/null 2>&1
/bin/bash ../libtool --mode=link gcc  -O2 -m64 -mptr64 
-mcpu=ultrasparc   -o   doscan.lo fscanf.lo fscanffuns.lo 
scanf.lo sscanf.lo sscanffuns.lo vfscanf.lo vscanf.lo vsscanf.lo
ar cq .libs/libscanf.a .libs/doscan.o .libs/fscanf.o .libs/fscanffuns.o 
.libs/scanf.o .libs/sscanf.o .libs/sscanffuns.o .libs/vfscanf.o 
.libs/vscanf.o .libs/vsscanf.o
ranlib .libs/libscanf.a

The state of the build tree after the errors is instructive:

# pwd
# file memory.o
memory.o:       ELF 64-bit MSB relocatable SPARCV9 Version 1, 
UltraSPARC1 Extensions Required
(This is a representative; every .o file in this directory, save one, is 
ELF 64.)
# file dummy.o
dummy.o:        ELF 32-bit MSB relocatable SPARC Version 1
(This is the one.)
# cd cxx
# file osfuns.o
osfuns.o:       ELF 32-bit MSB relocatable SPARC Version 1
(This is a representative; all of the .o files in this directory are ELF 


Torbjorn Granlund wrote:
> "Michael J. Bauer" <mjbauer at> writes:
>   I am attempting to build gmp 4.2.2 from source on a Sunfire V120 running 
>   Solaris 10.  I am finding a build error with a 64-bit build and C++ 
>   support enabled.  I am using gcc and the stock Solaris build tools 
>   (make, ld, ar, ranlib, and so on)
>   Pertinent information:
>   # gcc --version
>   gcc (GCC) 3.4.6
>   # ./configure --prefix=/usr/local/package2 
>   --oldincludedir=/usr/local/package2/include --enable-cxx
>   (The error only happens with C++ support enabled.  The peculiar location 
>   is so I can make a Solaris package; the real install will happen in 
>   /usr/local.)
>   # setenv ABI 64
>   (This error does not happen with ABI 32, but does happen with ABI unset.)
> Please see the manual on how to build GMP; you're not selectign ABI
> correctly.

More information about the gmp-bugs mailing list