error compiling sage: pari and libgmp mismatch - fixed

5 views
Skip to first unread message

lciti

unread,
Jun 9, 2008, 11:57:54 AM6/9/08
to sage-support
Hi,
I just installed sage in the main node of a cluster. I got an error
while it was building pari.
The error was
"skipping incompatible /home/lciti/opt/sage-3.0.2/local/lib/libgmp.so
when searching for -lgmp"
I discovered that despite the machine is a 2x Dual Xeon Quad core, gmp
was compiled as it
was x32 while pari expected a x86_64 library.
To fix it I did the following after the error message:

./sage -sh # to enter a shell with the proper variables set
cd /tmp/
tar jxvf ~/opt/sage-3.0.2/spkg/standard/gmp-4.2.2.spkg
cd gmp-4.2.2
nano spkg-install # or vi, or whichever editor you like
# look for the line with ./configure (line 192 in the version I have)
and append: --build=$(gcc -v 2>&1 | sed -n "s|.*host=\([^[:space:]]*
\).*|\1|p")
./spkg-install
exit

then rerun make to resume the compilation.
I hope this fix can be useful for others facing the same problem.
Regards,
Luca

-------------------------------------
$ uname -a
Linux bcisr.essex.ac.uk 2.6.9-55.0.2.ELsmp #1 SMP Tue Jun 26 14:14:47
EDT 2007 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/issue
CentOS release 4.6 (Final)
Kernel \r on an \m

$ gcc -v
Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/usr/share/info --enable-shared --enable-threads=posix --
disable-checking --with-system-zlib --enable-__cxa_atexit --disable-
libunwind-exceptions --enable-java-awt=gtk --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-9)

mabshoff

unread,
Jun 9, 2008, 1:22:14 PM6/9/08
to sage-support
On Jun 9, 8:57 am, lciti <knul...@yahoo.com> wrote:
> Hi,

Hi Luca,

> I just installed sage in the main node of a cluster. I got an error
> while it was building pari.
> The error was
> "skipping incompatible /home/lciti/opt/sage-3.0.2/local/lib/libgmp.so
> when searching for -lgmp"
> I discovered that despite the machine is a 2x Dual Xeon Quad core, gmp
> was compiled as it
> was x32 while pari expected a x86_64 library.
> To fix it I did the following after the error message:
>
> ./sage -sh # to enter a shell with the proper variables set
> cd /tmp/
> tar jxvf ~/opt/sage-3.0.2/spkg/standard/gmp-4.2.2.spkg
> cd gmp-4.2.2
> nano spkg-install # or vi, or whichever editor you like
> # look for the line with ./configure (line 192 in the version I have)
> and append: --build=$(gcc -v 2>&1 | sed -n "s|.*host=\([^[:space:]]*
> \).*|\1|p")
> ./spkg-install
> exit
>
> then rerun make to resume the compilation.
> I hope this fix can be useful for others facing the same problem.

It very much looks like config.guess on your box misidentifies the
Xeon Quad as a non-64 bit CPU. Can you post the output from
config.guess, cat /proc/cpuinfo and the relevant portion from
"configure", i.e. where the CPU is identified?

The fix you posted above works around the problem, but it does not
solve it since I believe you end up with a gmp compiled with the
generic C sources which would be suboptimal to say the least.

> Regards,
> Luca

Cheers,

Michael

lciti

unread,
Jun 10, 2008, 10:55:09 AM6/10/08
to sage-support
Hi Michael,
thank you for your reply.
I think it is something related to gmp. It is the only one that falls
in this error.
After the fix it gets configured for a x86_64 machine and not for a
core duo
(and as you said it is probably suboptimal) but at least not as a
generic i386,
that would be (besides suboptimal) also uncompatible with pari that
gets
compiled for x86_64.
I attach all the info you requested and some more I think useful.
It is a big bunch of data I hope it is still readable.
The line "Do we have a Core2 CPU?... No" looks weird as well as maybe
"Patching gmp-h.in".
The line "config.status: linking ./mpn/generic/add.c to mpn/
add.c" (and similar)
after the patch become s."... /mpn/x86_64/add.c to mpn/add.c".
Thanks again.
Cheers,
Luca



oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

part of install.log concerning the configuration of gmp (before the
fix):

****************************************************
****************************************************
GCC Version
gcc -v
Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/usr/share/info --enable-shared --enable-threads=posix --
disable-checking --with-system-
zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-
java-awt=gtk --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-9)
****************************************************
Patching gmp-h.in (fixes OSX 10.5 issues and gcc 4.3 problems)
Do we have a Core2 CPU?... No
Moving .asm files that are to be replaced to .asm.disabled ...
Copying new .asm and x86_64-defs.m4 files ...
Copying new gmp-mparam.h...
Done.
You can now go to /home/lciti/opt/sage-3.0.2/spkg/build/gmp-4.2.2/src
and configure/make/make_check as usual.
Fast gcd patch:
Moving files that are to be replaced to *.orig ...
Copying new files across...
Done.
checking build system type... pentium3-unknown-linux-gnu
checking host system type... pentium3-unknown-linux-gnu
......
......
config.status: linking ./mpn/generic/add.c to mpn/add.c
config.status: linking ./mpn/generic/add_1.c to mpn/add_1.c
config.status: linking ./mpn/x86/p6/aors_n.asm to mpn/add_n.asm
config.status: linking ./mpn/generic/sub.c to mpn/sub.c
config.status: linking ./mpn/generic/sub_1.c to mpn/sub_1.c
config.status: linking ./mpn/x86/p6/aors_n.asm to mpn/sub_n.asm

oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

part of install.log concerning the configuration of SQLite (and many
others are similar)

****************************************************
****************************************************
GCC Version
gcc -v
Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/usr/share/info --enable-shared --enable-threads=posix --
disable-checking --with-system-
zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-
java-awt=gtk --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-9)
****************************************************
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu

oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

$ grep "host system" ~/opt/sage-3.0.2/install.log
checking host system type... pentium3-unknown-linux-gnu <--- this is
libgmp (before the fix) !
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-redhat-linux-gnu <--- this
is iml
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... (cached) x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... (cached) x86_64-unknown-linux-gnu
checking host system type... (cached) x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu

oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

$ config.guess
x86_64-unknown-linux-gnu

oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 7
model name : Intel(R) Xeon(R) CPU E5430 @ 2.66GHz
stepping : 6
cpu MHz : 2666.840
cache size : 6144 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall
nx lm pni monitor ds_cpl est tm2 cx16 xtpr
bogomips : 5339.36
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:

processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 7
model name : Intel(R) Xeon(R) CPU E5430 @ 2.66GHz
stepping : 6
cpu MHz : 2666.840
cache size : 6144 KB
physical id : 1
siblings : 4
core id : 4
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall
nx lm pni monitor ds_cpl est tm2 cx16 xtpr
bogomips : 5332.83
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:

processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 7
model name : Intel(R) Xeon(R) CPU E5430 @ 2.66GHz
stepping : 6
cpu MHz : 2666.840
cache size : 6144 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall
nx lm pni monitor ds_cpl est tm2 cx16 xtpr
bogomips : 5332.75
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:

processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 7
model name : Intel(R) Xeon(R) CPU E5430 @ 2.66GHz
stepping : 6
cpu MHz : 2666.840
cache size : 6144 KB
physical id : 1
siblings : 4
core id : 5
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall
nx lm pni monitor ds_cpl est tm2 cx16 xtpr
bogomips : 5332.82
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:

processor : 4
vendor_id : GenuineIntel
cpu family : 6
model : 7
model name : Intel(R) Xeon(R) CPU E5430 @ 2.66GHz
stepping : 6
cpu MHz : 2666.840
cache size : 6144 KB
physical id : 0
siblings : 4
core id : 2
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall
nx lm pni monitor ds_cpl est tm2 cx16 xtpr
bogomips : 5332.80
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:

processor : 5
vendor_id : GenuineIntel
cpu family : 6
model : 7
model name : Intel(R) Xeon(R) CPU E5430 @ 2.66GHz
stepping : 6
cpu MHz : 2666.840
cache size : 6144 KB
physical id : 1
siblings : 4
core id : 6
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall
nx lm pni monitor ds_cpl est tm2 cx16 xtpr
bogomips : 5332.81
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:

processor : 6
vendor_id : GenuineIntel
cpu family : 6
model : 7
model name : Intel(R) Xeon(R) CPU E5430 @ 2.66GHz
stepping : 6
cpu MHz : 2666.840
cache size : 6144 KB
physical id : 0
siblings : 4
core id : 3
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall
nx lm pni monitor ds_cpl est tm2 cx16 xtpr
bogomips : 5332.79
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:

processor : 7
vendor_id : GenuineIntel
cpu family : 6
model : 7
model name : Intel(R) Xeon(R) CPU E5430 @ 2.66GHz
stepping : 6
cpu MHz : 2666.840
cache size : 6144 KB
physical id : 1
siblings : 4
core id : 7
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall
nx lm pni monitor ds_cpl est tm2 cx16 xtpr
bogomips : 5332.81
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:

mabshoff

unread,
Jun 10, 2008, 2:59:05 PM6/10/08
to sage-support
On Jun 10, 7:55 am, lciti <knul...@yahoo.com> wrote:
> Hi Michael,

Hi Luca,

> thank you for your reply.

No problem.

> I think it is something related to gmp. It is the only one that falls
> in this error.
> After the fix it gets configured for a x86_64 machine and not for a
> core duo
> (and as you said it is probably suboptimal) but at least not as a
> generic i386,
> that would be (besides suboptimal) also uncompatible with pari that
> gets
> compiled for x86_64.

Yes, but if you set the host manually you get the generic C code which
is bad performance wise.

> I attach all the info you requested and some more I think useful.
> It is a big bunch of data I hope it is still readable.
> The line "Do we have a Core2 CPU?... No" looks weird as well as maybe
> "Patching gmp-h.in".

That has been added by our script since we patch in Core2 optimized
assembly code not in GMP that roughly double the gmpbench score. The
gmp-h.in patch is also harmless since it deals with an inline issue.

Since your CPU is obviously a Core2 we also need to fix the detection
script.

> The line "config.status: linking ./mpn/generic/add.c to mpn/
> add.c" (and similar)
> after the patch become s."... /mpn/x86_64/add.c to mpn/add.c".
> Thanks again.

ok.
Ok.

> checking host system type... x86_64-redhat-linux-gnu       <--- this
> is iml

Ok.

> oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
> oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
> oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
>
> $ config.guess
> x86_64-unknown-linux-gnu

Is that with the config.guess from gmp? What does a "vanilla" gmp
4.2.2 do? I have similar problems with gmp 4.2.2 on a recent Core2
Quad Mac and so have have been unable to fix the issue except by
setting host which obviously is bad for performance.
<SNIP>

Cheers,

Michael

mabshoff

unread,
Jun 10, 2008, 6:20:21 PM6/10/08
to sage-support
Hi Luca,

the problem you are having is discussed at

http://groups.google.com/group/mpir-devel/t/c31f89ed1683d383

You might want to come over and give some feedback since it cuts mw
out of the loop and will hopefully result in a quicker resolution.

Cheers,

Michael

lciti

unread,
Jun 10, 2008, 7:09:19 PM6/10/08
to sage-support
Hi, I'll answer your questions in the thread you suggested.
Reply all
Reply to author
Forward
0 new messages