linkage problem with libMagick++

Bug #179369 reported by Popolon
2
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
Unassigned

Bug Description

At the configure time, the libMagick++ is marked as not valid because of the libXext X11 libs search path:

configure:13584: checking for InitializeMagick in -lMagick++
configure:13619: g++ -o conftest -fomit-frame-pointer -funroll-loops -O3 -march
=i686 conftest.cpp -lMagick++ -llcms -lfreetype -ljpeg -lfontconfig -lXext -l
SM -lICE -lX11 -lz -lpthread -lm -lpthread -lgc -llcms -lpoppler -lpoppler-
glib >&5
/usr/bin/ld: cannot find -lXext
collect2: ld returned 1 exit status

In my case X11 libs are in /usr/X11/lib/

/usr/X11/lib/libXext.so

modifying the configure script resolve the problem

Tags: build
Revision history for this message
Luca Bruno (lucab) wrote :

Can you please point out how would you modify the configure.ac?
I was really thinking that those search path should be handled by pkg-config and I haven't encountered such an issue so far in my build.

Changed in inkscape:
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Popolon (popolon) wrote :

That's not the case in ImageMagick-6.3.4 at least.

I'm not an expert of configure.ac but, in my autogen.sh generated (from svn) configure script, I have the following libs : LIBS="-lMagick++ -llcms -lfreetype -ljpeg -lfontconfig -lXext -lSM -lICE -lX11 -lz -lpthread -lm -lpthread $LIBS"

libXext and libX11 are not in the ImagaMagick pkg-config definition files too, instead Magick++-config script is called from configure.ac
It is called with the --libs to have libs
and shoud be called with --ldflags to have ldflags (library path are in ldflags), this return to me :

-L/opt/gfx/imagemagick-6.3.4/lib -L/opt/X11R7.2/lib -lfreetype -lz

Here are the change that works for me :

AC_CHECK_LIB(Magick++, InitializeMagick, [AC_CHECK_HEADER(Magick++.h, magick_ok=yes, magick_ok=no)], magick_ok=no, -llcms -lfreetype -ljpeg -lfontconfig -lXext -lSM -lICE -lX11 -lz -lpthread -lm -lpthread `Magick++-config --ldflags`)

if test "x$magick_ok" = "xyes"; then
        AC_CHECK_PROG(MAGICKPP_CONFIG, Magick++-config, yes, no)
        if test "x$MAGICKPP_CONFIG" = "xyes"; then
                IMAGEMAGICK_LIBS=`Magick++-config --libs`
                IMAGEMAGICK_LDFLAGS=`Magick++-config --ldflags`
                AC_SUBST(IMAGEMAGICK_LIBS)
                AC_SUBST(IMAGEMAGICK_LDFLAGS)
                AC_DEFINE(WITH_IMAGE_MAGICK,1,[Image Magick++ support for bitmap effects])
        fi
fi

I believe than only changing :

AC_CHECK_LIB(Magick++, InitializeMagick, [AC_CHECK_HEADER(Magick++.h, magick_ok=yes, magick_ok=no)], magick_ok=no, -llcms -lfreetype -ljpeg -lfontconfig -lXext -lSM -lICE -lX11 -lz -lpthread -lm -lpthread `Magick++-config --ldflags`)

and
IMAGEMAGICK_LIBS=`Magick++-config --libs`
by
IMAGEMAGICK_LIBS=`pkg-config --libs Imagemagick++`

is enough, but I have check more.

Revision history for this message
Popolon (popolon) wrote :

I contacted the dev of Imagemagick via their mailing list and they suggest to use pkg-config now.

AC_CHECK_LIB(Magick++, InitializeMagick, [AC_CHECK_HEADER(Magick++.h, magick_ok
=yes, magick_ok=no)], magick_ok=no)

if test "x$magick_ok" = "xyes"; then
        AC_CHECK_PROG(MAGICKPP_CONFIG, Magick++-config, yes, no)
        if test "x$MAGICKPP_CONFIG" = "xyes"; then
                IMAGEMAGICK_LIBS=`pkg-config --libs ImageMagick++`
                AC_SUBST(IMAGEMAGICK_LIBS)
                AC_DEFINE(WITH_IMAGE_MAGICK,1,[Image Magick++ support for bitma
p effects])
        fi
fi

Should be the best method to use, there is no need to check for all this libs, imagemagick can be compiled without them to run on server or be called by inkscape. The X11 stuff is for image viewer integrated into Imagemagick and called display. Windows and native MacOSX version will not have to link to X11 too.

This work well in my case, some tests could be done, but I believe this is enough.

Revision history for this message
Popolon (popolon) wrote :

A cleaner replacement, but in this case, if imagemagicks objects was compiled and Magick++ is in list of dependencies of Inkscape, I don't have the raster submenu in Inkscape (it was here with previous modification)

PKG_CHECK_MODULES(IMAGEMAGICK, ImageMagick++, magick_ok=yes, magick_ok=no)
if test "x$magick_ok" = "xyes"; then
      AC_DEFINE(USE_IMAGE_MAGICK,1,[Image Magick++ support for bitmap effects])
fi
AM_CONDITIONAL(USE_IMAGE_MAGICK, test "x$magick_ok" = "xyes")
AC_SUBST(IMAGEMAGICK_LIBS)
AC_SUBST(IMAGEMAGICK_CFLAGS)

Revision history for this message
Popolon (popolon) wrote :

svn diff :

Index: configure.ac
===================================================================
--- configure.ac (revision 18581)
+++ configure.ac (working copy)
@@ -601,18 +601,13 @@
 dnl Check for ImageMagick Magick++
 dnl ******************************

-AC_CHECK_LIB(Magick++, InitializeMagick, [AC_CHECK_HEADER(Magick++.h, magick_ok=yes, magick_ok=no)], magick_ok=no, -llcms -lfreetype -ljpeg -lfontconfig -lXext -lSM -lICE -lX11 -lz -lpthread -lm -lpthread)
-
+PKG_CHECK_MODULES(IMAGEMAGICK, ImageMagick++, magick_ok=yes, magick_ok=no)
 if test "x$magick_ok" = "xyes"; then
- AC_CHECK_PROG(MAGICKPP_CONFIG, Magick++-config, yes, no)
- if test "x$MAGICKPP_CONFIG" = "xyes"; then
- IMAGEMAGICK_LIBS=`Magick++-config --libs`
- AC_SUBST(IMAGEMAGICK_LIBS)
- AC_DEFINE(WITH_IMAGE_MAGICK,1,[Image Magick++ support for bitmap effects])
- fi
+ AC_DEFINE(USE_IMAGE_MAGICK,1,[Image Magick++ support for bitmap effects])
 fi
-
 AM_CONDITIONAL(USE_IMAGE_MAGICK, test "x$magick_ok" = "xyes")
+AC_SUBST(IMAGEMAGICK_LIBS)
+AC_SUBST(IMAGEMAGICK_CFLAGS)

 dnl ******************************
 dnl Unconditional dependencies

Revision history for this message
Popolon (popolon) wrote :

After some test AC_DEFINE use WITH_IMAGE_MAGICK :
AC_DEFINE(WITH_IMAGE_MAGICK,1,[Image Magick++ support for bitmap effects])

to ACTIVATE raster submenu in the interface

The patch is commited in revision #18586
http://inkscape.svn.sourceforge.net/viewvc/inkscape?view=rev&revision=18586

Changed in inkscape:
status: Triaged → Fix Committed
jazzynico (jazzynico)
Changed in inkscape:
milestone: none → 0.47
tags: added: build
ScislaC (scislac)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.