How to Compile imagemagick from source, configured with webp on ubuntu 18.04

How to Compile imagemagick from source, configured with webp on ubuntu 18.04

Process:

Enable Source package repository on Ubuntu 18.04

root@linuxhelp:~# vim /etc/apt/sources.list

Run the apt update command

root@linuxhelp:~# apt update
Hit:1 http://in.archive.ubuntu.com/ubuntu cosmic InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu cosmic-updates InRelease                            
Hit:3 http://in.archive.ubuntu.com/ubuntu cosmic-backports InRelease                          
Hit:4 http://ppa.launchpad.net/ondrej/php/ubuntu cosmic InRelease                             
Hit:5 http://security.ubuntu.com/ubuntu cosmic-security InRelease        
Reading package lists... Done                      
Building dependency tree       
Reading state information... Done
448 packages can be upgraded. Run 'apt list --upgradable' to see them.

Install the build essential and imagemagick by using the following command

root@linuxhelp:~# apt install build-essential imagemagick
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  build-essential imagemagick
0 upgraded, 2 newly installed, 0 to remove and 448 not upgraded.
Need to get 19.1 kB of archives.
After this operation, 144 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu cosmic/main amd64 build-essential amd64 12.5ubuntu2 [4,732 B]
Get:2 http://in.archive.ubuntu.com/ubuntu cosmic-updates/main amd64 imagemagick amd64 8:6.9.10.8+dfsg-1ubuntu2.2 [14.4 kB]
Fetched 19.1 kB in 0s (71.9 kB/s) 
Selecting previously unselected package build-essential.
(Reading database ... 141405 files and directories currently installed.)
Preparing to unpack .../build-essential_12.5ubuntu2_amd64.deb ...
Unpacking build-essential (12.5ubuntu2) ...
Selecting previously unselected package imagemagick.
Preparing to unpack .../imagemagick_8%3a6.9.10.8+dfsg-1ubuntu2.2_amd64.deb ...
Unpacking imagemagick (8:6.9.10.8+dfsg-1ubuntu2.2) ...
Setting up build-essential (12.5ubuntu2) ...
Setting up imagemagick (8:6.9.10.8+dfsg-1ubuntu2.2) ...

Download the imagemagick source installation by using the following command

root@linuxhelp:~# wget https://www.imagemagick.org/download/ImageMagick.tar.gz
--2019-09-04 04:18:38--  https://www.imagemagick.org/download/ImageMagick.tar.gz
Resolving www.imagemagick.org (www.imagemagick.org)... 198.72.81.86
Connecting to www.imagemagick.org (www.imagemagick.org)|198.72.81.86|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13741727 (13M) [application/x-gzip]
Saving to: ‘ImageMagick.tar.gz’

ImageMagick.tar.gz         100%[======================================>]  13.10M  1.12MB/s    in 13s     

2019-09-04 04:18:52 (1.01 MB/s) - ‘ImageMagick.tar.gz’ saved [13741727/13741727]

Extract the imagemagick by using the following command

root@linuxhelp:~# tar -xvf ImageMagick.tar.gz 
ImageMagick-7.0.8-63/
ImageMagick-7.0.8-63/Install-unix.txt
ImageMagick-7.0.8-63/ChangeLog
ImageMagick-7.0.8-63/winpath.sh
ImageMagick-7.0.8-63/index.html
ImageMagick-7.0.8-63/NOTICE
ImageMagick-7.0.8-63/scripts/
ImageMagick-7.0.8-63/scripts/xsnap
.
.
ImageMagick-7.0.8-63/www/cipher.html
ImageMagick-7.0.8-63/www/mogrify.html
ImageMagick-7.0.8-63/www/gradient.html
ImageMagick-7.0.8-63/www/install-source.html
ImageMagick-7.0.8-63/version.sh
ImageMagick-7.0.8-63/aclocal.m4
ImageMagick-7.0.8-63/Install-mac.txt
ImageMagick-7.0.8-63/README.txt

Enter into the imagemagick directory

root@linuxhelp:~# cd ImageMagick-7.0.8-63/

Run the configure command to configuration and to make sure that all compilation dependencies are met
root@linuxhelp:~/ImageMagick-7.0.8-63# ./configure --with-webp=yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
.
.
.
Options used to compile and link:
    PREFIX          = /usr/local
    EXEC-PREFIX     = /usr/local
    VERSION         = 7.0.8
    CC              = gcc
    CFLAGS          =  -fopenmp -g -O2 -Wall -mtune=sandybridge -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         = 
    LIBS            =                                        -lm    
    CXX             = g++
    CXXFLAGS        = -g -O2 -mtune=sandybridge -pthread
    FEATURES        = DPC HDRI Cipher OpenMP
    DELEGATES       = mpeg ps

Execute the make command to perform the compilation:

root@linuxhelp:~/ImageMagick-7.0.8-63# make
make  all-am
make[1]: Entering directory '/root/ImageMagick-7.0.8-63'
  CC       utilities/magick.o
  CC       MagickCore/libMagickCore_7_Q16HDRI_la-accelerate.lo
  CC       MagickCore/libMagickCore_7_Q16HDRI_la-animate.lo
  CC       MagickCore/libMagickCore_7_Q16HDRI_la-annotate.lo
  CC       MagickCore/libMagickCore_7_Q16HDRI_la-artifact.lo
  CC       MagickCore/libMagickCore_7_Q16HDRI_la-attribute.lo
  CC       MagickCore/libMagickCore_7_Q16HDRI_la-blob.lo
  CC       MagickCore/libMagickCore_7_Q16HDRI_la-cache.lo
.
.
  CXX      Magick++/lib/libMagick___7_Q16HDRI_la-Thread.lo
  CXX      Magick++/lib/libMagick___7_Q16HDRI_la-TypeMetric.lo
  CXXLD    Magick++/lib/libMagick++-7.Q16HDRI.la
ar: `u' modifier ignored since `D' is the default (see `U')
cp -f MagickCore/ImageMagick.pc MagickCore/ImageMagick-7.Q16HDRI.pc
cp -f MagickCore/MagickCore.pc MagickCore/MagickCore-7.Q16HDRI.pc
cp -f MagickWand/MagickWand.pc MagickWand/MagickWand-7.Q16HDRI.pc
cp -f Magick++/lib/Magick++.pc Magick++/lib/Magick++-7.Q16HDRI.pc
make[1]: Leaving directory '/root/ImageMagick-7.0.8-63'

Install ImageMagick by executing the following command

root@linuxhelp:~/ImageMagick-7.0.8-63# make install
make  install-am
make[1]: Entering directory '/root/ImageMagick-7.0.8-63'
make[2]: Entering directory '/root/ImageMagick-7.0.8-63'
 /bin/mkdir -p '/usr/local/lib'
 /bin/bash ./libtool   --mode=install /usr/bin/install -c   MagickCore/libMagickCore-7.Q16HDRI.la MagickWand/libMagickWand-7.Q16HDRI.la Magick++/lib/libMagick++-7.Q16HDRI.la '/usr/local/lib'
libtool: install: /usr/bin/install -c MagickCore/.libs/libMagickCore-7.Q16HDRI.so.6.0.0 /usr/local/lib/libMagickCore-7.Q16HDRI.so.6.0.0
.
.
/usr/bin/install -c -m 644 MagickCore/MagickCore-config.1 MagickWand/MagickWand-config.1 Magick++/bin/Magick++-config.1 utilities/ImageMagick.1 utilities/animate.1 utilities/compare.1 utilities/composite.1 utilities/conjure.1 utilities/convert.1 utilities/display.1 utilities/identify.1 utilities/import.1 utilities/magick.1 utilities/magick-script.1 utilities/mogrify.1 utilities/montage.1 utilities/stream.1 '/usr/local/share/man/man1'
 /bin/mkdir -p '/usr/local/lib/pkgconfig'
 /usr/bin/install -c -m 644 MagickCore/ImageMagick.pc MagickCore/MagickCore.pc MagickCore/ImageMagick-7.Q16HDRI.pc MagickCore/MagickCore-7.Q16HDRI.pc MagickWand/MagickWand.pc MagickWand/MagickWand-7.Q16HDRI.pc Magick++/lib/Magick++.pc Magick++/lib/Magick++-7.Q16HDRI.pc '/usr/local/lib/pkgconfig'
make[2]: Leaving directory '/root/ImageMagick-7.0.8-63'
make[1]: Leaving directory '/root/ImageMagick-7.0.8-63'

Run ldconfig to link static libraries

root@linuxhelp:~/ImageMagick-7.0.8-63# ldconfig /usr/local/lib
 Execute the indentify command to confirm the installed version:
root@linuxhelp:~/ImageMagick-7.0.8-63# identify -version
Version: ImageMagick 7.0.8-63 Q16 x86_64 2019-09-04 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP(4.5) 
Delegates (built-in):

With this tutorial,the method to compile imagemagick from source, configured with webp on ubuntu 18.04 comes to end

FAQ
Q
How many image formats can ImageMagick read and write?
A
ImageMagick can read and write over 200 image file formats.
Q
What is ImageMagick 7v Used for?
A
ImageMagick is a free and open-source software suite for displaying, converting and editing raster image and vector image files.
Q
What does Dynamic binding mean in ImageMagick 7 v?
A
Dynamic binding is the process of linking procedure call to a specific sequence code at run-time, which means that a code to be executed for a specific procedure call is not known until run-time In ImageMagick 7v.
Q
What does shared library mean in ImageMagick 7v?
A
A shared library or Dynamic library are loaded when a program is launched and loaded into memory and binding occurs at a run time In ImageMagick 7v
Q
What is the use of dynamic linker In ImageMagick 7 v?
A
The dynamic linker is a special part of the operating system that loads external shared libraries into a running process and then binds those shared libraries dynamically to the running process In ImageMagick.