Page 1 of 1
Imagemagick 6.5.4 static compile
Posted: 2009-07-21T02:40:40-07:00
by revenga1
Hello.
I tried to compile a static version of Imagemagick 6.5.4:
Code: Select all
./configure --disable-shared --enable-delegate-build
make
The compile itself worked fine. But when i check the executables with ldd it says that they are still linked against:
linux-gate.so.1 => (0xb7f71000)
libgomp.so.1 => /usr/lib/libgomp.so.1 (0xb7f63000)
libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7f4b000)
libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7f25000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7dd6000)
librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb7dcd000)
/lib/ld-linux.so.2 (0xb7f72000)
What am I doing wrong?
Thanks for any help with this!
Re: Imagemagick 6.5.4 static compile
Posted: 2009-07-21T05:47:52-07:00
by magick
It looks like it worked, ImageMagick built statically as you wanted. If you want the system libraries to be static you need to compile them separately and link them with ImageMagick. You can add --disable-openmp and --without-threads to your configure script command line to eliminate the pthreads and libgomp dependency.
Re: Imagemagick 6.5.4 static compile
Posted: 2011-03-02T02:20:52-07:00
by mika
Hello!
I do really have this problem. I can not manage to compile magick++ statically. I configured as mentioned above ./configure --disable-shared --enable-delegate-build. The output configuration is as expected:
Option Value
-------------------------------------------------------------------------------
Shared libraries --enable-shared=no no
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=no no
Delegate Configuration:
BZLIB --with-bzlib=yes yes
Autotrace --with-autotrace=no no
Dejavu fonts --with-dejavu-font-dir=default none
DJVU --with-djvu=yes no
DPS --with-dps=yes no
FFTW --with-fftw=yes no
FlashPIX --with-fpx=yes no
FontConfig --with-fontconfig=yes yes
FreeType --with-freetype=yes yes
GhostPCL None pcl6 (unknown)
GhostXPS None gxps (unknown)
Ghostscript None gs (8.15.2)
Ghostscript fonts --with-gs-font-dir=default /usr/share/fonts/default/Type1/
Ghostscript lib --with-gslib=no no
Graphviz --with-gvc=yes no
JBIG --with-jbig=yes no
JPEG v1 --with-jpeg=yes yes
JPEG-2000 --with-jp2=yes no
LCMS v1 --with-lcms=yes no
LCMS v2 --with-lcms2=yes no
LQR --with-lqr=yes no
Magick++ --with-magick-plus-plus=yes yes
OpenEXR --with-openexr=yes no
PERL --with-perl=no no
PNG --with-png=yes yes
RSVG --with-rsvg=yes no
TIFF --with-tiff=yes yes
Windows fonts --with-windows-font-dir= none
WMF --with-wmf=yes no
X11 --with-x= yes
XML --with-xml=yes yes
ZLIB --with-zlib=yes yes
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 = 6.6.4
CC = gcc -std=gnu99 -std=gnu99
CFLAGS = -fopenmp -g -O2 -Wall -pthread
CPPFLAGS = -I/usr/local/include/ImageMagick
PCFLAGS = -fopenmp
DEFS = -DHAVE_CONFIG_H
LDFLAGS = -L/home/user/magick/magick -L/home/user/magick/wand
MAGICK_LDFLAGS = -L/usr/local/lib -L/home/user/magick/magick -L/home/user/magick/wand
LIBS = -lMagickCore -ltiff -lfreetype -ljpeg -lpng -lfontconfig -lXext -lXt -lSM -lICE -lX11 -lbz2 -lxml2 -lz -lm -lgomp -lpthread
CXX = g++
CXXFLAGS = -g -O2 -pthread
FEATURES = OpenMP
But when i ldd the executable, the shared version of the image libraries are used:
ldd convert
libtiff.so.3 => /usr/lib64/libtiff.so.3 (0x0000003d8ec00000)
libfreetype.so.6 => /usr/lib64/libfreetype.so.6 (0x0000003d90400000)
libjpeg.so.62 => /usr/lib64/libjpeg.so.62 (0x0000003d8fc00000)
libpng12.so.0 => /usr/lib64/libpng12.so.0 (0x0000003d91c00000)
libfontconfig.so.1 => /usr/lib64/libfontconfig.so.1 (0x0000003d90c00000)
libXext.so.6 => /usr/lib64/libXext.so.6 (0x0000003d90000000)
libXt.so.6 => /usr/lib64/libXt.so.6 (0x0000003d8e400000)
libbz2.so.1 => /usr/lib64/libbz2.so.1 (0x0000003d9a200000)
libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x0000003d9a600000)
libz.so.1 => /usr/lib64/libz.so.1 (0x0000003d8d400000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003d8d800000)
libSM.so.6 => /usr/lib64/libSM.so.6 (0x0000003d90800000)
libICE.so.6 => /usr/lib64/libICE.so.6 (0x0000003d91400000)
libX11.so.6 => /usr/lib64/libX11.so.6 (0x00002b595057f000)
libgomp.so.1 => /home/ygrandmaitre/local/gcc-4.4.4/lib/../lib64/libgomp.so.1 (0x00002b595088b000)
librt.so.1 => /lib64/librt.so.1 (0x0000003d93800000)
libm.so.6 => /lib64/libm.so.6 (0x0000003d8d000000)
libc.so.6 => /lib64/libc.so.6 (0x0000003d8c800000)
libexpat.so.0 => /lib64/libexpat.so.0 (0x0000003d8f800000)
libXau.so.6 => /usr/lib64/libXau.so.6 (0x0000003d8f000000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003d8cc00000)
/lib64/ld-linux-x86-64.so.2 (0x0000003d8c400000)
libXdmcp.so.6 => /usr/lib64/libXdmcp.so.6 (0x0000003d8f400000)
Any help would be appreciated!
Thanks!
Mika.
Re: Imagemagick 6.5.4 static compile
Posted: 2011-03-03T03:18:00-07:00
by mika
Hello,
I have two other questions:
- when i make the library, i get those two errors:
gcc: <lib_dir>/libjpeg.so: No such file or directory
gcc: <lib_dir>/libpng12.so: No such file or directory
(even though <lib_dir>/libjpeg.a and <lib_dir>/libpng12.a do exist... should'nt they be the ones linked during a static make?!!)
Then to fix this, i simply copied the required .so from /usr/lib/ to <lib_dir>.
- at the end, i actually get <lib_dir>/libMagick++.a <lib_dir>/libMagickWand.a, and <lib_dir>/libMagickCore.a, but obviously, these libraries are not sufficient for compiling my program; i get these errors in that case:
undefined reference to `Magick::Image::write(...`
undefined reference to `Magick::Geometry::Geometry(...`
For a successful compilation, i need to link with libMagickCore.a, and libMagick++.a, but those have not been generated during the ImageMagick compilation...
Any help, suggestion or remark will be strongly appreciated!
Thx!
Mika.
Re: Imagemagick 6.5.4 static compile
Posted: 2011-03-03T05:51:46-07:00
by magick
See
http://www.imagemagick.org/script/magick++.php. To properly link a program that calls the Magick++ API, use this command:
- c++ `Magick++-config --cxxflags --cppflags` -O2 -o demo demo.cpp \
`Magick++-config --ldflags --libs`
Re: Imagemagick 6.5.4 static compile
Posted: 2011-03-03T08:57:27-07:00
by mika
Thank you, this fixed my second problem!
Apparently, the problem was that i had several installations of imagemagick, and by calling Magick++-config (i tried that already before) i called an alias of the wrong binary... Specifying the whole location fixed that.
As for the first problem i mentioned: calling make at the root of the magick lib directory after a static configuration (./configure --disable-shared --enable-delegate-build) the .so are asked instead of using the existing .a, do you have any idea?
Thx!
Mika.
Re: Imagemagick 6.5.4 static compile
Posted: 2011-03-03T14:46:59-07:00
by Jason S
By design, --disable-shared disables the
creation of shared libraries, not the
use of shared libraries.
I'm not an autoconf/libtool expert, so take that into account. If you really want to statically link everything, including libc, the logical thing to try would be
Code: Select all
LDFLAGS="-static" ./configure --disable-shared ...
... but that's not enough, because libtool seems to want you to use a fake "-all-static" linker flag. But
configure won't work if do that. After running
configure, you could try editing the the top-level Makefile and appending "-all-static" to the LDFLAGS variable. But you're still likely to run into various problems.