简体   繁体   中英

Perl Imager - libpng PNG libraries or headers not found

I am trying to run Perl script in Terminal - the outcome should be image.png (picture of OID for "magical pen"), but I keep running error. Not being programmer I used all my googling skills for more than a month with no success. I use MacBook - macOS Monterey.

  • Installed Homebrew,
  • used the brew install perl,
  • than brew install libpng,
  • in the perl -MCPAN -eshell tried to install Imager (and YAML and MP3::Info that is also needed) - that didn't show any errors.

I am certain that this should work (tried the same steps on an older MacBook and the script ran just fine). During the installation on the other Mac there were no issues, on my Mac I had to do some changes for the Home-brew. I am also not sure, if the Imager can use the libpng. Well, don't ask me why, but I tried to install Imager::File::PNG and this is what I get:

Running install for module 'Imager::File::PNG' Checksum for /Users/darina/.cpan/sources/authors/id/T/TO/TONYC/Imager-File-PNG-0.99.tar.gz ok Scanning cache /Users/darina/.cpan/build for sizes............................................................................DONE Configuring T/TO/TONYC/Imager-File-PNG-0.99.tar.gz with Makefile.PL PNG: building independently PNG: Generic: includes not found - libraries found PNG: v1.6: includes not found - libraries found PNG: v1.5: includes not found - libraries not found PNG: v1.4: includes not found - libraries not found PNG: v1.2: includes not found - libraries not found PNG: v1.0: includes not found - libraries not found PNG: base (+libz): includes not found - libraries not found PNG: v1.6 (+libz): includes not found - libraries not found PNG: v1.5 (+libz): includes not found - libraries not found PNG: v1.4 (+libz): includes not found - libraries not found PNG: v1.2 (+libz): includes not found - libraries not found PNG: v1.0 (+libz): includes not found

  • libraries not found PNG: Checking if the compiler can find them on its own PNG: Test code failed: Can't link/include 'png.h', 'stdio.h', 'png' OS unsupported: PNG libraries or headers not found Warning: No success on command[/usr/local/Homebrew/Cellar/perl/5.34.0/bin/perl Makefile.PL] TONYC/Imager-File-PNG-0.99.tar.gz /usr/local/Homebrew/Cellar/perl/5.34.0/bin/perl Makefile.PL -- NOT OK Failed during this command: TONYC/Imager-File-PNG-0.99.tar.gz: writemakefile NO '/usr/local/Homebrew/Cellar/perl/5.34.0/bin/perl Makefile.PL' returned status 512

Can anyone help me please, preferably with very detailed instructions like for a child? Thank you Darina

The error message has "PNG libraries or headers not found". This means that you need to install extra stuff. Package managers often have multiple packages for a library, such as the libpng and libpng-dev . The latter one includes the header files and other things that another library would need to use libpng .

SOLVED. I finally made it work. Possibly not the best solution since I am mostly copying and pasting other people solution (this was not Perl or Imager related).

I installed pkg-config (again via brew install pkg-config), than used pkg-config --cflags libpng, which actually found the directory of the package and then it finally let me install the Imager::File::PNG - saying PNG: Found via pkg-config libpng.

For people, who actually know, what just happened, feel free to leave a comment, I definitely won't be offended.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM