0

I am having a devil of a time getting additional modules in Strawberry Perl to load. I have a small script sent to me by an acquaintance. I can get everything to load properly, except for a single item. Below are the messages:

Note: This is on Windows 10 Pro x64 v1903.

Can't locate loadable object for module Math::GMPz::Random.pm Line 3, and repeats for line 12.

The module, Ramdom.pm, is in the correct location: C:\Strawberry\Perl\Lib\Math\Random. It also exists at C:\Strawberry\Perl\Lib\Math\GMPz.

GMPz line 3 is:

use Math::GMPz::Random;

Random.pm line 12 is:

DynaLoader::bootstrap Math::GMPz::Random $VERSION;

I must be missing something. I just do not know what this something may be.

storm5510
  • 23
  • 3
  • 3
    How did you install `Math::GMPz`? Did the tests pass? – clamp Jan 02 '20 at 23:27
  • if you're confident it's been installed okay - i would try manually adding the path in the @INC that Perl loops over then running the script - have a read through here and see if it's any help to you - https://perlmaven.com/how-to-change-inc-to-find-perl-modules-in-non-standard-locations – Taylor Goodall AU Jan 03 '20 at 00:49
  • 1
    The error signifies an incorrectly-installed module. How was it installed? – ikegami Jan 03 '20 at 02:45

3 Answers3

2

This means that there is an error loading a DLL or shared library required by Math::GMPz::Random.

In this case Math::GMPz requires the Gnu Multiple Precision Library.

See this perlmonks article for more discussion.

daotoad
  • 26,689
  • 7
  • 59
  • 100
0

How did I install Math::Gmpz? CPAN is the short answer. The problem was that I really did not know which option to use. There is "get." There is also "make." Then "test" and "install." I had one chance in four of choosing the right one.

GNU Multiple Precision Library. I will take a look at this.

storm5510
  • 23
  • 3
  • 1
    Normally this kind of reply should be either written as a comment on a particular answer or as a reply in the same comment section you are replying too. Don't sweat it now--nowing which of the 500 different places you're supposed to write responses in takes a while. – daotoad Jan 06 '20 at 17:02
  • The classic, built in CPAN client does a lot and can be confusing, especially if you aren't used to the `make; make test; make install;` workflow that it sits on top of. Once you've passed this hurdle, I recommend checking out `cpanm` at https://metacpan.org/pod/App::cpanminus -- it's a simplified CPAN client that makes life much easier. Add `local::lib` and `cpanfile`s to your toolkit--both are searchable on metacpan--and you'll be cruising along. – daotoad Jan 06 '20 at 17:08
  • Everything I am seeing here is for a Linux system. Perhaps Perl was never intended to be used in a Windows environment despite the effort of many to make it so. I am unclear as to whether I will continue this attempt. – storm5510 Jan 07 '20 at 00:07
  • it can really feel that way sometimes. FWIW, I used Perl to develop a commercial GUI app that was built for Windows systems. So it *is* possible. I haven't actually done anything serious on a Windows system for 10 years, so my recollections are a bit fuzzy. IIRC, you are going to want to look at using MinGW and MSYS to build any libraries you need. Once you have that set up and working, instead of libgmp.so, you'll be building libgmp.dll, but otherwise it should be pretty much the same as on linux. – daotoad Jan 07 '20 at 00:21
  • You might find this link on building GMP for windows handy: https://gmplib.org/list-archives/gmp-discuss/2013-July/005384.html – daotoad Jan 07 '20 at 00:27
0

I discovered Strawberry has a CpanMinus application packaged with it. It is far simpler and seems to work alright, with one exception. First on my list was "Timer::Runtime." This one fails to install.

Math::Bigfloat, Math::Prime::Util, File::Slurp, Bignum, and Math::GMPz, all installed without problems. A couple of these were already installed and were shown as up-to-date. Someone had sent me a small test script to run and everything above was listed.

I do not know where it places these files or if they are included in a list which Perl reads to determine if they are present.

storm5510
  • 23
  • 3