in reply to problem with Math::GMP

This is a Perl XS wrapper (C code) that uses the GNU MP library. First read Practical Guide to Compiling C-based modules under Win32 because your C compiler environment is screwed. You will know it is not FUBAR when you reduce your error messages to:

C:\Math-GMP-2.03>perl Makefile.PL Checking if your kit is complete... Looks good Note (probably harmless): No library found for '-lgmp' Writing Makefile for Math::GMP

At this stage we are missing the gmp library. This error is not harmless! GMP is not easy to compile on Win32. Go to http://www.cs.nyu.edu/exact/core/gmp/. You can get binaries for the .lib you will need here but they did not work for me. You will probably need to go the patch route, compile within VCC....

cheers

tachyon

Replies are listed 'Best First'.
Re^2: problem with Math::GMP
by Nalina (Monk) on Jun 17, 2004 at 03:40 UTC
    Thanks for the reply

    I followed all the steps given in Practical Guide to Compiling C-based modules under Win32, also downloaded files from http://www.cs.nyu.edu/exact/core/gmp/.

    I still got some errors

    I got the following message when i ran makefile.pl

    C:\downloads\Math-GMP-2.03>perl makefile.pl

    Checking if your kit is complete...

    Looks good

    Writing Makefile for Math::GMP

    With nmake I got an error as follows,

    C:\downloads\Math-GMP-2.03>nmake

    Microsoft (R) Program Maintenance Utility Version 7.10.3077

    Copyright (C) Microsoft Corporation. All rights reserved.

    cl -c -nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_ST RICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SY S -DUSE_PERLIO -DPERL_MSVCRT_READFIX -MD -Zi -DNDEBUG -O1 -DVERSION=\"2.03\" -DXS_VERSION=\"2.03\" "-IC:\Perl\lib\CORE" GMP.c

    GMP.c

    c1 : warning C4349: /Gf is deprecated and will not be supported in future versio ns of Visual C++; remove /Gf or use /GF instead Running Mkbootstrap for Math::GMP ()

    C:\Perl\bin\perl.exe -MExtUtils::Command -e chmod 644 GMP.bs

    link -out:blib\arch\auto\Math\GMP\GMP.dll -dll -nologo -nodefaultlib -de bug -opt:ref,icf -libpath:"C:\Perl\lib\CORE" -machine:x86 GMP.obj C:\Perl\li b\CORE\perl58.lib C:\Perl\lib\CORE\gmp.lib C:\Perl\lib\CORE\oldnames.lib C:\Perl \lib\CORE\kernel32.lib C:\Perl\lib\CORE\user32.lib C:\Perl\lib\CORE\gdi32.lib C: \Perl\lib\CORE\winspool.lib C:\Perl\lib\CORE\comdlg32.lib C:\Perl\lib\CORE\advap i32.lib C:\Perl\lib\CORE\shell32.lib C:\Perl\lib\CORE\ole32.lib C:\Perl\lib\CORE \oleaut32.lib C:\Perl\lib\CORE\netapi32.lib C:\Perl\lib\CORE\uuid.lib C:\Perl\li b\CORE\wsock32.lib C:\Perl\lib\CORE\mpr.lib C:\Perl\lib\CORE\winmm.lib C:\Perl\l ib\CORE\version.lib C:\Perl\lib\CORE\odbc32.lib C:\Perl\lib\CORE\odbccp32.lib C: \Perl\lib\CORE\msvcrt.lib -def:GMP.def

    Creating library blib\arch\auto\Math\GMP\GMP.lib and object blib\arch\auto\Ma th\GMP\GMP.exp

    C:\Perl\bin\perl.exe -MExtUtils::Command -e chmod 755 blib\arch\auto\Mat h\GMP\GMP.dll

    C:\Perl\bin\perl.exe -MExtUtils::Command -e cp GMP.bs blib\arch\auto\Mat h\GMP\GMP.bs

    C:\Perl\bin\perl.exe -MExtUtils::Command -e chmod 644 blib\arch\auto\Mat h\GMP\GMP.bs

    with nmake test,

    C:\downloads\Math-GMP-2.03>nmake test

    I got a messge asking whether the following is ok

    'The procedure entry point__gmpz_sqrt could not be located in the dynamic link library gmp.dll'

    and also an error saying 'Microsoft (R) Program Maintenance Utility Version 7.10.3077 Copyright (C) Microsoft Corporation. All rights reserved. C:\Perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'bl ib\lib', 'blib\arch')" t\gmppm.t t\gmppm....Can't load 'C:\downloads\Math-GMP-2.03\blib\arch/auto/Math/GMP/GMP.dl l' for module Math::GMP: load_file:The specified procedure could not be found at C:/Perl/lib/DynaLoader.pm line 229. 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 NMAKE : fatal error U1077: 'C:\Perl\bin\perl.exe' : return code '0x2' Stop.

    What do I do now?

    Thanks & regards

    Nalina
      http://crazyinsomniac.perlmonk.org/perl/ppm/5.8/Math-GMP.ppd

      How did you build your underlying GMP library. It looks like you have probably built/got a dynamic gmp.lib and tried to link against that. See this for an explanation of the difference between static and dynamic linking. But in essence you need to link to a static gmp.lib (which contains all the machine code) so that you can build a gmp.dll (for Perl) that can be dynamically loaded and has all the machine code (aka entry points) it needs.

      If this is for Net::SSH::Perl it *may* be possible to simple s/Math::GMP/Math::BigInt/g as these modules are *almost* totally compatible.

      Math::GMP was designed to be a drop-in replacement both for Math::BigInt and for regular integer arithmetic.

      That may be an easier way to do it for you. If your SSH needs are modest there is plink.exe (google for Putty.exe) which gives you a command line ssh tool you might just be able to control through the shell.

      cheers

      tachyon

        Yes this is for Net::SSH::Perl. I installed GMP::BigInt and replaced Math::GMP with Math::BigInt in all the modules. But still when I execute the following script

        use Net::SSH::Perl;

        $host="xxx.xxx.xxx.xxx";

        $username = "user";

        $pass = "pass";

        $ssh=Net::SSH::Perl->new($host, debug=>1, cipher=>'DES', port =>22);

        $ssh->login($username, $pass);

        my(@arra) = $ssh->cmd("?");

        print "output: $arra\n";

        I got this message with an error

        $ perl cisco_pix.pl

        Nalina: Reading configuration data /home/Administrator/.ssh/config

        Nalina: Reading configuration data /etc/ssh_config

        Nalina: Connecting to xxx.xxx.xxx.xxx, port 22.

        Nalina: Remote protocol version 1.5, remote software version Cisco-1.25

        Nalina: Net::SSH::Perl Version 1.25, protocol version 1.5.

        Nalina: No compat match: Cisco-1.25.

        Nalina: Connection established.

        Nalina: Waiting for server public key.

        Nalina: Received server public key (768 bits) and host key (2048 bits).

        Nalina: Host 'xxx.xxx.xxx.xxx' is known and matches the host key.

        Undefined subroutine &Math::GMP::sizeinbase_gmp called at /usr/lib/perl5/site_pe rl/5.8.2/Net/SSH/Perl/Util/RSA.pm line 30.



        I am using Cygwin bash shell.

        What is the compatible function for sizeinbase_gmp in BigInt?

        Regards

        Nalina