in reply to Re^9: Math::GMP won't install on Darwin
in thread Math::GMP won't install on Darwin

If there's no 'libgmp.a' for the linker to find then one would expect that it's finding the shared library. However, on my Win32 box, the shared library that gets created is 'libgmp-3.dll' so I need to change the 'LIBS' entry in the Math::GMP 'Makefile.PL' from
'LIBS' => ['-lgmp'],
to:
'LIBS' => ['-lgmp-3'],
Probably worth checking out the name of the GMP shared library and statisfying yourself that '-lgmp' will allow the linker to find it. If your shared library is named 'libgmp-3.so' then '-lgmp' should not enable the linker to find it ... in which case the linker is probably still finding a 'libgmp.a' somewhere.

On Win32 I also need to specify the location of the shared library, so the 'LIBS' entry actually becomes something like:
'LIBS' => ['-L/my_dll_folder -lgmp-3'],
However, if your gmp shared library is in a location where the linker looks by default, then you won't have to bother with the '-L' switch.

Don't be too stressed about getting this sorted out in a hurry ... it could yet be nothing more than a wild goose chase :-)

Cheers,
Rob

Replies are listed 'Best First'.
Re^11: Math::GMP won't install on Darwin
by peckel (Initiate) on Jul 19, 2006 at 09:19 UTC
    Hi Rob,

    this one turned out to be harder than expected.

    First of all, I have to correct myself. While I did a ./configure --disable-static --enable-shared for gmp-4.2.1, I didn't check on the results, which was neglegance on my part - there were none. There is a problem with libgmp's configure script, which prevents shared libraries from being built, and silently falls back to static. Duh.

    After upgrading libtool (which didn't resolve anything), I found the following patch here, which immediately solves the problem:

    --- 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 archive_cmds_need_lc=no case "$host_os" in rhapsody* | darwin1.[012])

    Now that the shared library has been built, everything works fine for Math::GMP without further intervention, just as you expected.

    dailuaine:~/Documents/Develop/Math-GMP-2.04 pete$ perl Makefile.PL Writing Makefile for Math::GMP dailuaine:~/Documents/Develop/Math-GMP-2.04 pete$ make gcc -c -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasin +g -pipe -Wdeclaration-after-statement -I/usr/local/include -I/opt/loc +al/include -O3 -DVERSION=\"2.04\" -DXS_VERSION=\"2.04\" "-I/usr/lo +cal/lib/perl5/5.8.8/darwin-2level/CORE" GMP.c Running Mkbootstrap for Math::GMP () chmod 644 GMP.bs rm -f blib/arch/auto/Math/GMP/GMP.bundle LD_RUN_PATH="/usr/local/lib" env MACOSX_DEPLOYMENT_TARGET=10.3 cc -bu +ndle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib GMP. +o -o blib/arch/auto/Math/GMP/GMP.bundle \ -lgmp \ chmod 755 blib/arch/auto/Math/GMP/GMP.bundle 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 dailuaine:~/Documents/Develop/Math-GMP-2.04 pete$ make test PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" " +test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/gmppm....ok + All tests successful. Files=1, Tests=350, 1 wallclock secs ( 0.21 cusr + 0.04 csys = 0.25 + CPU)

    Thanks again for your help. It seems that the problem is on the libgmp side, so I'll send the problem description and the workaround to the developers.

    Best regards,

      Peter.