Problems with Math::GMP on Mac OS X

Peter Eckel Peter.Eckel at
Wed Jul 19 11:54:38 CEST 2006


in the process of installing Math::GMP on Mac OS X, I ran into a number of problems. 

System version is 10.4.7, XCode 2.3, gcc 4.0.1. I'm trying to build libgmp-4.2.1 from source and Math::GMP 2.0.4.

First I used a plain ./configure - make - make check -- make install cycle on libgmp-4.2.1, which ran without problems. However, building Math::GMP failed with the following error message:

Checking if your kit is complete...
Looks good
Writing Makefile for Math::GMP
cp lib/Math/ blib/lib/Math/
AutoSplitting blib/lib/Math/ (blib/lib/auto/Math/GMP)
/usr/local/bin/perl /usr/local/lib/perl5/5.8.8/ExtUtils/xsubpp  -typemap /usr/local/lib/perl5/5.8.8/ExtUtils/typemap -typemap typemap  GMP.xs > GMP.xsc && mv GMP.xsc GMP.c
gcc -c   -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -I/opt/local/include -O3   -DVERSION=\"2.04\" -DXS_VERSION=\"2.04\"  "-I/usr/local/lib/perl5/5.8.8/darwin-2level/CORE"   GMP.c
Running Mkbootstrap for Math::GMP ()
chmod 644
rm -f blib/arch/auto/Math/GMP/GMP.bundle
env MACOSX_DEPLOYMENT_TARGET=10.3 cc  -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib GMP.o  -o blib/arch/auto/Math/GMP/GMP.bundle      \
   -lgmp        \
/usr/bin/ld: /usr/local/lib/libgmp.a(mode1o.o) has local relocation entries in non-writable section (__TEXT,__text)
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/Math/GMP/GMP.bundle] Error 1
  /usr/bin/make  -- NOT OK
Running make test
  Can't test without successful make
Running make install
  make had returned bad status, install seems impossible
Failed during this command:
  CHIPT/Math-GMP-2.04.tar.gz                   : make NO

After talking to syphilis on Perl Monks, I tried two successful workarounds. First, go back to libgmp-4.1.4, which did the trick perfectly. Second, building libgmp-4.2.1 as a shareable library. When I tried the latter, I ran into another problem. Building the shareable library was only possible after the following patch to the configure script:

--- configure.old       2006-07-19 11:01:44.000000000 +0200
+++ configure   2006-07-19 10:49:59.000000000 +0200
@@ -12547,7 +12547,7 @@
     darwin* | rhapsody*)
-    if test "$GXX" = yes ; then
+    if test "$GCC" = yes ; then
       case "$host_os" in
       rhapsody* | darwin1.[012])

Without this patch, the shareable library wouldn't build in spite of the --enable-shared option, since configure detected that libtool couldn't build shareable libraries.

Using the shareable library created that way, Math::GMP works fine as well.

Best regards, 


More information about the gmp-bugs mailing list