Page 1 of 1

building a static ImageMagick binary

Posted: 2019-05-14T21:47:17-07:00
by peterbill
Hi,

I am trying to build a static ImageMagick binary to bundle in an AWS lambda function.

I have built and installed the following libraries all from source:
JasPer-2.0.14
Little CMS-1.19
Little CMS-2.9
libexif-0.6.21
libjpeg-turbo-1.5.2
libpng-1.6.32
LibTIFF-4.0.9
libwebp-0.6.1
OpenJPEG-2.3.0
JBIG-KIT
then I ran:
CODE: SELECT ALL

./configure --enable-shared=no --enable-static=yes
which gave me the following:
CODE: SELECT ALL

Option Value
------------------------------------------------------------------------------
Shared libraries --enable-shared=yes yes
Static libraries --enable-static=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 yes
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 yes
JPEG v1 --with-jpeg=yes yes
LCMS --with-lcms=yes yes
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 yes
PANGO --with-pango=yes no
PERL --with-perl=no no
PNG --with-png=yes yes
RAQM --with-raqm=yes no
RAW --with-raw=yes no
RSVG --with-rsvg=no no
TIFF --with-tiff=yes yes
WEBP --with-webp=yes yes
WMF --with-wmf=yes no
X11 --with-x= yes
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 /usr/share/fonts/dejavu/
Ghostscript fonts --with-gs-font-dir=default /usr/share/fonts/default/Type1/
URW-base35 fonts --with-urw-base35-font-dir=default
Windows fonts --with-windows-font-dir=default none

X11 Configuration:
X_CFLAGS =
X_PRE_LIBS = -lSM -lICE
X_LIBS =
X_EXTRA_LIBS =

Options used to compile and link:
PREFIX = /usr/local
EXEC-PREFIX = /usr/local
VERSION = 7.0.7
CC = gcc -std=gnu99 -std=gnu99
CFLAGS = -I/usr/include/libxml2 -I/usr/include/libpng12 -I/usr/include/openjpeg-2.1 -fopenmp -g -O2 -Wall -mtune=core-avx2 -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 =
CXX = g++
CXXFLAGS = -g -O2 -pthread
FEATURES = DPC HDRI Cipher OpenMP
DELEGATES = bzlib mpeg jbig jng jpeg lcms lzma openjp2 png tiff webp x xml zlib

Which shows me the delegates I need are all available. Then I tried calling make but I got this error:
CODE: SELECT ALL

MagickCore/.libs/libMagickCore-7.Q16HDRI.so: undefined reference to `WebPMemoryWriterClear'
collect2: error: ld returned 1 exit status
make[1]: *** [utilities/magick] Error 1
make[1]: Leaving directory `/home/ec2-user/ImageMagick'
make: *** [install] Error 2
I believe its something to do with libwebp. I tried rebuilding libwebp several times, they all succeed and I do not get any errors.

What am I missing here? I tried building it before without enabling static and it worked fine.

Re: building a static ImageMagick binary

Posted: 2019-07-05T05:31:50-07:00
by gojko
Check out https://github.com/serverlesspub/imagem ... s-lambda-2 - this is a working build of ImageMagick 7.0.8 and all required dependencies for AWS Lambda (with makefile that makes it easy to configure dependent library versions)