Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Building with -MCPAN but cannot find libraries

by mldvx4 (Friar)
on Jul 30, 2022 at 19:13 UTC ( [id://11145860] : perlquestion . print w/replies, xml ) Need Help??

mldvx4 has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying add Image::Scale manually using -MCPAN, but get an error in that the installation process cannot find the installed libraries:

# perl -MCPAN -e shell

Once in the shell, I try to install the module:

cpan[1]> install Image::Scale Reading '/root/.cpan/Metadata' Database was generated on Sat, 30 Jul 2022 16:29:03 GMT Running install for module 'Image::Scale' Checksum for /root/.cpan/sources/authors/id/A/AG/AGRUNDMA/Image-Scale- +0.14.tar.gz ok Scanning cache /root/.cpan/build for sizes ...................................................................... +......DONE 'YAML' not installed, will not store persistent state Configuring A/AG/AGRUNDMA/Image-Scale-0.14.tar.gz with Makefile.PL Image::Scale requires at least one of libjpeg or libpng, please instal +l one or both and try again. No 'Makefile' created AGRUNDMA/Image-Scale-0.14.tar.gz /usr/bin/perl Makefile.PL -- NOT OK Failed during this command: AGRUNDMA/Image-Scale-0.14.tar.gz : writemakefile NO -- No + 'Makefile' created

The system seems to have the libraries installed:

$ find / -type f \( -name 'libpng*' -o -name 'libjpeg*' \) -print /usr/lib/ /usr/lib/ /usr/lib/libpng16.a

What steps have I missed or gotten wrong?

Replies are listed 'Best First'.
Re: Building with -MCPAN but cannot find libraries
by choroba (Cardinal) on Jul 30, 2022 at 20:28 UTC
    You also need to install the libraries' header files (e.g. /usr/include/libpng16/png.h or whatever your system uses). They are usually located in devel packages, i.e. libpng-devel-*.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

      Thanks! I appreciate it. I succeeded now after adding the development packages for libpng, etc. I also had to add perl-dev and musl-dev.

      % perl -MImage::Scale -e 'exit' % echo $? 0