Cannot build Perl libgd on Mac Perlbrew environment - perl

I was using Mac OS 12 and Perlbrew with Perl 5.36.
When I install GD using either CPAN or cpanm I get the following error:
cpanm (App::cpanminus) 1.7046 on perl 5.036000 built for darwin-2level
Work directory is /Users/mjb/.cpanm/work/1673722431.48328
You have make /usr/bin/make
You have LWP 6.67
You have /usr/bin/tar: bsdtar 3.5.1 - libarchive 3.5.1 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8
You have /usr/bin/unzip
Searching install () on cpanmetadb ...
install is up to date. (0.01)
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::Constant 0.22 ... Yes (0.25)
Checking if you have ExtUtils::PkgConfig 0 ... Yes (1.16)
Configuring GD-2.76
Running 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 530.
*** can not find package gdlib
*** check that it is properly installed and available in PKG_CONFIG_PATH
at Makefile.PL line 530.
-> N/A
-> FAIL Configure failed for GD-2.76. See /Users/mjb/.cpanm/work/1673722431.48328/build.log for details.
The above is the contents of build.log. I'm not sure how to investigate further or fix it.
Previously I had Perl's GD install and build using the system Perl. I also have libgd installed from Homebrew and I included /usr/local/lib in the env var PKG_CONFIG_PATH. Still no avail.
Would appreciate help as I rely upon GD for my personal projects. Thanks.

Found it... something (probably me botching my .zshrc) had unset my $PKG_CONFIG_PATH!
After finding out what pkg-config was and scouring my drive for any telling collection of .pc files, I found gdlib.pc under /usr/local/lib/pkgconfig/gdlib.pc.
Then I simply did an export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ and reran the installation. Perl's GD built and installed without grumbling.
A pernanment solution will be to add the above line to your ~/.zshrc.

Related

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.

CPAN Module Installation Fails

Trying to install certain CPAN modules on HP-UX (May 2017), but getting an error:
# cpanm ExtUtils-MakeMaker-7.30.tar.gz
--> Working on ExtUtils-MakeMaker-7.30.tar.gz
Fetching file:///home/users/root_user/CPAN/ExtUtils-MakeMaker-7.30.tar.gz ... OK
Configuring ExtUtils-MakeMaker-7.30 ... OK
! Can't configure the distribution. You probably need to have 'make'. See /.cpanm/work/1515577528.15913/build.log for details.
But, looks like Perl is set to use gmake.
# perl -V:make
make='gmake';
make is installed on the system. How do I resolve this? Any help is appreciated.
Build Log File
cpanm (App::cpanminus) 1.7043 on perl 5.008008 built for IA64.ARCHREV_0-thread-multi
Work directory is //.cpanm/work/1515577528.15913
You have LWP 5.820
Falling back to Archive::Tar 1.40
--> Working on ExtUtils-MakeMaker-7.30.tar.gz
Fetching file:///home/users/root_user/CPAN/ExtUtils-MakeMaker-7.30.tar.gz
-> OK
Unpacking ExtUtils-MakeMaker-7.30.tar.gz
Entering ExtUtils-MakeMaker-7.30
Checking configure dependencies from META.json
Configuring ExtUtils-MakeMaker-7.30
Running Makefile.PL
Using included version of CPAN::Meta (2.143240) because it is not already installed.
Using included version of Parse::CPAN::Meta (1.4414) because it is not already installed.
Using included version of CPAN::Meta::YAML (0.011) because it is not already installed.
Using included version of File::Temp (0.22) as it is newer than the installed version (0.16).
Using included version of ExtUtils::Manifest (1.70) as it is newer than the installed version (1.46).
Using included version of JSON::PP (2.27203) because it is not already installed.
Using included version of ExtUtils::Install (2.06) as it is newer than the installed version (1.33).
Using included version of CPAN::Meta::Requirements (2.131) because it is not already installed.
Checking if your kit is complete...
Warning: the following files are missing in your kit:
't/liblist/win32/di
't/liblist/win32/space
Please inform the author.
Generating a Unix-style Makefile
Writing Makefile for ExtUtils::MakeMaker
Writing MYMETA.yml and MYMETA.json
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have Data::Dumper 0 ... Yes (2.121_08)
Checking if you have File::Spec 0.8 ... Yes (3.12)
Checking if you have Pod::Man 0 ... Yes (1.37)
Checking if you have File::Basename 0 ... Yes (2.74)
Checking if you have Encode 0 ... Yes (2.12)
-> FAIL Can't configure the distribution. You probably need to have 'make'. See /.cpanm/work/1515577528.15913/build.log for details.
Thanks
I had this trouble with CPAN
The key in your error "You probably need to have 'make'."
sudo apt install build-essential
Will install makefile.pl
Strange that something essential is not installed by default?
gmake was not installed. After installing this worked fine! Thanks

Error while Installing Math::Pari

I'm trying to install Math::Pari module but getting error.
I'm installing on Windows Server 2012R2, I've Strawberry perl v5.18.4.1 32-bit currently installed on it.
Actually Math::Pari is dependency for Net::SSH::W32Perl and I want to install that module.
Following is the error log. Please Give me step by step installation procedure.
cpanm (App::cpanminus) 1.7039 on perl 5.018004 built for MSWin32-x64-multi-thread
Work directory is C:\Users\script/.cpanm/work/1438929213.2276
You have make C:\strawberry\c\bin\dmake.exe
You have LWP 6.08
Falling back to Archive::Tar 2.02
Searching Math::Pari () on cpanmetadb ...
--> Working on Math::Pari
Fetching http://www.cpan.org/authors/id/I/IL/ILYAZ/modules/Math-Pari-2.010808.zip
-> OK
Unpacking Math-Pari-2.010808.zip
Entering Math-Pari-2.010808/
Checking configure dependencies from META.json
Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (6.98)
Configuring Math-Pari-2.010808
Running Makefile.PL
Did not find GP/PARI build directory around.
Apparently, you are running a 64-bit Perl built with MicroSoft's compilers.
GP/PARI (at least the versions I know how to work with, 2.1.* and 2.3.*)
cannot be built in this environment. I won't auto-download GP/PARI.
If you believe that this message is printed erroneously, please report
(see files README and INSTALL), and put force_download on the command line:
perl Makefile.PL force_download
One can rerun Makefile.PL after fetching GP/PARI archive (e.g., pari-2.1.7.tgz,
or pari-2.3.4.tar.gz) manually to the current directory, or a (grand)parent
directory of the current directory.
[Keep in mind that the numbers "inside version" of Math::Pari module
correspond to the last versions of GP/PARI it was tested with (additionally,
2.0108* works best with the last 2.1.* version, 2.1.7).
As an alternative to having archive in CWD or its (grand)parent, specify
pari_tgz=PATH_TO_TAR_GZ
option to Makefile.PL.
There is no need to extract the archive, or build GP/PARI; but if you
have it extracted [and patched, if needed], you may specify
paridir=PATH_TO_DIST_DIR
option to Makefile.PL instead of `pari_tgz'. However, in this case
the files WON'T be auto-patched.
As a last-resort solution, there is also a possibility to use an already
compiled PARI library. See the documentation in README and INSTALL files.]
Could not find GP/PARI build directory, please run Makefile.PL
with paridir=/directory option.
-> N/A
-> FAIL Configure failed for Math-Pari-2.010808. See C:\Users\script\.cpanm\work\1438929213.2276\build.log for details.
I thought I'd add a note for anyone coming here as a result of a Google search after their own Math::Pari install fails under Strawberry Perl.
Here is what worked for me (Strawberry 5.22):
A. from the cpan shell, tried to install Math::Pari. this failed
B. Downloaded pari-2.1.7 and placed the extracted folder pari-2.1.7 in the cpan build folder that was created in (0). This is found, by default, in C:\Strawberry\cpan\build
C.perl Makefile.PL Configure machine=none
D. dmake
E. dmake install
It basically means that 64 bit versions of perl are not supported. It also means that if you're sure that you're running a 32 bit version incorrectly detected as 64 bit, you can try opening a command line and then doing
cd C:\Users\script\.cpanm\work\1438929213.2276\
perl Makefile.PL force_download

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.

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.