OS X CPAN Perl module installation issue - perl

I'm trying to install Perl module MediaWiki::API using CPAN on OS X:
sudo cpan MediaWiki::API Password:
Reading '/Users/qazwsx/.cpan/Metadata'
Database was generated on Mon, 13 Jul 2015 20:53:32 GMT
Running install for module 'MediaWiki::API'
Running make for E/EX/EXOBUZZ/MediaWiki-API-0.40.tar.gz
Checksum for /Users/qazwsx/.cpan/sources/authors/id/E/EX/EXOBUZZ/MediaWiki-API-0.40.tar.gz ok
sh: /opt/local/bin/gzip: No such file or directory
Package seems to come without Makefile.PL.
(The test -f "/Users/qazwsx/.cpan/build/EXOBUZZ-iwzBiH/Makefile.PL" returned false.)
Writing one on our own (setting NAME to MediaWikiAPI)
CPAN.pm: Building E/EX/EXOBUZZ/MediaWiki-API-0.40.tar.gz
Writing Makefile for MediaWikiAPI
Writing MYMETA.yml and MYMETA.json
EXOBUZZ/MediaWiki-API-0.40.tar.gz
/usr/bin/make -- OK
'YAML' not installed, will not store persistent state
Running make test
No tests defined for MediaWikiAPI extension.
EXOBUZZ/MediaWiki-API-0.40.tar.gz
/usr/bin/make test -- OK
Running make install
Appending installation info to /Library/Perl/Updates/5.18.2/darwin-thread-multi-2level/perllocal.pod
EXOBUZZ/MediaWiki-API-0.40.tar.gz
/usr/bin/make install -- OK
This is a step of installing Git-Mediawiki (see https://github.com/moy/Git-Mediawiki/wiki/User-manual). However, after all the installation steps, the first git command reports that MediaWiki::API module isn't available:
git pull
Can't locate MediaWiki/API.pm in #INC (you may need to install the MediaWiki::API module) (#INC contains: /Users/qazwsx/WorkSpace-X4430/git/perl /Users/qazwsx/WorkSpace-X4430/git/contrib/mw-to-git /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2/darwin-thread-multi-2level /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at /usr/local/Cellar/git/2.4.1/libexec/git-core/git-remote-mediawiki line 15.
BEGIN failed--compilation aborted at /usr/local/Cellar/git/2.4.1/libexec/git-core/git-remote-mediawiki line 15.
I wonder if my installation method for the Perl module is correct. One thing strikes out as odd is the error
sh: /opt/local/bin/gzip: No such file or directory
I use Homebrew with standard paths, so the gzip binary is at /usr/local/bin/gzip. But I don't know if or where to fix it. It appears to be some search paths issue but I don't know how to fix it.

There might be something wrong with your ~/.cpan, the configuration for CPAN. You can try
# Re-install cpan
brew doctor
brew update
brew install cpan
# Remove or back up ~/.cpan
mv ~/.cpan ~/.cpan.bak
# Re-initialize ~/.cpan
cpan config
# Try installing the Perl module again
sudo cpan install MediaWiki::API

Related

Not able to install GD module in Perl

I am not able to install GD module in PErl.
I have done CPAN GD but that gives me error:
Reading '/home/harsh/.cpan/Metadata'
Database was generated on Mon, 28 Sep 2020 02:17:03 GMT
Running install for module 'GD'
Checksum for /home/harsh/.cpan/sources/authors/id/R/RU/RURBAN/GD-2.73.tar.gz ok
'YAML' not installed, will not store persistent state
Configuring R/RU/RURBAN/GD-2.73.tar.gz with Makefile.PL
Notice: Type perl Makefile.PL -h for command-line option summary.
Package gdlib was not found in the pkg-config search path.
Perhaps you should add the directory containing `gdlib.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gdlib' found
at Makefile.PL line 451.
*** can not find package gdlib
*** check that it is properly installed and available in PKG_CONFIG_PATH
at Makefile.PL line 451.
Warning: No success on command[/home/harsh/perl5/perlbrew/perls/perl-5.28.0/bin/perl Makefile.PL]
RURBAN/GD-2.73.tar.gz
/home/harsh/perl5/perlbrew/perls/perl-5.28.0/bin/perl Makefile.PL -- NOT OK
and whenever I run my file it gives:
Can't locate GD.pm in #INC (you may need to install the GD module) (#INC contains: /home/harsh/perl5/perlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0/x86_64-linux /home/harsh/perl5/perlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0 /home/harsh/perl5/perlbrew/perls/perl-5.28.0/lib/5.28.0/x86_64-linux /home/harsh/perl5/perlbrew/perls/perl-5.28.0/lib/5.28.0) at generate_feedburner_graph.perl line 18.
BEGIN failed--compilation aborted at generate_feedburner_graph.perl line 18.
Also i have seen this solution of running sudo apt-get install libgd2-xpm-dev but this says
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libgd2-xpm-dev
I am using Ubuntu 18.04
You need to install libgd-dev:
$ sudo apt-get install libgd-dev

NET::SSH::Expect configurations to work over windows

Machine details : Windows7 , 64-bits.
I integrated perl in eclipse and used Net::SSH::Except module for scripting, but am getting an error as Can't locate Net/SSH/Expect.pm in #INC (you may need to install the Net::SSH::Expect
module) (#INC contains: C:/Perl64/site/lib/MSWin32-x64-multi-thread C:/Perl64/site/lib
C:/Perl64/lib .)
Therefore, Am trying to install IO::Tty for Expect dependency, using command cpan>notest install IO::Tty.
i am getting the following error message :
and the module is not being installed, even the NET::SSH::Expect not getting installed.
cpan> notest install IO::Tty
Reading 'C:\Perl64\cpan\Metadata'
Database was generated on Mon, 11 Dec 2017 04:41:02 GMT
Fetching with LWP:
http://ppm.activestate.com/CPAN/authors/01mailrc.txt.gz
Reading 'C:\Perl64\cpan\sources\authors\01mailrc.txt.gz'
.............................................................DONE
Fetching with LWP:
http://ppm.activestate.com/CPAN/modules/02packages.details.txt.gz
Reading 'C:\Perl64\cpan\sources\modules\02packages.details.txt.gz'
Database was generated on Tue, 12 Dec 2017 04:29:02 GMT
.............
**New CPAN.pm version (v2.16) available.
[Currently running version is v2.1101]
You might want to try
install CPAN
reload cpan
to both upgrade CPAN.pm and run the new version without leaving
the current session.**
..............................................................DONE
Fetching with LWP:
http://ppm.activestate.com/CPAN/modules/03modlist.data.gz
Reading 'C:\Perl64\cpan\sources\modules\03modlist.data.gz'
DONE
Writing C:\Perl64\cpan\Metadata
Running install for module 'IO::Tty'
Checksum for C:\Perl64\cpan\sources\authors\id\T\TO\TODDR\IO-Tty-1.12.tar.gz
ok
Scanning cache C:\Perl64/cpan/build for sizes
...............................................................DONE
IO-Tty-1.12/
IO-Tty-1.12/ChangeLog
IO-Tty-1.12/Makefile.PL
IO-Tty-1.12/MANIFEST
IO-Tty-1.12/META.json
IO-Tty-1.12/META.yml
IO-Tty-1.12/Pty.pm
IO-Tty-1.12/README
IO-Tty-1.12/t/
IO-Tty-1.12/try
IO-Tty-1.12/Tty.pm
IO-Tty-1.12/Tty.xs
IO-Tty-1.12/t/test.t
Configuring T/TO/TODDR/IO-Tty-1.12.tar.gz with Makefile.PL
This module requires a POSIX compliant system to work. Try cygwin if you
need this module on windows OS unsupported at Makefile.PL line 6.
Warning: No success on command[C:\Perl64\bin\perl.exe Makefile.PL
INSTALLDIRS=site]
TODDR/IO-Tty-1.12.tar.gz
C:\Perl64\bin\perl.exe Makefile.PL INSTALLDIRS=site -- NOT OK
Failed during this command:
TODDR/IO-Tty-1.12.tar.gz : writemakefile NO
'C:\Perl64\bin\
perl.exe Makefile.PL INSTALLDIRS=site' returned status 65280
i have tried installed IO::Tty with following command
cpanm --install IO::Tty
cpanm --verbose IO::Tty
cpanm --force IO::Tty
all failing , this may be due to the lower version of the perl.
what is the command to upgrade cpan from cmd and also perl through cmd?
Sadly the Perl Expect module requires a UNIX based OS to function. I have implemented this a few times on a windows platform and basically you need to install an older ActiveState distribution of TCL, then you can have the Perl script call an external EXPECT script, like this:
$expectOutput = `[path_to_expect_script.expect]`;
Your variable will then contain the output of the Expect script.
Hope this helps!
Edit: You may like to reword your title to attract more answers relating to using expect on windows.
Solved!
the new version of Expect is made compatible with the windows, but it need to be installed with cygwin ..
In eclipse , make interpreter as cygwin (windows -> preference -> EPIC Perl -> interpreter).
and execute the script:)

Installing some Module ------- Build.PL --installdirs site -- NOT OK [duplicate]

I'm trying to figure out why I can't get the GD perl module to install on my Debian 7 server. Here is how I installed the core stuff:
sudo apt-get install libgd-gd2-perl
Then running the -MCPAN to install, I get:
root#myserver:~# sudo perl -MCPAN -e 'install GD'
Going to read '/root/.cpan/Metadata'
Database was generated on Sun, 19 Jul 2015 21:41:02 GMT
Running install for module 'GD'
Running make for L/LD/LDS/GD-2.56.tar.gz
Checksum for /root/.cpan/sources/authors/id/L/LD/LDS/GD-2.56.tar.gz ok
CPAN.pm: Going to build L/LD/LDS/GD-2.56.tar.gz
Configuring for libgd version 2.0.36.
Checking for stray libgd header files...none found.
Unknown option: installdirs
Usage: perl Build.PL [options]
Configure GD module.
Options:
-options "JPEG,FT,PNG,GIF,XPM,ANIMGIF" feature options, separated by commas
-lib_gd_path path path to libgd
-lib_ft_path path path to Freetype library
-lib_png_path path path to libpng
-lib_jpeg_path path path to libjpeg
-lib_xpm_path path path to libxpm
-lib_zlib_path path path to libpng
-ignore_missing_gd Ignore missing or old libgd installations and try to compile anyway
If no options are passed on the command line. The program will
attempt to autoconfigure itself with the gdlib-config program (present
in GD versions 2.0.27 or later). Otherwise it will prompt for these
values interactively.
Warning: No success on command[/usr/bin/perl Build.PL --installdirs site]
LDS/GD-2.56.tar.gz
/usr/bin/perl Build.PL --installdirs site -- NOT OK
Running Build test
Make had some problems, won't test
Running Build install
Make had some problems, won't install
Could not read metadata file. Falling back to other methods to determine prerequisites
I've done a load of googling, but nothing seems to fix it. Any suggestions?
The error you are getting is
Unknown option: installdirs
Usage: perl Build.PL [options]
cpan expects Build.PL to pass its arguments to Module::Build, but GD has a funky Build.PL. Let's "fix" it.
Execute the following from a temporary directory:
wget http://search.cpan.org/CPAN/authors/id/L/LD/LDS/GD-2.56.tar.gz
-or-
curl -L http://search.cpan.org/CPAN/authors/id/L/LD/LDS/GD-2.56.tar.gz >GD-2.56.tar.gz
tar xvzf GD-2.56.tar.gz
cd GD-2.56
perl -i~ -pE'say "Getopt::Long::Configure(qw( pass_through ));" if /GetOptions/;' Build.PL
/usr/bin/perl Build.PL --installdirs site
sudo ./Build.PL installdeps
./Build.PL make
./Build.PL test
sudo ./Build.PL install
In Ubuntu 15.04, a slight modification of the above intelligent answer seemed necessary in order to get it to install GD. This worked so that the 'cpan' program could then install GD then e.g. Image::Resize (which uses GD) afterwards. I did it after
sudo -i
in a Terminal, and after 'cd' into a temporary folder. Whether of value or not, I first did
apt-get install libgd-dev
Then this, which may contain one or more redundant lines, but it works:
wget http://search.cpan.org/CPAN/authors/id/L/LD/LDS/GD-2.56.tar.gz
tar xvzf GD-2.56.tar.gz
cd GD*
perl -i~ -pE'say "Getopt::Long::Configure(qw( pass_through ));" if /GetOptions/;' Build.PL
/usr/bin/perl Build.PL --installdirs site
chmod 755 Build.PL
./Build.PL installdeps
./Build installdeps
./Build test
./Build install

How to reinstall: re-run module installation for a failed install in Perl's MCPAN?

I'm tried to install XML::LibXSLT, and it failed:
$ sudo perl -MCPAN -e shell
...
cpan[9]> notest install XML::LibXSLT
Running install for module 'XML::LibXSLT'
...
Configuring S/SH/SHLOMIF/XML-LibXSLT-1.94.tar.gz with Makefile.PL
running xslt-config... failed
using fallback values for LIBS and INC
options:
LIBS='-L/usr/local/lib -L/usr/lib -lxslt -lxml2 -lz -lm'
INC='-I/usr/local/include -I/usr/include'
If this is wrong, Re-run as:
$ /usr/bin/perl Makefile.PL LIBS='-L/path/to/lib' INC='-I/path/to/include'
looking for -lxslt... no
libxslt not found
Try setting LIBS and INC values on the command line
Or get libxslt and libxml2 from
http://www.libxml.org/
If you install via RPMs, make sure you also install the -devel
RPMs, as this is where the headers (.h files) are.
No 'Makefile' created SHLOMIF/XML-LibXSLT-1.94.tar.gz
/usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK
Failed during this command:
SHLOMIF/XML-LibXSLT-1.94.tar.gz : writemakefile NO -- No 'Makefile' created
I didn't exit the MCPAN shell; I tried installing sudo apt-get install libxslt1-dev from another terminal, and I wanted to re-run the module installation process. Turns out I can't (I got the clean from perlmonks.org: how to re-run Makefile.PL under CPAN?):
cpan[10]> notest install XML::LibXSLT
Running install for module 'XML::LibXSLT'
SHLOMIF/XML-LibXSLT-1.94.tar.gz
Has already been unwrapped into directory /root/.cpan/build/XML-LibXSLT-1.94-2qijzZ
SHLOMIF/XML-LibXSLT-1.94.tar.gz
No 'Makefile' created
, not re-running
cpan[11]> clean XML::LibXSLT
Running clean for module 'XML::LibXSLT'
Running make clean
No Makefile, don't know how to 'make clean'
cpan[13]> notest install XML::LibXSLT
Running install for module 'XML::LibXSLT'
SHLOMIF/XML-LibXSLT-1.94.tar.gz
Has already been unwrapped into directory /root/.cpan/build/XML-LibXSLT-1.94-2qijzZ
SHLOMIF/XML-LibXSLT-1.94.tar.gz
No 'Makefile' created
, not re-running
Ok, so how do I repeat the installation of this module, now that it failed, and cannot be cleaned either?
Ok, the first thing is to note that there is no (default) way to remove modules from CPAN, failed or not:
How can I de-install a Perl module installed via `cpan`?
That being said, what worked for me was:
exit the MCPAN shell
enter again via sudo perl -MCPAN -e shell
Do not issue install XML::LibXSLT - instead just issue make XML::LibXSLT; note that at this point, I got:
cpan[1]> make XML::LibXSLT
CPAN: Storable loaded ok (v2.30)
Reading '/root/.cpan/Metadata'
Database was generated on Thu, 12 Feb 2015 08:41:02 GMT
Running make for module 'XML::LibXSLT'
...
Scanning cache /root/.cpan/build for sizes
................................................----------------------------DONE
DEL(1/122): /root/.cpan/build/JSON-DWIW-0.47-ppRqJq
CPAN: YAML loaded ok (v0.73)
DEL(2/122): /root/.cpan/build/JSON-DWIW-0.47-ppRqJq.yml
DEL(3/122): /root/.cpan/build/common-sense-3.4-bfJ9E8
...
Have no idea where these deletions came from.
At this point, the command concluded with:
...
/usr/bin/ld: cannot find -lgdbm
/usr/bin/ld: cannot find -lgdbm_compat
collect2: ld returned 1 exit status
...
Failed during this command:
SHLOMIF/XML-LibXSLT-1.94.tar.gz : make NO
cpan[2]> make XML::LibXSLT
Running make for module 'XML::LibXSLT'
SHLOMIF/XML-LibXSLT-1.94.tar.gz
Has already been unwrapped into directory /root/.cpan/build/XML-LibXSLT-1.94-4kLOVB
SHLOMIF/XML-LibXSLT-1.94.tar.gz
Has already been prepared
SHLOMIF/XML-LibXSLT-1.94.tar.gz
Could not make: Unknown error
... and after this, for reasons unknown to me, the clean command started responding:
cpan[4]> clean XML::LibXSLT
Running clean for module 'XML::LibXSLT'
Running make clean
rm -f \
*.a core \
core.[0-9] blib/arch/auto/XML/LibXSLT/extralibs.all \
...
mv Makefile Makefile.old > /dev/null 2>&1
SHLOMIF/XML-LibXSLT-1.94.tar.gz
/usr/bin/make clean -- OK
... and after doing in another terminal sudo apt-get install libgdbm-dev, and a couple more clean XML::LibXSLT and make XML::LibXSLT, finally got the module to install:
cpan[8]> notest install XML::LibXSLT
Running install for module 'XML::LibXSLT'
SHLOMIF/XML-LibXSLT-1.94.tar.gz
...
Installing /usr/local/man/man3/XML::LibXSLT.3pm
Appending installation info to /usr/lib/perl/5.10/perllocal.pod
SHLOMIF/XML-LibXSLT-1.94.tar.gz
/usr/bin/make install -- OK
Well, hope this helps someone; cheers!

Cannot install GD module on darwin 13.0.1 using cpan

I'm having a tough job trying to get GD installed. I'm running a Mas OSX 10.9.2 darwin 13.0.1
When I run this:
cpan[1]> install GD
perl -MCPAN -e shell
I get the follwing error:
cpan[1]> install GD
Reading '/Users/me/.cpan/Metadata'
Database was generated on Sun, 21 Dec 2014 18:53:17 GMT
Running install for module 'GD'
Running make for L/LD/LDS/GD-2.56.tar.gz
Checksum for /Users/me/.cpan/sources/authors/id/L/LD/LDS/GD-2.56.tar.gz ok
Scanning cache /Users/me/.cpan/build for sizes
............................................................................DONE
CPAN.pm: Building L/LD/LDS/GD-2.56.tar.gz
Configuring for libgd version 2.0.11.
Checking for stray libgd header files...none found.
GD library used from: /usr/local
Please choose the features that match how libgd was built:
Undefined subroutine &main::prompt called at Build.PL line 169.
Warning: No success on command[/usr/bin/perl Build.PL ]
'YAML' not installed, will not store persistent state
LDS/GD-2.56.tar.gz
/usr/bin/perl Build.PL -- NOT OK
Running Build test
Make had some problems, won't test
Running Build install
Make had some problems, won't install
Could not read metadata file. Falling back to other methods to determine prerequisites
Failed during this command:
LDS/GD-2.56.tar.gz : writemakefile NO '/usr/bin/perl Build.PL ' returned status 512
Build.PL is trying to call a function called prompt but it doesn't exist. This is because they recently switched build systems from ExtUtils::MakeMaker (Makefile.PL) to Module::Build (Build.PL) but didn't fully convert the program. I've reported the bug.
Most people don't notice this because the prompting is only necessary if GD can't configure itself. It does this by looking for the gdlib-config program. If that can't be found, or it doesn't work, it will ask you for your gdlib configuration. It's best to let gdlib-config take care of that. Best way to solve this problem is to make sure gdlib-config is somewhere in your PATH and that gdlib-config --all works.
Otherwise replace all the instances of prompt in Build.PL with Module::Build->prompt and it should work.
I'm not sure about doing this on OSX, but I recently had similar problems with installing CPAN modules on CentOS.
Some prerequisite modules simply wouldn't install properly from CPAN. These modules had RPMs available. After installing some of the prerequisites via yum, I was able to get CPAN to install the modules I needed.
In particular, I had to install Module-Build and Archive-Tar (which brought in a number of other dependency rpm's) using yum.
Hope this helps.