amonroy has asked for the wisdom of the Perl Monks concerning the following question:

First I was getting an error during the make:

bash-2.05# perl Makefile.PL LIBS='-L/usr/local/lib' Writing Makefile for Math::GMP bash-2.05# make /opt/SUNWspro/bin/cc -c -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 - +O -DVERSION=\"2.04\" -DXS_VERSION=\"2.04\" -KPIC "-I/exlibris/sfx_v +er/sfx_version_3/app/perl-5.8.6/lib/5.8.6/sun4-solaris/CORE" GMP.c "GMP.xs", line 4: cannot find include file: "gmp.h" "GMP.c", line 91: undefined symbol: mpz_t "GMP.c", line 91: undefined symbol: RETVAL "GMP.xs", line 69: warning: improper pointer/integer combination: op " +=" "GMP.xs", line 70: warning: implicit function declaration: mpz_init_se +t_str "GMP.xs", line 70: cannot dereference non-pointer type "GMP.c", line 111: undefined symbol: mpz_t "GMP.c", line 111: undefined symbol: RETVAL "GMP.xs", line 80: warning: improper pointer/integer combination: op " +=" "GMP.xs", line 81: cannot dereference non-pointer type "GMP.c", line 129: undefined symbol: mpz_t "GMP.c", line 129: undefined symbol: n "GMP.c", line 133: syntax error before or at: ) "GMP.xs", line 90: warning: implicit function declaration: mpz_clear "GMP.xs", line 90: cannot dereference non-pointer type "GMP.xs", line 91: warning: improper pointer/integer combination: arg +#1 "GMP.c", line 143: cannot recover from previous errors cc: acomp failed for GMP.c make: *** [GMP.o] Error 2

So I downloaded the source of the same version of gmp that I have and copied gmp.h from there to the directory where I was compiling Math::GMP. That allowed me to do the make

cp /exlibris/sfx_ver/src-v3/gmp-4.1.4/gmp.h . make /opt/SUNWspro/bin/cc -c -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 - +O -DVERSION=\"2.04\" -DXS_VERSION=\"2.04\" -KPIC "-I/exlibris/sfx_v +er/sfx_version_3/app/perl-5.8.6/lib/5.8.6/sun4-solaris/CORE" GMP.c Running Mkbootstrap for Math::GMP () chmod 644 GMP.bs rm -f blib/arch/auto/Math/GMP/GMP.so LD_RUN_PATH="" /opt/SUNWspro/bin/cc -G -L/usr/lib -L/usr/ccs/lib -L/o +pt/SUNWspro/prod/lib GMP.o -o blib/arch/auto/Math/GMP/GMP.so chmod 755 blib/arch/auto/Math/GMP/GMP.so cp GMP.bs blib/arch/auto/Math/GMP/GMP.bs chmod 644 blib/arch/auto/Math/GMP/GMP.bs Manifying blib/man3/Math::GMP.3

But now I get an error during the make test!

bash-2.05# make test PERL_DL_NONLAZY=1 /exlibris/sfx_ver/sfx_version_3/app/perl/bin/perl "- +MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch' +)" t/*.t t/gmppm....Can't load '/exlibris/sfx_ver/sfx_version_3/app/.cpan/build +/Math-GMP-2.04/blib/arch/auto/Math/GMP/GMP.so' for module Math::GMP: +ld.so.1: /exlibris/sfx_ver/sfx_version_3/app/perl/bin/perl: fatal: re +location error: file /exlibris/sfx_ver/sfx_version_3/app/.cpan/build/ +Math-GMP-2.04/blib/arch/auto/Math/GMP/GMP.so: symbol __gmpz_init_set_ +str: referenced symbol not found at /exlibris/sfx_ver/sfx_version_3/a +pp/perl-5.8.6/lib/5.8.6/sun4-solaris/DynaLoader.pm line 230. at t/gmppm.t line 7 Compilation failed in require at t/gmppm.t line 7. BEGIN failed--compilation aborted at t/gmppm.t line 7. t/gmppm....dubious + Test returned status 255 (wstat 65280, 0xff00) FAILED--1 test script could be run, alas--no output ever seen make: *** [test_dynamic] Error 2

This is my environment:
SunOS lakeview 5.9 Generic sun4u sparc SUNW,Ultra-80
perl 5.8.6
cc: Forte Developer 7 C 5.4 2002/03/09
GNU Make 3.80

Any ideas? (I wonder if should I try to use my gcc? How can I tell make to use gcc instead of Solaris cc?)

Thanks

Update - Problem solved!

The key is to have GMP compiled from source, using the same compiler as perl and with 32bits binaries.

This is what I did:

1. Downloaded GMP (http://www.swox.com/gmp/) and compiled it.

2. Run Makefile.PL pointing to the recently compiled GMP.

Replies are listed 'Best First'.
Re: Problem installing Math::GMP
by edan (Curate) on Jan 16, 2005 at 09:43 UTC

    How can I tell make to use gcc instead of Solaris cc?

    perl Makefile.PL CC=/path/to/gcc
    --
    edan

      I downloaded the rpm package from http://dag.wieers.com/rpm/packages/perl-Math-GMP/ Ran rpm -ivh perl-Math-GMP-2.04-1.2.el5.rf.x86_64.rpm to install the package. This installed cleanly.