Installing a patch for a dependent module: cpanm still tries to install broken module after I have installed patched module manually - perl

I am trying to install Net::SSH::Perl using cpanm (from perlbrew and perl version 5.30). The installation fails with:
$ cpanm Net::SSH::Perl
--> Working on Net::SSH::Perl
Fetching http://www.cpan.org/authors/id/S/SC/SCHWIGON/Net-SSH-Perl-2.14.tar.gz ... OK
Configuring Net-SSH-Perl-2.14 ... OK
==> Found dependencies: Crypt::Curve25519
--> Working on Crypt::Curve25519
Fetching http://www.cpan.org/authors/id/A/AJ/AJGB/Crypt-Curve25519-0.06.tar.gz ... OK
Configuring Crypt-Curve25519-0.06 ... OK
Building and testing Crypt-Curve25519-0.06 ... FAIL
! Installing Crypt::Curve25519 failed. See /home/hakon/.cpanm/work/1587758019.381709/build.log for details. Retry with --force to force install it.
! Installing the dependencies failed: Missing version info for module 'Crypt::Curve25519'
! Bailing out the installation for Net-SSH-Perl-2.14.
The problem with installing Crypt::Curve25519 is described in this issue. I downloaded the problematic module Crypt::Curve25519 and patched it:
git clone git#github.com:ajgb/crypt-curve25519.git
wget https://www.cpan.org/authors/id/S/SR/SREZIC/patches/Crypt-Curve25519-0.06-PR10-ANOTHERLINK.patch
cd crypt-curve25519
git apply ../Crypt-Curve25519-0.06-PR10-ANOTHERLINK.patch
perl Makefile.PL
make # No errors now
make test
make install
However, when I try again to install Crypt::Curve25519 it still tries to install the broken module from CPAN:
$ cpanm Net::SSH::Perl
--> Working on Net::SSH::Perl
Fetching http://www.cpan.org/authors/id/S/SC/SCHWIGON/Net-SSH-Perl-2.14.tar.gz ... OK
Configuring Net-SSH-Perl-2.14 ... OK
==> Found dependencies: Crypt::Curve25519
--> Working on Crypt::Curve25519
Fetching http://www.cpan.org/authors/id/A/AJ/AJGB/Crypt-Curve25519-0.06.tar.gz ... OK
Configuring Crypt-Curve25519-0.06 ... OK
Building and testing Crypt-Curve25519-0.06 ... FAIL
! Installing Crypt::Curve25519 failed. See /home/hakon/.cpanm/work/1587758833.382749/build.log for details. Retry with --force to force install it.
! Installing the dependencies failed: Missing version info for module 'Crypt::Curve25519'
! Bailing out the installation for Net-SSH-Perl-2.14.
How can I make cpanm use the installed patch instead (i.e. skip installation of Crypt::Curve25519 since it is already installed)?

The problem seems to be missing VERSION information in the module. By adding a line
our $VERSION = 0.06;
to the top of the file lib/Crypt/Curve25519.pm and then reinstall, and then installing cpanm Net::SSH::Perl worked fine (it accepted the patched installation and did not try to download the broken version).
Here is the patch I used to lib/Crypt/Curve25519.pm:
diff --git a/lib/Crypt/Curve25519.pm b/lib/Crypt/Curve25519.pm
index 686b706..d9c2b3d 100644
--- a/lib/Crypt/Curve25519.pm
+++ b/lib/Crypt/Curve25519.pm
## -1,4 +1,5 ##
package Crypt::Curve25519;
+our $VERSION = 0.06;
#ABSTRACT: Generate shared secret using elliptic-curve Diffie-Hellman function
use strict;

There's a few things to check:
cpanm knows where to find your patched version.
The patched version has a version that's higher than the one on CPAN. The module idea in CPAN assumes that you always want the latest, so ensure that yours is.
You don't want to install a patched module at the standard location because you don't want a cpan client to overwrite it.
Some other things that can work:
Force install the module and ignore the failures (cpanm has a --notest feature). The CPAN version is still installed, but that doesn't matter.
Have your patched version in a separate directory that's at the front of #INC so your program finds it first. This effectively hides the CPAN version.

Related

How install TCOD::Key with Straberry perl (windows 10)

I have got Strawberry perl with windows 10. Using cpan I try to install TCOD::Key. The problem is the libtcod.h file is absent. I do not understand how install the libraria.
D:\Documents>cpanm --force TCOD::Key
--> Working on TCOD::Key
Fetching http://www.cpan.org/authors/id/J/JJ/JJATRIA/TCOD-0.009.tar.gz ... OK
Configuring TCOD-0.009 ... OK
Building and testing TCOD-0.009 ... FAIL
! Installing TCOD::Key failed. See C:\Users\User\.cpanm\work\1672857094.2144\build.log for details. Retry with --force to force install it.
screenshot
I expect that by installing the library, the TSOD::Key module will install successfully.

Cannot Install ExtUtils::MakeMaker in Strawberry Perl

I am trying to install GD and Chart to Strawberry Perl in a Windows 10 Pro PC (using CPANM). Both GD and Chart requires a dependency called ExtUtils::MakeMaker. Unfortunately MakeMaker fails to be install and I cannot tell what the error is. I hope someone can understand the error message and tell me what goes wrong.
That is how I try to install Chart and the few error message that I get:
cpanm Chart
--> Working on Chart
Fetching http://www.cpan.org/authors/id/L/LI/LICHTKIND/Chart-v2.402.1.tar.gz ... OK
==> Found dependencies: ExtUtils::MakeMaker
--> Working on ExtUtils::MakeMaker
Fetching http://www.cpan.org/authors/id/B/BI/BINGOS/ExtUtils-MakeMaker-7.64.tar.gz ... OK
Configuring ExtUtils-MakeMaker-7.64 ... N/A
! Configure failed for ExtUtils-MakeMaker-7.64. See C:\Users\..user-name..\.cpanm\work\1655122864.2228\build.log for details.
Configuring Chart-v2.402.1 ... N/A
! Configure failed for Chart-v2.402.1. See C:\Users\..user-name..\.cpanm\work\1655122864.2228\build.log for details.
The build.log says this:
cpanm (App::cpanminus) 1.7046 on perl 5.012003 built for MSWin32-x86-multi-thread
Work directory is C:\Users\..user-name../.cpanm/work/1655122864.2228
You have make C:\Strawberry\c\bin\dmake.exe
You have LWP 6.02
Falling back to Archive::Tar 1.76
Searching Chart () on cpanmetadb ...
--> Working on Chart
Fetching http://www.cpan.org/authors/id/L/LI/LICHTKIND/Chart-v2.402.1.tar.gz
-> OK
Unpacking Chart-v2.402.1.tar.gz
Entering Chart-v2.402.1
Checking configure dependencies from META.json
Checking if you have ExtUtils::MakeMaker 6.58 ... No (6.56 < 6.58)
==> Found dependencies: ExtUtils::MakeMaker
Searching ExtUtils::MakeMaker (6.58) on cpanmetadb ...
--> Working on ExtUtils::MakeMaker
Fetching http://www.cpan.org/authors/id/B/BI/BINGOS/ExtUtils-MakeMaker-7.64.tar.gz
-> OK
Unpacking ExtUtils-MakeMaker-7.64.tar.gz
Entering ExtUtils-MakeMaker-7.64
Checking configure dependencies from META.json
Configuring ExtUtils-MakeMaker-7.64
Running Makefile.PL
-> N/A
-> FAIL Configure failed for ExtUtils-MakeMaker-7.64. See C:\Users\..user-name..\.cpanm\work\1655122864.2228\build.log for details.
Configuring Chart-v2.402.1
Running Makefile.PL
-> N/A
-> FAIL Configure failed for Chart-v2.402.1. See C:\Users\..user-name..\.cpanm\work\1655122864.2228\build.log for details.
Please let me know what goes wrong and how to fix this problem. If there is no solution to this problem, I would like to know if there is any workaround. Thanks.
UPDATE 1: I installed the latest version of Perl (5.32.1.1). Unfortunately I still cannot install the dependency MakeMaker for Chart library. The content in the build.log after trying to install Chart is:
cpanm (App::cpanminus) 1.7046 on perl 5.032001 built for MSWin32-x86-multi-thread-64int
Work directory is C:\Users\...user-name.../.cpanm/work/1655143835.7588
You have make C:\Strawberry\c\bin\gmake.exe
You have LWP 6.52
Falling back to Archive::Tar 2.38
Searching Chart () on cpanmetadb ...
--> Working on Chart
Fetching http://www.cpan.org/authors/id/L/LI/LICHTKIND/Chart-v2.402.1.tar.gz
-> OK
Unpacking Chart-v2.402.1.tar.gz
Entering Chart-v2.402.1
Checking configure dependencies from META.json
Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (7.58)
Configuring Chart-v2.402.1
Running Makefile.PL
-> N/A
-> FAIL Configure failed for Chart-v2.402.1. See C:\Users\...user-name...\.cpanm\work\1655143835.7588\build.log for details.
UPDATE 2: I used the -v switch with CPANM to install Chart, and this somehow worked fine. I don't know why -v switch can make a difference. But I am glad that this works for installing Chart. Now Chart is successfully installed. Unfortunately when I try to install GD using the -v switch, I run into the same error.
The build.log of my latest attempt is the following:
cpanm (App::cpanminus) 1.7046 on perl 5.032001 built for MSWin32-x86-multi-thread-64int
Work directory is C:\Users\...user-name.../.cpanm/work/1655147078.2428
You have make C:\Strawberry\c\bin\gmake.exe
You have LWP 6.52
Falling back to Archive::Tar 2.38
Searching GD () on cpanmetadb ...
--> Working on GD
Fetching http://www.cpan.org/authors/id/R/RU/RURBAN/GD-2.76.tar.gz
-> OK
Unpacking GD-2.76.tar.gz
Entering GD-2.76
Checking configure dependencies from META.json
Checking if you have ExtUtils::PkgConfig 0 ... Yes (1.16)
Checking if you have ExtUtils::Constant 0.22 ... Yes (0.25)
Configuring GD-2.76
Running Makefile.PL
-> N/A
-> FAIL Configure failed for GD-2.76. See C:\Users\...user-name...\.cpanm\work\1655147078.2428\build.log for details.
Please note that the build.log mentioned in the last line above is the same build.log that I have posted right above. I don't know why it refers to itself. I mention this just in case someone wants to see the "real" build.log.
UPDATE 3: Finally with the help from Håkon Hægland, I figured out that the PATH of the computer was missing several paths (namely C:\Windows;C:\Windows\System32;C:\Windows\System32\Wbem). I added the missing paths to PATH, and the installation is successful. I have no idea why those important paths would go missing. But I am glad that the installation of GD and Chart are successful.
With the help from Håkon Hægland, I finally figured out that the PATH of the computer somehow was missing several important paths, namely C:\Windows, C:\Windows\System32, and C:\Windows\System32\Wbem. This explains the reason why CPANM failed to install GD and Chart. It probably could not get access to a command to install the distribution or its dependency. After I have added the missing paths to PATH, I have no problem using CPANM to install GD and Chart.
As of why those paths were missing from PATH, I have no idea. I don't recall this problem ever happened to me.
As of why I could use CPANM to install Chart using the -v switch despite the fact that the paths were missing, I have no idea either.

Trying to install a perl module with cpanm, got a fail

So I just installed Strawberry Perl and now I want to get the following module:
https://metacpan.org/pod/Lingua::EN::CMUDict
So I typed in "cpanm Lingua::EN::CMUDict" and got:
So I tried again with "cpanm Lingua::EN::CMUDict --force" and got the same exact thing.
Here are the contents of the log in question:
cpanm (App::cpanminus) 1.7044 on perl 5.032001 built for MSWin32-x64-multi-thread
Work directory is C:\Users\matth/.cpanm/work/1630544096.16456
You have make C:\Users\c\bin\gmake.exe
You have LWP 6.52
Falling back to Archive::Tar 2.38
==============
Tried verbose output, got this:
--> Working on Lingua::EN::CMUDict
Fetching http://www.cpan.org/authors/id/L/LM/LMETCALF/Lingua-EN-CMUDict-0.06.tar.gz ... OK
Configuring Lingua-EN-CMUDict-0.06 ... OK
Building and testing Lingua-EN-CMUDict-0.06 ... FAIL
! Installing Lingua::EN::CMUDict failed. See C:\Users\matth\.cpanm\work\1630595312.29316\build.log for details. Retry with --force to force install it.
! Finding Write-Verbose on cpanmetadb failed.
! Finding Write-Verbose () on mirror http://www.cpan.org failed.
! Couldn't find module or a distribution Write-Verbose
And that log:
https://pastebin.com/iSS5LRKA
Also, it says my File::ShareDir is up to date.
I have installed the file manually, and put it in perl\lib, but it says it doesn't exist. Where should I put it?
I looked up the module in CPAN and under Kwalitee issues I found:
prereq_matches_use
List all used modules in META.yml requires
Error:
File::ShareDir
When I downloaded (but not installed) the module I found this in the code
(in Lingua/EN/CMUDict.pm): use File::ShareDir ':ALL'
So maybe the installation is missing this module and you could try to install it yourself.
It was Håkon Hægland that helped. As soon as I changed the permission to lib, it worked.

Redhat Linux 6.5 Perl GD CPAN Module yum

when i try to install "GD" (perl -e shell -MCPAN ->(next step) cpan[1]> install GD) on Redhat 6.5 i got the error:
->
CPAN.pm: Building L/LD/LDS/GD-2.53.tar.gz
UNRECOVERABLE ERROR
Could not find gdlib-config in the search path. Please install libgd 2.0.28 or higher.
If you want to try to compile anyway, please rerun this script with the option --ignore_missing_gd.
Warning: No success on command[/usr/bin/perl Makefile.PL INSTALLDIRS=site]
CPAN: YAML loaded ok (v0.90)
LDS/GD-2.53.tar.gz
/usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK
Running make test
Make had some problems, won't test
Running make 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.53.tar.gz : writemakefile NO '/usr/bin/perl Makefile.PL INSTALLDIRS=site' returned status 512
<-
I tryed to install "libgd 2.0.28 or higher" but don't find this in "yum".
locate libgd (shows):
/usr/lib64/libgd.so.2
/usr/lib64/libgd.so.2.0.0
Does anyone know an advice?
Many perl modules are available already built and packaged for RHEL and derivatives such as CentOS. In the case of perl-GD, it seems it is available in the CentOS in the base repo even though it is not in the RHEL repo.
However you can still use the Centos repo by adding it to your yum configuration. Create a file /etc/yum.repos.d/cantos.repo containing:
[centos]
name=CentOS $releasever - $basearch
baseurl=http://mirror.centos.org/centos-6/6/os/$basearch/
enabled=0
gpgcheck=0
After which you should be able to install perl-GD
yum install --enablerepo centos perl-GD
It looks as though the current version of perl-GD for centos is 2.44.
If you do need a newer version that that, you will either need to find a 3rd party yum repo which has the later version of libgd available, or compile it from source. In a quick google I could not find the former, so I would recommend you download the latest source package and install that.
You need the package gd-devel then rebuild the GD module.

cpan2rpm does not seem to get installed Perl version

I'm running on RHEL6, with RHEL's perl-5.10.1-130.el6_4 installed. I am trying to build some RPMs using cpan2rpm 2.028. Also, perl-version-0.77-130.el6_4 is installed. It's giving odd failures, saying the installed version of Perl is not new enough:
$ perl -
This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi
...
$ cpan2rpm --no-sign ExtUtils::MakeMaker
-- cpan2rpm - Ver: 2.028 --
Upgrade check
Fetch: HTTP
-- module: ExtUtils::MakeMaker --
Using cached URL: http://search.cpan.org//CPAN/authors/id/M/MS/MSCHWERN/ExtUtils-MakeMaker-6.64.tar.gz
Tarball found - not fetching
Metadata retrieval
Tarball extraction: [/root/rpm/SOURCES/ExtUtils-MakeMaker-6.64.tar.gz]
Unable to build module, the following dependencies have failed:
perl >= 5.006
Stopped at /usr/bin/cpan2rpm line 491.
cannot remove path when cwd is /tmp/bj8upl6poj/ExtUtils-MakeMaker-6.64 for /tmp/bj8upl6poj: at /usr/share/perl5/File/Temp.pm line 902
-- Done --
What's causing cpan2rpm not to know what version of perl is installed?
I'm not sure why cpan2rpm doesn't work here. But I'll point out that the Red Hat team now use cpanspec to build all of their RPMs of CPAN modules. You might try that instead.
Unless there a reason you want to build the rpm with cpan2rpm, you can simply install the Perl modules from the yum repository. For example:
# yum install perl-ExtUtils-MakeMaker.x86_64
# rpm -q perl-ExtUtils-MakeMaker
perl-ExtUtils-MakeMaker-6.55-130.el6_4.x86_64
I had the same problem and it's fixed by installing Perldoc.
$ cpan Perldoc