Install LIBPNG from Source Code

This section provides a tutorial example on how to install LIBPNG library manually from source code files on macOS.

From last tutorial, we know that Imager::File::PNG requires the PNG library. Here what I did to install it from its source code.

1. Go to LIBPNG Website at

2. Clicks "Files > libpng16 > 1.6.37" and download "libpng-1.6.37.tar.gz".

3. Unzip and untar it to extract source files in libpng-1.6.37 folder.

4. Build binary files with these commands:

herong$ mkdir ~/lib/libpng
herong$ cd libpng-1.6.37

herong$ ./configure --prefix=/Users/herong/lib/libpng
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libpng.pc
config.status: creating libpng-config
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands

herong$ make check
rm -f pnglibconf.c[45]
awk -f ./scripts/options.awk out=pnglibconf.tf4 version=search\
	    ./pngconf.h ./scripts/pnglibconf.dfa\
	    ./pngusr.dfa  1>&2
awk -f ./scripts/options.awk out=pnglibconf.tf5 pnglibconf.tf4 1>&2
rm pnglibconf.tf4
mv pnglibconf.tf5 pnglibconf.c
PASS: tests/pngimage-quick
PASS: tests/pngimage-full
Testsuite summary for libpng 1.6.37
# TOTAL: 33
# PASS:  33
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0

herong$ make install
/Library/Developer/CommandLineTools/usr/bin/make  install-am
 ./install-sh -c -d '/Users/herong/lib/libpng/lib'
 /bin/sh ./libtool   --mode=install /usr/bin/install \
    -c '/Users/herong/lib/libpng/lib'
libtool: install: /usr/bin/install -c .libs/libpng16.16.dylib \
+ ln -s libpng16/pngconf.h pngconf.h
+ cd /Users/herong/lib/libpng/lib/pkgconfig
+ rm -f libpng.pc
+ ln -s libpng16.pc libpng.pc

Now we have LIBPNG library ready in the ~/lib/libpng folder.


Table of Contents

 About This Book

 Perl on Linux Systems

 ActivePerl on Windows Systems

 Data Types: Values and Variables

 Expressions, Operations and Simple Statements

 User Defined Subroutines

 Perl Built-in Debugger

 Name Spaces and Perl Module Files

 Symbolic (or Soft) References

 Hard References - Addresses of Memory Objects

 Objects (or References) and Classes (or Packages)

 Typeglob and Importing Identifiers from Other Packages

 String Built-in Functions and Performance

 File Handles and Data Input/Output

 Open Files in Binary Mode

 Open Directories and Read File Names

 File System Functions and Operations

Image and Picture Processing

 Imager - Create and Save Image

 Imager - Draw Graphical Elements

 Imager - Convert Image File Format

 Imager::File::PNG - PNG File Format

Install LIBPNG from Source Code

 Install Imager::File::PNG Manually

 Install PerlMagick from Source Code

 Using DBM Database Files

 Using MySQL Database Server

 Socket Communication Over the Internet

 XML::Simple Module - XML Parser and Generator

 XML Communication Model

 SOAP::Lite - SOAP Server-Client Communication Module

 Perl Programs as IIS Server CGI Scripts

 CGI (Common Gateway Interface)

 XML-RPC - Remote Procedure Call with XML and HTTP

 RPC::XML - Perl Implementation of XML-RPC

 Integrating Perl with Apache Web Server Module for Building Web Pages

 LWP::UserAgent and Web Site Testing

 Converting Perl Script to Executable Binary

 Managing Perl Engine and Modules on macOS


 Full Version in PDF/EPUB