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

I have 2 machines (OS X 10.4.11, if it matters) on which I have installed Net::SFTP. On one machine my script works fine but on the other I get the error:

dyld: lazy symbol binding failed: Symbol not found: ___gmpz_init_set_str Referenced from: /Library/Perl/5.8.6/darwin-thread-multi-2level/auto/Math/BigInt/GMP/GMP.bundle Expected in: dynamic lookup

Apparently there is some kind of problem with the GMP module that does not exist on the other machine. Can someone help me shoot this bug? TIA.

Replies are listed 'Best First'.
Re: Net::SFTP and the GMP pre-req.
by derby (Abbot) on May 05, 2008 at 18:42 UTC
Re: Net::SFTP and the GMP pre-req.
by Corion (Patriarch) on May 05, 2008 at 17:05 UTC

    Normally, I charge per hour when consulting for bug shooting. But I'm all out of bullets for today and the next shipment of ammunition isn't due until in two weeks, so I'll let you in on the Great Secret of Bug Hunting.

    1. Get a list of differences between machines
    2. Eliminate one difference
    3. Check whether problem still persists
    4. If problem still persists, continue with step 2
    5. Done

    You have already identified one key difference between the two machines. GMP seems to be different between the two machines. Eliminate that difference by making the two versions identical. Preferrably by transplanting the working version onto the nonworking machine.

      There's the rub. As far as I can tell there is no obvious difference except that it doesn't work. Otherwise I wouldn't be here asking for help. As a rank novice with respect to CPAN and installing libraries, I have no clue as to where to look. I also have no clue how to clone the working libraries on to the non-working machine. It seems to me if I knew how, then cloning the perl libraries should solve the problem, right (I am assuming this is some kind of library install glitch)?

        How do you expect us to discern the nature of the problem between the two machines from the information you've given us? Really - do you expect me to bring out the chicken bones, throw them on a printout of your post and then tell you that the I-Ching points to line 23 in your code? I can do that, of course, and maybe it helps you to know that the root of your problem lies in line 23.

        Debugging is more craft than art, and I've already told you what you need to do to isolate the cause and eliminate the error. If you don't know who installed the GMP library, or whether the machines should even be identical or where files are on the machines, I can only recommend that you summon the administrator of the machines by whatever ritual is customary and beseech him to investigate, as spawn of his parent-hive did for your parents and spawn of his grand-hive did for your grandparents, since eons ago.

        You can also ask Perl as to how it is configured:

        perl -V

        This will tell you lots and lots about the Perl on each machine. If these things differ, you have one more point of attack. Also, maybe consider checking that the installed versions of GMP are identical:

        perl -MMath::GMP -e "die $Math::GMP::VERSION"
Re: Net::SFTP and the GMP pre-req.
by syphilis (Archbishop) on May 05, 2008 at 23:30 UTC
    Symbol not found: ___gmpz_init_set_str

    That looks quite odd to me. Whilst the gmp library defines mpz_init_set_str it does *not*, afaik, define gmpz_init_set_str - nor, to the best of my knowledge, has it ever done so.

    My guess is that the problem therefore might lie with the Math::BigInt::GMP module. Are they the same version of that module in both cases ? If so, where does Math::BigInt::GMP find __gmpz_init_set_str on the machine where things work fine ?

    Cheers,
    Rob
    Update: Hmmm ... in gmp.h:
    #define mpz_init_set_str __gmpz_init_set_str
    I'm now not at all sure about what's going on - not that I ever really was :-)
    It still looks odd to me that you're getting an error for that particular symbol. Does Math::BigInt::GMP explicitly call __gmpz_init_set_str ? If so, shouldn't it be calling mpz_init_set_str instead ?
    Is the gmp library on the problem machine functional ? (Can you run C programs that use it, and can you build Math::GMP against it ?)
    Btw, I would also prefer to use Net::SSH2, as suggested elsewhere in this thread.
      FWIW, I encountered the same problem when I installed Math::BigInt::GMP improperly. I tried to install it without having libgmp3 installed. When it failed (unable to find gmp.h) I installed the library, then did another 'make' and 'make install'. It broke (unknown symbol) until I went back, did 'perl Makefile.PL' to remake the makefile, then reinstalled (this time, with 'make test' first, like I should have done the first time). Without Math::BigInt::GMP, Net::SSH::Perl was really slow, taking over a minute to connect. Net::SFTP::Foreign supports password authentication now, with the latest versions (albeit as an experimental feature). That's probably the only reason I didn't use it before.
Re: Net::SFTP and the GMP pre-req.
by Anonymous Monk on May 06, 2008 at 08:02 UTC
    How did you install the module? Did the test suit pass?

Re: Net::SFTP and the GMP pre-req.
by salva (Canon) on May 07, 2008 at 08:05 UTC