http://www.perlmonks.org?node_id=770192

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

In Perl5.6.1 version I got below error while using the SFTP package. Error Math::BigInt: couldn't load specified math lib(s), fallback to Math::BigInt::FastCalc at /usr/lib/perl5/site_perl/5.6.1/Crypt/DH.pm line 6 In perl5.8.0 version,The SFTP is working.

Replies are listed 'Best First'.
Re: SFTP Protocal
by syphilis (Archbishop) on Jun 10, 2009 at 05:39 UTC
    It's just a warning .... in fact really no more than an fyi.
    If Math::BigInt::GMP (which is much faster than Math::BigInt::FastCalc) can be found, then it will be used. Otherwise the slower Math::BigInt::FastCalc will be used, and the message you've quoted will appear.

    I'm actually not sure if it's Math::BigInt::GMP or Math::BigInt::Pari (or both) that's being sought before resorting to Math::BigInt::FastCalc but line 6 of DH.pm would make that clear. (What does line 6 contain ?)

    If you like to install the missing library, you'll get a faster SFTP and that message won't appear.

    Cheers,
    Rob
      The 6th line of DH.pm has use Math::BigInt lib => "GMP,Pari"; My program got segmentation fault after gettting the below error . Herewith I have mentioned the debug log of my program ,Please look at this Reading configuration data /root/.ssh/config Reading configuration data /etc/ssh_config Allocated local port 1023. Connecting to 192.168.1.130, port 22. Remote protocol version 2.0, remote software version OpenSSH_4.3p2 Debian-9 Math::BigInt: couldn't load specified math lib(s), fallback to Math::BigInt::FastCalc at /usr/lib/perl5/site_perl/5.6.1/Crypt/DH.pm line 6 Net::SSH::Perl Version 1.34, protocol version 2.0. No compat match: OpenSSH_4.3p2 Debian-9. Connection established. Sent key-exchange init (KEXINIT), wait response. Algorithms, c->s: 3des-cbc hmac-sha1 none Algorithms, s->c: 3des-cbc hmac-sha1 none Segmentation fault . I think that In perl5.6.0 , doesn't has GMP and Pari files .
        The 6th line of DH.pm has use Math::BigInt lib => "GMP,Pari";

        That means it will try to use Math::BigInt::GMP. If that fails it will try to use Math::BigInt::Pari. If that also fails it will use Math::BigInt::FastCalc and print out the message.

        I would be surprised if installing Math::BigInt::GMP would fix the segfault. I would think the segfault is being caused by a different issue - but I don't know what that issue is.

        I think that In perl5.6.0 , doesn't has GMP and Pari files.

        Without GMP and Pari, I don't think you would have been able to get Net::SSH::Perl to install - but I've never used Net::SSH::Perl, and am no expert.
        Instead, I use Net::SSH2 - which needs the libssh2 library.
        I *think* Net::SFTP also provides good mileage on linux - though I've never used it either, as I'm on Windows.

        Cheers,
        Rob
        We could help you more if you can post some code. Meanwhile, GMP would require The GNU MP Bignum Library. Do you have libgmp installed? Ordinarily, I would say that Math::Pari wasn't working, but it seems to be working. Check that you have all the dependencies installed. If you need some help posting some code, just ask-:).
Re: SFTP Protocal
by codeacrobat (Chaplain) on Jun 10, 2009 at 05:58 UTC
    I always found Net::SFTP hard to setup and sometimes very slow. You may want to consider Net::SFTP::Foreign, which wraps around the ssh commandline tool. Here you don't need the fancy math libraries.

    print+qq(\L@{[ref\&@]}@{['@'x7^'!#2/"!4']});