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

Hi Rob,

thanks for your suggestions. I tried both building libgmp as a shared library (which didn't solve the problem) and reverting to libgmp 4.1.4 (which did).

The reference to cc shouldn't be a problem, as /usr/bin/cc is a logical link to /usr/bin/gcc-4.0 (as is /usr/bin/gcc).

The -bundle switch tells ld to create a bundle file:

-bundle Produce a Mach-O bundle format file. The headers are pl +aced in the first segment. All sections are placed in their pro +per seg- ments and they are padded to the segment alignment. Thi +s has a file type of MH_BUNDLE.

Thank you very much for your helpful suggestions!

Regards,

  Peter.

Replies are listed 'Best First'.
Re^8: Math::GMP won't install on Darwin
by syphilis (Archbishop) on Jul 18, 2006 at 07:49 UTC
    I tried both building libgmp as a shared library (which didn't solve the problem) and reverting to libgmp 4.1.4 (which did).

    Thanks for the feedback.

    Did you try forcing Math::GMP to link directly to the shared library (rather than linking to the import library) ? I gave that a fair chance of working ... on a hunch, more than anything else :-)

    Mind you, whilst I know that gcc can link directly to shared libraries on Win32 and Linux, I have no such knowledge regarding gcc on Macs. And, of course I've got no right to press you like this for details ... so please feel free to ignore.

    Cheers,
    Rob

      Hi Rob,

      after compiling libgmp as a shared library, I removed the static (.a) version, so probably the linker didn't have another choice than to use the shared version. If you think it makes sense, I'll do some more testing on a second system tomorrow - I don't want to touch the first one anymore, being glad to finally have it doing what it's supposed to :-)

      I'm not going to ignore this, considering that 1. you helped me out with a working solution and 2. I'm interested in getting a stable module as well, using current rather than outdated library versions. So whatever I can do (not much, probably, not being a C hacker myself), I'll try.

      Thanks again and best regards,

        Peter.

        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