Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cpanm fails to install any module due to supposed lack of 'make'

Tags:

cpanm

I recently installed XAMPP. Everything works great so far, but one thing doesn't let me to rest: I can't get any module via cpanm. The typical install log looks like this:

cpanm (App::cpanminus) 1.6005 on perl 5.016003 built for MSWin32-x86-multi-thread
Work directory is C:\Users\2B86~1/.cpanm/work/1448496711.6352
You have LWP 6.04
You have C:\Users\boss\AppData\Local\Atlassian\SourceTree\git_local\bin\tar.exe, C:\Users\boss\AppData\Local\Atlassian\SourceTree\git_local\bin\gzip.exe and C:\Users\boss\AppData\Local\Atlassian\SourceTree\git_local\bin\bzip2.exe
You have C:\Users\boss\AppData\Local\Atlassian\SourceTree\git_local\bin\unzip.exe
Searching DateTime::Tiny on cpanmetadb ...
--> Working on DateTime::Tiny
Fetching http://www.cpan.org/authors/id/A/AD/ADAMK/DateTime-Tiny-1.04.tar.gz
-> OK
Unpacking DateTime-Tiny-1.04.tar.gz
Entering DateTime-Tiny-1.04
Checking configure dependencies from META.yml
Checking if you have ExtUtils::MakeMaker 0 ... Yes (6.64)
Configuring DateTime-Tiny-1.04
Running Makefile.PL
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have ExtUtils::MakeMaker 0 ... Yes (6.64)
-> FAIL Can't configure the distribution. You probably need to have 'make'. See C:\Users\2B86~1\.cpanm\build.log for details.

The line -> FAIL Can't configure the distribution. You probably need to have 'make'. See C:\Users\2B86~1\.cpanm\build.log for details. is meant to indicate the error, but I do have make.exe in the same directory as cpanm.

A bit of prehistory, I had installed Strawberry Perl prior to installing xampp, being unaware it has Perl built-in already. After discovering that I decided to uninstall the former, and cpanm suddenly started to encounter this error. I double-checked and I didn't find a trace of make.exe in the Strawberry Perl installation I had, but it worked quite fine, and while they co-existed, cpanm from xampp worked too.

I tried to seek help on Google, but it came up with sudo apt-get install build-essentials-like advises.

like image 279
ZzZombo Avatar asked Nov 26 '15 01:11

ZzZombo


2 Answers

The entry "You probably need to have 'make'." in the log means that cpanm is not able to find the exact location of your make file (e.g. dmake.exe). This location must be included in your %PATH% before running cpanm.

For example, if you installed your Perl from the source using MSYS and MinGW, execute the following command before running cpanm:

set PATH=C:\MinGW\msys\1.0\bin;%PATH%

The make executable must be the same which was used to compile your Perl. You can check the exact name of your make by executing the following command:

perl -V:make

Then find the path to that executable and add it to the %PATH%.

like image 174
Jānis Š. Avatar answered Sep 30 '22 18:09

Jānis Š.


My situation is different from what is described in question, but I got same error message. I am using docker image with Ubuntu 18.04.3 LTS, which has preinstalled Perl v5.26.1. My goal was to install DBI.pm Perl module to interact with database. After some research I discovered that additional piece of software called cpanminus can be used to install Perl modules. So long story short cpanm DBI was returning what OP describes with You probably need to have 'make' error message. Then I tried solution provided here by michael.stapelberg:

Apparently, your system does not have the make command, which you need to install Perl modules. On Debian, use: sudo apt-get install build-essential

I installed build-essential package and tried to do cpanm DBI and it worked just fine:

Successfully installed DBI-1.642

like image 39
metatron Avatar answered Sep 30 '22 16:09

metatron