how to compile imagick with png support?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Locked
zxsz4084
Posts: 25
Joined: 2015-03-31T01:31:44-07:00
Authentication code: 6789

how to compile imagick with png support?

Post by zxsz4084 »

I have installed jpeg,png at /home/www/jpeg,/home/www/png。I do not want to use sys default 。

jpegsrc.v9a.tar.gz
libpng-1.6.19.tar.gz


I use the following commands let it to find jpeg and png。

Code: Select all

export CFLAGS="-I/home/www/jpeg/include -I/home/www/png/include"
export LDFLAGS="-L/home/www/jpeg/lib -L/home/www/png/lib"
export LD_LIBRARY_PATH="/home/www/jpeg/lib:/home/www/png/lib"
but,it only finds jpeg,no png。 How to specify the path?

Code: Select all


[www@6rooms ImageMagick-7.0.7-38]$ pwd
/home/www/softwares/ImageMagick-7.0.7-38

[www@6rooms ImageMagick-7.0.7-38]$ cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core) 

[www@6rooms ImageMagick-7.0.7-38]$ ./configure --prefix=/home/www/ImageMagick5

the last part of output :

-------------------------------------------------------------
checking for PNG... no

.......

configure:
==============================================================================
ImageMagick is configured as follows. Please verify that this configuration
matches your expectations.

  Host system type: x86_64-pc-linux-gnu
  Build system type: x86_64-pc-linux-gnu

                 Option                        Value
  ------------------------------------------------------------------------------
  Shared libraries  --enable-shared=yes         yes
  Static libraries  --enable-static=yes         yes
  Build utilities   --with-utilities=yes        yes
  Module support    --with-modules=no           no
  GNU ld            --with-gnu-ld=yes           yes
  Quantum depth     --with-quantum-depth=16     16
  High Dynamic Range Imagery
                    --enable-hdri=yes           yes

  Install documentation:                        yes

  Delegate Library Configuration:
  BZLIB             --with-bzlib=yes            no
  Autotrace         --with-autotrace=no         no
  DJVU              --with-djvu=yes             no
  DPS               --with-dps=yes              no
  FFTW              --with-fftw=yes             no
  FLIF              --with-flif=yes             no
  FlashPIX          --with-fpx=yes              no
  FontConfig        --with-fontconfig=yes       no
  FreeType          --with-freetype=yes         no
  Ghostscript lib   --with-gslib=no             no
  Graphviz          --with-gvc=yes              no
  HEIC              --with-heic=yes             no
  JBIG              --with-jbig=yes             no
[color=#FF0000]  JPEG v1           --with-jpeg=yes             yes[/color]
  LCMS              --with-lcms=yes             no
  LQR               --with-lqr=yes              no
  LTDL              --with-ltdl=yes             no
  LZMA              --with-lzma=yes             yes
  Magick++          --with-magick-plus-plus=yes yes
  OpenEXR           --with-openexr=yes          no
  OpenJP2           --with-openjp2=yes          no
  PANGO             --with-pango=yes            no
  PERL              --with-perl=no              no
[color=#FF0000]  PNG               --with-png=yes              no[/color]
  RAQM              --with-raqm=yes             no
  RAW               --with-raw=yes         no
  RSVG              --with-rsvg=no              no
  TIFF              --with-tiff=yes             no
  WEBP              --with-webp=yes             no
  WMF               --with-wmf=yes              no
  X11               --with-x=                   no
  XML               --with-xml=yes              yes
  ZLIB              --with-zlib=yes             yes

  Delegate Program Configuration:
  GhostPCL          None                                pcl6 (unknown)
  GhostXPS          None                                gxps (unknown)
  Ghostscript       None                                gs (unknown)

  Font Configuration:
  Apple fonts       --with-apple-font-dir=default
  Dejavu fonts      --with-dejavu-font-dir=default      none
  Ghostscript fonts --with-gs-font-dir=default  none
  URW-base35 fonts  --with-urw-base35-font-dir=default  none
  Windows fonts     --with-windows-font-dir=default     none

  X11 Configuration:
        X_CFLAGS        = 
        X_PRE_LIBS      = 
        X_LIBS          = 
        X_EXTRA_LIBS    = 

  Options used to compile and link:
    PREFIX          = /home/www/ImageMagick5
    EXEC-PREFIX     = /home/www/ImageMagick5
    VERSION         = 7.0.7
    CC              = gcc -std=gnu99 -std=gnu99
    CFLAGS          = -I/usr/include/libxml2        -fopenmp -I/home/www/jpeg/include -I/home/www/png/include -Wall -mtune=core2 -fexceptions -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
    CPPFLAGS        =   -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
    PCFLAGS         = 
    DEFS            = -DHAVE_CONFIG_H
    LDFLAGS         = -L/home/www/jpeg/lib -L/home/www/png/lib
    LIBS            = 
    CXX             = g++
    CXXFLAGS        = -g -O2 -pthread
    FEATURES        = DPC HDRI Cipher OpenMP
    DELEGATES       = mpeg [color=#FF0000]jpeg[/color] lzma xml zlib


[www@6rooms ImageMagick-7.0.7-38]$ ll /home/www/png/include/
total 0
drwxr-xr-x 2 www yunwei 56 May 31 19:32 libpng16
lrwxrwxrwx 1 www yunwei 18 May 31 19:32 pngconf.h -> libpng16/pngconf.h
lrwxrwxrwx 1 www yunwei 14 May 31 19:32 png.h -> libpng16/png.h
lrwxrwxrwx 1 www yunwei 21 May 31 19:32 pnglibconf.h -> libpng16/pnglibconf.h
[www@6rooms ImageMagick-7.0.7-38]$ ll /home/www/png/lib/
total 2216
-rw-r--r-- 1 www yunwei 1426600 May 31 19:32 libpng16.a
-rwxr-xr-x 1 www yunwei     961 May 31 19:32 libpng16.la
lrwxrwxrwx 1 www yunwei      19 May 31 19:32 libpng16.so -> libpng16.so.16.19.0
lrwxrwxrwx 1 www yunwei      19 May 31 19:32 libpng16.so.16 -> libpng16.so.16.19.0
-rwxr-xr-x 1 www yunwei  832960 May 31 19:32 libpng16.so.16.19.0
lrwxrwxrwx 1 www yunwei      10 May 31 19:32 libpng.a -> libpng16.a
lrwxrwxrwx 1 www yunwei      11 May 31 19:32 libpng.la -> libpng16.la
lrwxrwxrwx 1 www yunwei      11 May 31 19:32 libpng.so -> libpng16.so
drwxr-xr-x 2 www yunwei      42 May 31 19:32 pkgconfig

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how to compile imagick with png support?

Post by fmw42 »

check your install log for your PNG install and be sure it worked correctly. I believe that libpng requires zlib be installed first.

zxsz4084
Posts: 25
Joined: 2015-03-31T01:31:44-07:00
Authentication code: 6789

Re: how to compile imagick with png support?

Post by zxsz4084 »

fmw42 wrote:
2018-06-06T11:16:31-07:00
check your install log for your PNG install and be sure it worked correctly. I believe that libpng requires zlib be installed first.
this is my install step。。

Code: Select all

cd /home/www/softwares
tar -xf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --prefix=/home/www/zlib
make -j20 && make install

#需要zlib
cd /home/www/softwares
tar -xf libpng-1.6.19.tar.gz
cd libpng-1.6.19
export LDFLAGS="-L/home/www/zlib/lib"
export CPPFLAGS="-I/home/www/zlib/include"
./configure --prefix=/home/www/png
make -j20 && make install


User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how to compile imagick with png support?

Post by fmw42 »

check the config.log when you compiled zlib and then libpng. see if there are any errors.

zxsz4084
Posts: 25
Joined: 2015-03-31T01:31:44-07:00
Authentication code: 6789

Re: how to compile imagick with png support?

Post by zxsz4084 »

finally,view congifure 's content,use this command to solve this eggcache problem.

Code: Select all

export PKG_CONFIG_PATH="/home/www/png/lib/pkgconfig"
but jpeg does not have dir "/home/www/jpeg/lib/pkgconfig", still use these

Code: Select all

export CPPFLAGS="-I/home/www/jpeg/include"
export LDFLAGS="-L/home/www/jpeg/lib"

Locked