help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiling octave specifying path to GraphicsMagick library


From: Ben Abbott
Subject: Re: Compiling octave specifying path to GraphicsMagick library
Date: Sun, 01 Apr 2012 10:27:57 -0400

On Apr 1, 2012, at 6:34 AM, Carnë Draug wrote:

> On 23 March 2012 13:26, John W. Eaton <address@hidden> wrote:
> 
>> On 23-Mar-2012, Carnë Draug wrote:
>> | I can't find the option to specify the path for the GraphicsMagick
>> | library when compiling octave. I've looked at ./configure --help but
>> | there is only the --with-magick option which only lets me choose
>> | between GraphicsMagick and ImageMagick but not define the directory
>> | for the library. I have tried (guessing) --with-magick-libdir and
>> | --with-magick-includedir but no success.
>> 
>> Use CPPFLAGS=-I/some/dir to add the directory where the header files
>> are found and LDFLAGS=-L/some/dir to add the directory where the
>> library is found.
> 
> I tried this but it's still not working. I thought it was a problem
> with GraphicsMagick but after talking to their devs it looks like the
> problem is still with building Octave.
> 
> Even by setting those flags, after compiling Octave (3.6.1 by the way)
> checking octave_config_info I noticed that it was still using the
> system /usr/include/GraphicsMagick. This was despite that configure
> was using the "right" GraphicsMagick for the tests. However, looking
> into the Makefile being generated I noticed this MAGICK_CPPFLAGS =
> -I/usr/include/GraphicsMagick. I manually edited the Makefile
> MAGICK_CPPFLAGS and MAGICK_LDFLAGS and that seemed to work. However,
> the octave_config_info is still mentioning MAGICK_CPPFLAGS =
> -I/usr/include/GraphicsMagick, not the ones I changed.
> 
> I no longer get the warning about being limited to 8bit images (so
> it's using the right GraphicsMagick) but I get the following error
> 
> error: imread: invalid image file: Magick++ exception: Magick: No
> decode delegate for this image format () reported by
> magick/constitute.c:8279 (ReadImage)
> 
> But GraphicsMagick does open the images no problem (I've tried it
> outside octave with "gm display").
> 
> Does anyone has any idea of what I'm doing wrong?
> 
> Thanks in advance,
> Carnë

Both the makefiles and config_info are essentially products of "./configure".

Since the mex/mkoct scripts also depend upon many of the same settings as 
config_info, I think it is important to determine why ./configure isn't 
accepting the GraphicsMagick libs your are specifying.

I'm not very knowledgeable about the autotools details, but my understanding is 
that "configure.ac" is used to create "configure" which produces "config.log", 
"config_info", and the makefiles.

In configure.ac I see ...

784 PKG_CHECK_EXISTS([$magick++], [
 785   ## Make sure we only get -I, -L and -l flags.  Some 
Graphics/ImageMagick++
 786   ## packages adds extra flags that are useful when building
 787   ## Graphics/ImageMagick++ extentions.  These extra flags break the
 788   ## Octave build. 
 789   MAGICK_LDFLAGS=`$PKG_CONFIG --libs-only-L $magick++`
 790   MAGICK_LIBS=`$PKG_CONFIG --libs-only-l $magick++`
 791   MAGICK_CPPFLAGS=`$PKG_CONFIG --cflags-only-I $magick++`
 792 
 793   warn_magick="$magick++ library fails tests.  The imread function for 
reading image files will not be fully functional."
 794 
 795   save_CPPFLAGS="$CPPFLAGS"
 796   save_LIBS="$LIBS"
 797   CPPFLAGS="$MAGICK_CPPFLAGS $CPPFLAGS"
 798   LIBS="$MAGICK_LDFLAGS $MAGICK_LIBS $LIBS"
 799   AC_LANG_PUSH(C++)
 800     AC_CHECK_HEADER([Magick++.h], [
 801       AC_MSG_CHECKING([for Magick::ColorRGB in Magick++.h])
 802       AC_TRY_LINK([#include <Magick++.h>], [Magick::ColorRGB c;], [
 803         AC_MSG_RESULT(yes)
 804         warn_magick=
 805       ], [
 806         AC_MSG_RESULT(no)
 807       ])
 808     ])
 809   AC_LANG_POP(C++)
 810   CPPFLAGS="$save_CPPFLAGS"
 811   LIBS="$save_LIBS"
 812 ])

I may be inferring incorrectly, but have you tried to directly specify 
MAGICK_LDFLAGS, MAGICK_LIBS, and MAGICK_CPPFLAGS before running ./configure ?

        MAGICK_LIBS="-lGraphicsMagick++ -lGraphicsMagick  "
        MAGICK_LDFLAGS="-L/usr/local/lib  "
        MAGICK_CPPFLAGS="-I/usr/local/include/GraphicsMagick  "
        ./configure ...

You'll need to change the paths to point to the proper directories.

Ben









reply via email to

[Prev in Thread] Current Thread [Next in Thread]