Installing cpan Modules in cygwin fails - perl

I am trying to install different Perl Modules from CPAN in a cygwin-32bit enviroment and always get Errors of the same kind. This one is from trying to install Net::SSLeay, did make, install and tried force install too, nothing seemed to work.
drmariad#drmariad-MOBL ~/.cpan/build/Net-SSLeay-1.70-eDSzRW$ make install
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
chmod 755 /usr/lib/perl5/site_perl/5.14/i686-cygwin-threads-64int/auto//Net/SSLeay/SSLeay.dll
/bin/find /usr/lib/perl5/site_perl/5.14/i686-cygwin-threads-64int/auto/ -xdev -name \*.dll /bin/rebase -sOT -
/bin/find: paths must precede expression: /bin/rebase
Usage: /bin/find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
Makefile:731: recipe for target 'pure_install' failed
make: *** [pure_install] Error 1
Most of the time it is the bin/find fails message i get in the installations, but i don't know how to change that behaviour. I got errors and failures with most of the modules i tryed to install.

My update-to-date Cygwin comes with
ExtUtils::MakeMaker 6.57_05
ExtUtils::MM_Cygwin 6.57_07
That's odd for a few reason, but what we care about is that version of MM_Cygwin is buggy.
sub install {
my($self, %attribs) = #_;
my $s = ExtUtils::MM_Unix::install($self, %attribs);
return '' unless $s;
return $s unless %{$self->{XS}};
my $INSTALLDIRS = $self->{INSTALLDIRS};
my $INSTALLLIB = $self->{"INSTALL". ($INSTALLDIRS eq 'perl' ? 'ARCHLIB' : uc($INSTALLDIRS)."ARCH")};
my $dop = "\$\(DESTDIR\)$INSTALLLIB/auto/";
my $dll = "$dop/$self->{FULLEXT}/$self->{BASEEXT}.$self->{DLEXT}";
$s =~ s|^(pure_install :: pure_\$\(INSTALLDIRS\)_install\n\t)\$\(NOECHO\) \$\(NOOP\)\n|$1\$(CHMOD) \$(PERM_RWX) $dll\n\t/bin/find $dop -xdev -name \\*.$self->{DLEXT} /bin/rebase -sOT -\n|m if (( $Config{myarchname} eq 'i686-cygwin') and not ( exists $ENV{CYGPORT_PACKAGE_VERSION} ));
$s;
}
You could add the missing | to /usr/lib/perl5/5.14/ExtUtils/MM_Cygwin.pm as a quick permanent fix.
Alternatively, Cygwin has a package named perl-ExtUtils-MakeMaker that upgrade the distribution to 7.04_01.
...Except the bug is still present there. If you have this package installed, the file to fix is /usr/lib/perl5/vendor_perl/5.14/ExtUtils/MM_Cygwin.pm.
Alternatively, you can upgrade ExtUtils::MakeMaker to the latest dev release (which uses a completely different command).
cpan B/BI/BINGOS/ExtUtils-MakeMaker-7.05_22.tar.gz

Related

How do I make Alien use an existing tarball instead of downloading?

My distro does not offer any gsl <2.6 any more.
Given:
Alien::GSL 1.01
/tmp/gsl-2.5.tar.gz
How do I force it to compile that gsl instead of downloading from GNU FTP version 2.6, which I already have on the system anyway but is not delectable to Math::GSL 0.40?
I unsuccessfully tried:
copying the tarball into the unpacked Alien::GSL base directory
messing with alien_repository
This is for a throw-away project. I'm okay with manual installation instructions and patching toolchain code.
ikegami found the decisive hint:
It looks like you can set protocol of local to use a local file
Tested step-by-step instructions, plus some additional work-arounds; to me it looks like the build systems of the two modules are buggy/insufficiently tested:
cpanm --look Alien::GSL
patch Build.PL
diff --git a/Build.PL b/Build.PL
index 32f3057..6537138 100644
--- a/Build.PL
+++ b/Build.PL
## -20,10 +20,9 ## my $builder = Alien::Base::ModuleBuild->new(
alien_name => 'gsl',
alien_repository => [
{
- protocol => 'ftp',
- host => 'ftp.gnu.org',
- location => '/gnu/gsl',
- pattern => qr/^gsl-([\d\.]+)\.tar\.gz$/,
+ protocol => 'local',
+ location => '/tmp',
+ pattern => 'gsl-2.5.tar.gz',
},
],
meta_merge => {
--
2.23.0
perl Build.PL
./Build
Pay attention to the generated configure/libtool commands here, they match the Perl configuration. A manual installation without those various options is not guaranteed to be compatible or usable. (This is not superstition: a similar problem historically shows up when installing mod_perl2 and libapreq2 from source on a system httpd; perl needs to be compiled first, then httpd to match, then the other packages, otherwise it won't work.) This shows the value of installing through Alien, since it delegates to M::B, the correct options will be figured out. It's above my level of knowledge to accurately create them from scratch.
./Build test
gsl-config in blib now erroneously contains build paths, not install paths, fix:
perl -MConfig -i -lpe'
s|/.*(/auto/share/dist/Alien-GSL)|$Config{installsitelib}$1|
' blib/lib/auto/share/dist/Alien-GSL/bin/gsl-config
./Build install
exit # cpanm
cpanm --look Math::GSL
# let it pick up gsl-config on PATH
export PATH=$PATH:$(perl -mAlien::GSL -e'print Alien::GSL->bin_dir')
perl Build.PL
./Build
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(gsl-config --libs | perl -lne'/-L(\S+) / && print $1')
./Build test
./Build install
exit # cpanm
Finally rëexport the variables whenever you want to use Math::GSL.

Why does LWP fail to connect with "500 SSL negotiation failed"?

My Perl script sends some information to a remote server.
Below is a portion of the code
#!/var/hvmail/libexec/perl
use strict;
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use constant HANDLER_URL => "https://www.website.com/handler.php";
$ENV{HTTPS_DEBUG} = 1;
my $ua = LWP::UserAgent->new;
# Some DB stuff, not applicable
my $row; # This is a DB row ($sth->fetchrow_hashref())
my $req = POST ''.HANDLER_URL, [ %$row ];
my $res = $ua->request($req);
$res->is_success is false with $res->status_line being
500 SSL negotiation failed
We are running CentOS 6.4, Perl 5.10.1, OpenSSL 1.0.1e-fips.
Update
Here's the full output:
SSL_connect:before/connect initialization
SSL_connect:SSLv2/v3 write client hello A
SSL3 alert read:fatal:handshake failure
SSL_connect:error in SSLv2/v3 read server hello A
SSL_connect:before/connect initialization
SSL_connect:SSLv3 write client hello A
SSL3 alert read:fatal:handshake failure
SSL_connect:failed in SSLv3 read server hello A
SSL_connect:before/connect initialization
SSL_connect:SSLv2 write client hello A
SSL_connect:failed in SSLv2 read server hello A
Error: [ 500 SSL negotiation failed: ]
Requested Command Output
Can't locate Net/SSLeay.pm
Can't locate LWP/Protocol/https.pm
You seem to be relying on Crypt::SSLeay. You shouldn't. It's outdated and incomplete.
Install the latest LWP::Protocol::https which will upgrade your LWP and install the preferred SSL/TLS stack consisting of the IO::Socket::SSL and Net::SSLeay.
A web search shows there are CentOS6 repositories with RPM packages for LWP::Protocol::https.
The server has disabled SSLv3 support which means the negotiation fails.
Once you install the package, if you are still seeing the same error, make sure your script is not forcing the use of Crypt::SSLeay. That is, make sure none of the following appears anywhere in your script:
use Net::HTTPS;
$Net::HTTPS::SSL_SOCKET_CLASS = 'Net::SSL';
or
local $ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS} = 'Net::SSL';
or
use Net::SSL;
If you are still running into problems, make sure there is no PERL_NET_HTTPS_SSL_SOCKET_CLASS environment variable in the script's run time environment.
Also, try
$ /var/hvmail/libexec/perl -MNet::SSLeay -le 'print $Net::SSLeay::VERSION'
and
$ /var/hvmail/libexec/perl -MLWP::Protocol::https -le 'print $LWP::Protocol::https::VERSION`'
and report the output.
I suspect the issue is that the new packages were installed for the system's perl whereas it seems you may have a separate perl.
If that is the case, you should install each package individually using /var/hvmail/libexec/perl. For example:
$ curl -O https://cpan.metacpan.org/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7043.tar.gz
$ tar xvf App-cpanminus-1.7043.tar.gz
$ cd App-cpanminus-1.7043
$ /var/hvmail/libexec/perl Makefile.PL
$ make install
Figure out where cpanm was installed. I am hoping /var/hvmail/libexec.
$ /var/hvmail/libexec/cpanm LWP::Protocol::https
See also Updating all outdated Perl modules, but that may be risky on a production. Still, installing App::cpanoutdated, and seeing how outdated your Perl modules are might be useful
Now, keep in mind that tinkering with a production install like this is risky. Make sure you have a way to undo changes in case something goes wrong.
Finally, note that OpenSSL 1.0.1 versions are no longer supported:
With regards to current and future releases the OpenSSL project has adopted the following policy:
Version 1.1.0 will be supported until 2018-08-31.
Version 1.0.2 will be supported until 2019-12-31 (LTS).
Version 1.0.1 is no longer supported.
Version 1.0.0 is no longer supported.
Version 0.9.8 is no longer supported.
There is no need for ''.HANDLER_URL. It looks ugly, and HANDLER_URL is fine
You don't explain what is in $row or what the POST call requires, but it looks like this
my $req = POST ''.HANDLER_URL, [ %$row ];
my $res = $ua->request($req);
should be
my $res = $ua->post(HANDLER_URL, $row);

Mojolicious + MongoDB: Can't locate MongoDB.pm error

My app crashes each time it includes as much as "use MongoDB;" in my perl app file.
I have installed MongoDB successfully. I can check my databases use one or the other, check for collections, create new collections, all from the shell.
If I try to connect to mongoDb from mojolicious app like:
!/usr/bin/env perl
use Mojolicious::Lite;
use MongoDB;
use MongoDB::OID;
my $mongo_port = shift || 27017;
helper 'mongo' => sub {
my ($self, $name) = #_;
my $host = 'localhost:' . $mongo_port;
my $conn = MongoDB::MongoClient->new(host => $host);
my $db = $conn->get_database('test');
};
helper 'value2oid' => sub {
my ($self, $value) = #_;
MongoDB::OID->new($value);
};
If I have a working app and include as much as :
Use MongoDB;
I get:
Can't load application from file "/Users/eevitomperi/Desktop/Programming/Perl/mojoliciousApp/foodAbout/app.pl": Can't locate MongoDB.pm in #INC (you may need to install the MongoDB module) (#INC contains: /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 /Users/eevitomperi/Desktop/Programming/Perl/mojoliciousApp/foodAbout/app.pl line 4.
BEGIN failed--compilation aborted at /Users/eevitomperi/Desktop/Programming/Perl/mojoliciousApp/foodAbout/app.pl line 4.
I am completely new to mongo, mojolicious and perl so I guess I did not install some package?
Does the MongoDB files(mongo, mongod....) have to be within the mojolicious project ?
Not sure what I am missing and all documentation starts with the use of "Use MongoDB;" within mojolicious app so not sure what to do.
Hopefully someone can point out what I missed.
Install module:
cpanm Mojolicious::Plugin::Mongodb
Fix the following:
Can't write to /Library/Perl/5.18 and /usr/local/bin: Installing modules to /Users/eevitomperi/perl5
! To turn off this warning, you have to do one of the following:
! - run me as a root or with --sudo option (to install to /Library/Perl/5.18 and /usr/local/bin)
! - Configure local::lib your existing local::lib in this shell to set PERL_MM_OPT etc.
! - Install local::lib by running the following commands
By running:
cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
Now I can connect to Mongo from mojolicious

How do I ensure that old shared content is removed when using Module::Build's share_dir option?

I'm using Module::Build's share_dir option to install read-only supplementary content when users install my Perl module.
How do I ensure that the old content added by previous versions of my module is deleted when a new version of my module is installed?
Thanks in advance for your help.
Yanick Champoux has recently been dealing with this problem. To do so he has created File::ShareDir::Tarball and its Dist::Zilla counterpart Dist::Zilla::Plugin::ShareDir::Tarball. The idea is that your entire sharedir is tarred so that it is only one directory. Then when your module is upgraded, the tarball is replaced and it is in the state you expect.
If you're removing files from a distribution I recommend making Makefile.PL or Build.PL refuse to install, add this
my $mod = 'CGI';
if( eval "require $mod; 1" ){
die "
YOU HAVE TO UNINSTALL $mod before you can upgrade, use one of
cpanp -u $mod --force
pm-uninstall -vf $mod
";
}
Or better yet, add a pre-amble which does the actual uninstalling (maybe with ExtUtils::Install::uninstall($packlist) )
Usually you'll know which version of your module requires complete uninstalling, so you might want to add a version check ...
FWIW, this would make a good Module::Build/Module::Install/ExtUtils::MakeMaker addition/extension/plugin that accepts something like
requires_uninstall_if_installed => '<3000' ,
requires_uninstall_if_installed => { CGI => '<3000', 'CGI::Util' => '<3000' },
requires_uninstall_if_installed => [ qw' CGI CGI::Util '],
requires_uninstall_if_installed( '<3000' );
requires_uninstall_if_installed( { CGI => '<3000', 'CGI::Util' => '<3000' } );
requires_uninstall_if_installed( [ qw' CGI CGI::Util '] );
I have now uploaded Module::Build::CleanInstall to hopefully address issues like this. Hopefully it helps. A big thanks goes to Yanick and so-not-like-openid-anonymity for the inspiration.

Open2 Api failure while installing Mead software

I am running into some issues trying to install a software called MEAD . I would appreciate if someone could have alook .
I get the following error while installing
/mead/bin # ./mead.pl GA3
Using system rc-file: /home/karosh/mead/bin/../.meadrc
Warning: Can't find user rc-file
Cluster: /home/karosh/mead/bin/../data/GA3/GA3.cluster
open2: exec of /home/karosh/mead/bin/driver.pl failed at ./mead.pl line 230
THe mead software is not written by me so I have not changed any of the perl scrips . I line 230 in the driver.pl file is
sub run_mead {
my %options = #_;
my $reader = FileHandle->new();
my $writer = FileHandle->new();
unless ( open2($reader, $writer, "$FindBin::Bin/driver.pl") ) {
die "Unable to run MEAD.\n";
}
...
...
}
Does this error mean that open2 was not found . The mead folks have put the following line in the file:
use strict;
use File::Spec;
use FileHandle;
use IPC::Open2;
Or does it mean that i need to install the rpm that contains the API . I see that this API is a part of the core perl bundle http://perldoc.perl.org/IPC/Open2.html. So why was it not installed ? Do i need to install perl again .
Someone has earlier faced this problem - http://www.summarization.com/~radev/mead/email/0160.html but the solution is not working for me . I find no Perl files with the incorrect perl directives . The mead team has been dissolved and there is no one to ask questions but I need to use this software.
I think if some one can explain me the meaning of the error than I can do deeper. Anyone?
It probably means that .../driver.pl doesn't have execute permission. Change the file permissions or call it like
open2($reader, $writer, "perl $FindBin::Bin/driver.pl")
open2($reader, $writer, "$^X $FindBin::Bin/driver.pl")