Page 1 of 1

Compiling ImageMagick (64 bit libraries?)

Posted: 2011-04-18T14:20:13-07:00
by h1d3m3
Trying to build latest Imagemagick with more recent versions of JPEG and PNG than is available on my operating system. It seems like doing a delegate build was the way to go:

- Unzipped Imagemagick
- From the delegates directory (on the IM website) downloaded and unzipped libpng-1.5.2.tar.gz (called the dir png) and jpegsrc.v8b.tar.gz (dir called jpeg)
- run ./configure --disable-shared --enable-delegate-build
- This looks good from configure status:
LDFLAGS = -L/src/ImageMagick/ImageMagick-6.6.9-5/jpeg -L/src/ImageMagick/ImageMagick-6.6.9-5/magick -L/src/ImageMagick/ImageMagick-6.6.9-5/png -L/src/ImageMagick/ImageMagick-6.6.9-5/wand
- Build completes, run make check:
===========================================
2 of 48 tests failed
See ./test-suite.log
Please report to http://www.imagemagick.org
===========================================
2 of 48 tests failed.

.. contents:: :depth: 2


FAIL: tests/validate-formats-in-memory.sh (exit: 1)
===================================================

Version: ImageMagick 6.6.9-5 2011-04-18 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC

ImageMagick Validation Suite (FormatsInMemory)
test 219: ICON/Undefined/TrueColoWrong JPEG library version: library is 62, caller expects 80
r/12-bits... pass.
test 220: ICON/Undefined/TrueColor/16-bits... pass.
test 221: JPEG/Undefined/TrueColor/8-bits
FAIL: tests/validate-formats-on-disk.sh (exit: 1)
=================================================

Version: ImageMagick 6.6.9-5 2011-04-18 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC

ImageMagick Validation Suite (FormatsOnDisk)
(These tests do not fail when doing a vanilla build.)

- When installed, looking at the libraries the binary uses, it is referencing:
#ldd ./convert | grep -i usr
[snip]
libpng12.so.0 => /usr/lib64/libpng12.so.0
libjpeg.so.62 => /usr/lib64/libjpeg.so.62
I guess I'm concerned that its still using the old jpeg/png lib version. I tried to use a different method for compilation, but it too seems to be referencing older 64 bit libraries in /usr/lib64/libjpeg.so.62.
./configure CPPFLAGS='-I/src/ImageMagick/jpeg-8c -I/src/ImageMagick/libpng-1.5.2 -I/src/ImageMagick/tiff-3.9.5' LDFLAGS='-L/src/ImageMagick/jpeg-8c -L/src/ImageMagick/libpng-1.5.2 -L/src/ImageMagick/tiff-3.9.5'
How do I prevent IM from using that old library version? Can I create a newer /usr/lib64/libjpeg.so library myself using libjpeg src? (it doesn't seem to make that on its own_.

Any ideas welcome :-)

Re: Compiling ImageMagick (64 bit libraries?)

Posted: 2011-04-19T16:02:53-07:00
by Jason S
I don't fully understand what "--enable-delegate-build" does. As far as I can tell, it looks in special subdirectories such as "png" for library and header files. But simply installing libpng into the "png" subdir didn't work, apparently because IM didn't like the directory layout that libpng uses.

For what it's worth, here's how I got IM to use a new version of libpng, in a static library.

Code: Select all

cd /src
tar xvjf ImageMagick-6.6.9-5.tar.bz2
tar xvjf libpng-1.5.2.tar.bz2

cd /src/libpng-1.5.2
./configure --disable-shared --prefix=/src/ImageMagick-6.6.9-5/png --libdir=/src/ImageMagick-6.6.9-5/png --includedir=/src/ImageMagick-6.6.9-5/png
make
make install

cd /src/ImageMagick-6.6.9-5
./configure --disable-shared --enable-delegate-build --without-rsvg
make
make check
===================
All 48 tests passed
===================
The first time I tried this, IM added both -I/usr/include/libpng12 and -I/src/ImageMagick-6.6.9-5/png as compiler flags. The first one (the bad one) happened because it auto-configured rsvg/cairo, which I assume is a library that depends on libpng. So I disabled rsvg.

I didn't try libjpeg. I assume you'd have to at least disable tiff support, or build your own libtiff.

Re: Compiling ImageMagick (64 bit libraries?)

Posted: 2011-04-21T13:42:06-07:00
by h1d3m3
Thanks so much for the post. You got me on the right track. There were a few items I either overlooked or was poorly documented:

* The delegate libraries should be compiled with a --prefix that matches the format name for imagemagick (i.e. make install for the png library should go into the png directory under the main imagemagick source dir.)
* The TIFF delegate is seen by configure only if the directories tiff/libtiff is seen. The TIFF libs do not create that when installed. I ended up doing a simple "ln -s . libtiff" in the tiff directory and it did the trick.
* Ensure when building libtiff, it points to the right jpeg libraries (i.e. set --with-jpeg-lib-dir and --with-jpeg-include-dir correctly)

This created a working version of IM that uses all of the newer libraries.

Hope this helps others.

Re: Compiling ImageMagick (64 bit libraries?)

Posted: 2011-05-17T11:22:58-07:00
by joluinfante
Hi!
I did try to build a 64 bit static convert, but, I can't.
I did:

export THIS_DIR=/instalar/ImageMagick/ImageMagick-6.6.9-9
cd ${THIS_DIR}
rm -rf zlib jpeg freetype png tiff
mkdir -p zlib jpeg freetype png tiff
# Build of zlib's .a
cd ../zlib-1.2.5
./configure --prefix=${THIS_DIR}/zlib; make; make install
# Build of liblibjpeg.a
cd ../jpeg-8c
./configure --prefix=${THIS_DIR}/jpeg; make; make install
# Build of libfreetype.a
cd ../freetype-2.4.4
./configure --prefix=${THIS_DIR}/freetype; make; make install
# Build of libpng.a
cd ../libpng-1.5.2
./configure --prefix=${THIS_DIR}/png; make; make install
# Build of libtiff's .a
cd ../tiff-3.9.5
./configure --prefix=${THIS_DIR}/tiff \
--with-zlib-include-dir=${THIS_DIR}/zlib-1.2.5/ \
--with-jpeg-include-dir=${THIS_DIR}/jpeg-8c/ \
--with-zlib-lib-dir=${THIS_DIR}/zlib-1.2.5/ \
# Build of ImageMagick "static"
./configure --enable-static --disable-shared --without-threads --enable-delegate-build

But, at end of build:

ldd utilities/convert
linux-vdso.so.1 => (0x00007fff4b710000)
libtiff.so.4 => /usr/lib/libtiff.so.4 (0x00007fdc2001d000)
libc.so.6 => /lib/libc.so.6 (0x00007fdc1fc9b000)
libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x00007fdc1fa76000)
libpng12.so.0 => /lib/libpng12.so.0 (0x00007fdc1f84f000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007fdc1f61a000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00007fdc1f407000)
libXt.so.6 => /usr/lib/libXt.so.6 (0x00007fdc1f1a2000)
libz.so.1 => /lib/libz.so.1 (0x00007fdc1ef8b000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x00007fdc1ed81000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x00007fdc1eb66000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00007fdc1e830000)
libgomp.so.1 => /usr/lib/libgomp.so.1 (0x00007fdc1e621000)
libm.so.6 => /lib/libm.so.6 (0x00007fdc1e39e000)
/lib64/ld-linux-x86-64.so.2 (0x00007fdc202a4000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007fdc1e118000)
libexpat.so.1 => /lib/libexpat.so.1 (0x00007fdc1deee000)
libuuid.so.1 => /lib/libuuid.so.1 (0x00007fdc1dce9000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007fdc1dacd000)
libdl.so.2 => /lib/libdl.so.2 (0x00007fdc1d8c8000)
librt.so.1 => /lib/librt.so.1 (0x00007fdc1d6c0000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007fdc1d4a3000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00007fdc1d29e000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007fdc1d098000)

Can any help me, please?