Compiling octave specifying path to GraphicsMagick library

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Compiling octave specifying path to GraphicsMagick library

Carnë Draug-2
Hi everyone

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.

I'm trying to do this because the GraphicsMagick library in the system
is compiled for 8bit but I need support for more. As such, I compiled
it again on a separate dir and want to use it with octave.

Carnë
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Compiling octave specifying path to GraphicsMagick library

Mike Miller
2012/3/23 Carnë Draug <[hidden email]>:

> Hi everyone
>
> 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.
>
> I'm trying to do this because the GraphicsMagick library in the system
> is compiled for 8bit but I need support for more. As such, I compiled
> it again on a separate dir and want to use it with octave.

It looks like octave uses pkg-config to find the magick library, so I
think you only need something like

export PKG_CONFIG_PATH=/path/to/magick/lib/pkgconfig
./configure

There should be a .pc file in the directory you specify.  You can pass
multiple pkg-config directories separated by colons to pick up
libraries installed elsewhere, this will work for any build system
that uses pkg-config.

--
mike
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Compiling octave specifying path to GraphicsMagick library

John W. Eaton
Administrator
In reply to this post by Carnë Draug-2
On 23-Mar-2012, Carnë Draug wrote:

| Hi everyone
|
| 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'm thinking about removing all the --with-FOO-{include,lib}dir
options because all they do is set CPPFLAGS and LDFLAGS and they are
not provided for all dependencies, which leads to confusion.

jwe
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Compiling octave specifying path to GraphicsMagick library

Carnë Draug-2
On 23 March 2012 13:26, John W. Eaton <[hidden email]> 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ë
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Compiling octave specifying path to GraphicsMagick library

Mike Miller
On Sun, Apr 01, 2012 at 11:34:15AM +0100, Carnë Draug wrote:

> On 23 March 2012 13:26, John W. Eaton <[hidden email]> 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?

Yes, I still think PKG_CONFIG_PATH is the right way to go, have you
tried it yet?  I agree with John that CPPFLAGS and LDFLAGS do work
generally for any custom libraries that are not installed where the
system expects them, and I use them all the time, but for this case it
doesn't work.

I suspect you are now compiling against the system GraphicsMagick header
files and linking with your custom GraphicsMagick library.  Just a
guess, but that would be a bad thing :)

In the Makefile, MAGICK_CPPFLAGS comes to the left of CPPFLAGS, so it
will take precedence over any paths you put into CPPFLAGS.
MAGICK_CPPFLAGS is populated with the result of

pkg-config --cflags GraphicsMagick++

which for me is "-I/usr/include/GraphicsMagick".  MAGICK_LIBS comes from

pkg-config --libs GraphicsMagick++

which doesn't include any path, because the libs are already in
/usr/lib.  Therefore, your LDFLAGS is causing it to link with your
private version of GraphicsMagick.

The only way to override what configure finds for MAGICK_* is to tell
pkg-config where to look with PKG_CONFIG_PATH.

--
mike
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Compiling octave specifying path to GraphicsMagick library

bpabbott
Administrator
In reply to this post by Carnë Draug-2
On Apr 1, 2012, at 6:34 AM, Carnë Draug wrote:

> On 23 March 2012 13:26, John W. Eaton <[hidden email]> 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







_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Compiling octave specifying path to GraphicsMagick library

John W. Eaton
Administrator
On  1-Apr-2012, Ben Abbott wrote:

| 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.

Yes, this is correct.  I got the details wrong when I posted earlier.
I was thinking about specifying the locations for libraries that are
linked directly with Octave.  But since imread is a separate .oct
file, we have the compiler flags for it separate from CPPFLAGS and
LDFLAGS.  I think that makes sense because otherwise we would have the
compiler searching these extra directories for all source files in
Octave and we would unnecessarily link Octave with graphics magick.

However, I think someone pointed out that these extra flags are used
after CPPFLAGS and LDFLAGS, so you will always get the system
header files and libraries if there is more than one version
installed.  I think that's a bug.  Would someone like to fix it for
graphics magick and all the other libraries that have similar
problems?  Or at least report it as a bug so the issue won't be
forgotten?

Thanks,

jwe
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Compiling octave specifying path to GraphicsMagick library

Carnë Draug-2
In reply to this post by Mike Miller
On 1 April 2012 14:15, Mike Miller <[hidden email]> wrote:

> On Sun, Apr 01, 2012 at 11:34:15AM +0100, Carnë Draug wrote:
>> On 23 March 2012 13:26, John W. Eaton <[hidden email]> 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?
>
> Yes, I still think PKG_CONFIG_PATH is the right way to go, have you
> tried it yet?

I did but I had problems with it. When running configure, one of the
tests fail (the one about "checking for Magick::ColorRGB in
Magick++.h"). When I talked with the GraphicsMagick devs, they told
me:

> It looks like the GraphicsMagick libraries have been included, but all of
> the libraries that the GraphicsMagick libraries depend on are not included.
>
> Do you have any idea how Octave picks up the configuration required by
> GraphicsMagick?
>
> For example, it might try to execute 'GraphicsMagick++-config' (which would
> be /home/carandraug/.bin/gm/bin/GraphicsMagick++-config in your install) to
> obtain its configuration.  Perhaps it expects that this script will be in
> your executable search path.

I have tried to change $PATH to include it and all "which
GraphicsMagick++-config", "pkg-config --cflags GraphicsMagick++" and
"pkg-config --libs GraphicsMagick++" show the right paths

$ which GraphicsMagick++-config
/home/carandraug/.bin/gm/bin/GraphicsMagick++-config
$ pkg-config --cflags GraphicsMagick++
-I/home/carandraug/.bin/gm/include/GraphicsMagick
$ pkg-config --libs GraphicsMagick++
-L/home/carandraug/.bin/gm/lib -lGraphicsMagick++ -lGraphicsMagick

However, configure still fails. I have pastebin the errors I get on
config.log here http://pastebin.com/TVZWA0ew .

Carnë
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Compiling octave specifying path to GraphicsMagick library

Carnë Draug-2
In reply to this post by bpabbott
On 1 April 2012 15:27, Ben Abbott <[hidden email]> wrote:

> On Apr 1, 2012, at 6:34 AM, Carnë Draug wrote:
>
>> On 23 March 2012 13:26, John W. Eaton <[hidden email]> 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?
>>
> 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.

I have tried this and no success. configure still picks on the system
install of GraphicsMagick and completely ignores the values of
MAGICK_LDFLAGS, MAGICK_LIBS, and MAGICK_CPPFLAGS.

$ env | grep MAGICK
MAGICK_LDFLAGS=-L/home/carandraug/.bin/gm/lib/GraphicsMagick-1.3.14
MAGICK_CPPFLAGS=-I/home/carandraug/.bin/gm/include/GraphicsMagick
MAGICK_LIBS=-lGraphicsMagick++ -lGraphicsMagick

I looked into config.log and and see no mention of those paths, only
of /usr/include/GraphicsMagick

Carnë
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Compiling octave specifying path to GraphicsMagick library

Carnë Draug-2
In reply to this post by John W. Eaton
On 1 April 2012 19:47, John W. Eaton <[hidden email]> wrote:

> On  1-Apr-2012, Ben Abbott wrote:
>
> | 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.
>
> However, I think someone pointed out that these extra flags are used
> after CPPFLAGS and LDFLAGS, so you will always get the system
> header files and libraries if there is more than one version
> installed.  I think that's a bug.  Would someone like to fix it for
> graphics magick and all the other libraries that have similar
> problems?  Or at least report it as a bug so the issue won't be
> forgotten?

Hi

I really don't know how to work with this building tools so am unable
to fix it. But I reported the bug here
https://savannah.gnu.org/bugs/index.php?36064

Carnë
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Compiling octave specifying path to GraphicsMagick library

CdeMills
In reply to this post by Carnë Draug-2
I applied a number of tips and tricks found on linuxfromscratch. If you want to recompile a number of softwares for yourself:
1) create ${HOME}/usr  (or anything else) as base for the installation
2) create ${HOME}/usr/lib/pkgconfig as repository for the local config files
3) in the .profile, setup a few things:
# set LD_LIBRARY_PATH if not set
(echo $LD_LIBRARY_PATH | grep -q lib) || export LD_LIBRARY_PATH="$HOME/usr/lib"

# for GNUStep apps
. ${HOME}/usr/System/Library/Makefiles/GNUstep.sh

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    (echo $PATH | grep -q $HOME/bin) || export PATH="$HOME/bin:$HOME/usr/local/bin:$HOME/usr/bin:$PATH"
fi
if [ -d "$HOME/usr/lib/pkgconfig" ]; then
    (echo $PKG_CONFIG_PATH | grep -q $HOME/usr/lib/pkgconfig) || export PKG_CONFIG_PATH="$HOME/usr/lib/pkgconfig"
fi

4) logout, login, compile whatever you need, using configure as
./configure --prefix=${HOME}/usr
so things will be added into ${HOME}/usr/bin, ...

5) for Octave:
./configure --prefix=${HOME}/usr --with-magick=ImageMagick
With this setup, pkg-config will report the right library names, and the --prefix=${HOME}/usr will ensure precedence of all your local libs over the system installed ones.

Regards

Pascal
Reply | Threaded
Open this post in threaded view
|

Re: Compiling octave specifying path to GraphicsMagick library

Carnë Draug-2
On 2 April 2012 11:07, CdeMills <[hidden email]> wrote:

> 3) in the .profile, setup a few things:
> # set LD_LIBRARY_PATH if not set
> (echo $LD_LIBRARY_PATH | grep -q lib) || export
> LD_LIBRARY_PATH="$HOME/usr/lib"
>
> # for GNUStep apps
> . ${HOME}/usr/System/Library/Makefiles/GNUstep.sh
>
> # set PATH so it includes user's private bin if it exists
> if [ -d "$HOME/bin" ] ; then
>    (echo $PATH | grep -q $HOME/bin) || export
> PATH="$HOME/bin:$HOME/usr/local/bin:$HOME/usr/bin:$PATH"
> fi
> if [ -d "$HOME/usr/lib/pkgconfig" ]; then
>    (echo $PKG_CONFIG_PATH | grep -q $HOME/usr/lib/pkgconfig) || export
> PKG_CONFIG_PATH="$HOME/usr/lib/pkgconfig"
> fi

Thank you. I'll try this now. By the way, you can write this in a more
silent (if you log in at a terminal, your code prints a bunch of
stuff, not sure why) and easier to read like this:

if [[ $LD_LIBRARY_PATH != *lib* ]]; then
  export LD_LIBRARY_PATH="$HOME/usr/lib"
fi

if [[ -d "$HOME/bin" && $PATH != *$HOME/bin* ]]; then
  export PATH="$HOME/bin:$HOME/usr/local/bin:$HOME/usr/bin:$PATH"
fi

if [[ -d "$HOME/usr/lib/pkgconfig" && $PKG_CONFIG_PATH !=
*$HOME/usr/lib/pkgconfig* ]]; then
  export PKG_CONFIG_PATH="$HOME/usr/lib/pkgconfig"
fi

Carnë
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Compiling octave specifying path to GraphicsMagick library

Mike Miller
In reply to this post by Carnë Draug-2
On Mon, Apr 02, 2012 at 09:57:16AM +0100, Carnë Draug wrote:

> On 1 April 2012 14:15, Mike Miller <[hidden email]> wrote:
> > On Sun, Apr 01, 2012 at 11:34:15AM +0100, Carnë Draug wrote:
> >> On 23 March 2012 13:26, John W. Eaton <[hidden email]> 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?
> >
> > Yes, I still think PKG_CONFIG_PATH is the right way to go, have you
> > tried it yet?
>
> I did but I had problems with it. When running configure, one of the
> tests fail (the one about "checking for Magick::ColorRGB in
> Magick++.h"). When I talked with the GraphicsMagick devs, they told
> me:
>
> > It looks like the GraphicsMagick libraries have been included, but all of
> > the libraries that the GraphicsMagick libraries depend on are not included.
> >
> > Do you have any idea how Octave picks up the configuration required by
> > GraphicsMagick?
> >
> > For example, it might try to execute 'GraphicsMagick++-config' (which would
> > be /home/carandraug/.bin/gm/bin/GraphicsMagick++-config in your install) to
> > obtain its configuration.  Perhaps it expects that this script will be in
> > your executable search path.
>
> I have tried to change $PATH to include it and all "which
> GraphicsMagick++-config", "pkg-config --cflags GraphicsMagick++" and
> "pkg-config --libs GraphicsMagick++" show the right paths
>
> $ which GraphicsMagick++-config
> /home/carandraug/.bin/gm/bin/GraphicsMagick++-config
> $ pkg-config --cflags GraphicsMagick++
> -I/home/carandraug/.bin/gm/include/GraphicsMagick
> $ pkg-config --libs GraphicsMagick++
> -L/home/carandraug/.bin/gm/lib -lGraphicsMagick++ -lGraphicsMagick
>
> However, configure still fails. I have pastebin the errors I get on
> config.log here http://pastebin.com/TVZWA0ew .

I can tell from your config.log that configure is only finding the
static library libGraphicsMagick.a, when you built it did you disable
shared libraries?  That would be why it can't find it's dependencies.
When octave tests it, it is assuming "pkg-config --libs" will print all
libraries it needs, or that the shared library will have any dependency
libs listed so they get pulled in automatically.  This doesn't work for
static libraries.  I'm not sure what the right approach would be to make
it work for a static build, so I'd say build GraphicsMagick with shared
libraries enabled.  You'll then need to set LD_LIBRARY_PATH in your
environment to include /home/carandraug/.bin/gm/lib.

--
mike
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Compiling octave specifying path to GraphicsMagick library

Carnë Draug-2
On 2 April 2012 12:18, Mike Miller <[hidden email]> wrote:

> On Mon, Apr 02, 2012 at 09:57:16AM +0100, Carnė Draug wrote:
>> On 1 April 2012 14:15, Mike Miller <[hidden email]> wrote:
>> > On Sun, Apr 01, 2012 at 11:34:15AM +0100, Carnė Draug wrote:
>> >> On 23 March 2012 13:26, John W. Eaton <[hidden email]> 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?
>> >
>> > Yes, I still think PKG_CONFIG_PATH is the right way to go, have you
>> > tried it yet?
>>
>> I did but I had problems with it. When running configure, one of the
>> tests fail (the one about "checking for Magick::ColorRGB in
>> Magick++.h"). When I talked with the GraphicsMagick devs, they told
>> me:
>>
>> > It looks like the GraphicsMagick libraries have been included, but all of
>> > the libraries that the GraphicsMagick libraries depend on are not included.
>> >
>> > Do you have any idea how Octave picks up the configuration required by
>> > GraphicsMagick?
>> >
>> > For example, it might try to execute 'GraphicsMagick++-config' (which would
>> > be /home/carandraug/.bin/gm/bin/GraphicsMagick++-config in your install) to
>> > obtain its configuration.  Perhaps it expects that this script will be in
>> > your executable search path.
>>
>> I have tried to change $PATH to include it and all "which
>> GraphicsMagick++-config", "pkg-config --cflags GraphicsMagick++" and
>> "pkg-config --libs GraphicsMagick++" show the right paths
>>
>> $ which GraphicsMagick++-config
>> /home/carandraug/.bin/gm/bin/GraphicsMagick++-config
>> $ pkg-config --cflags GraphicsMagick++
>> -I/home/carandraug/.bin/gm/include/GraphicsMagick
>> $ pkg-config --libs GraphicsMagick++
>> -L/home/carandraug/.bin/gm/lib -lGraphicsMagick++ -lGraphicsMagick
>>
>> However, configure still fails. I have pastebin the errors I get on
>> config.log here http://pastebin.com/TVZWA0ew .
>
> I can tell from your config.log that configure is only finding the
> static library libGraphicsMagick.a, when you built it did you disable
> shared libraries?  That would be why it can't find it's dependencies.

Oh! I didn't disable them, they are disabled by default and on their
INSTALL file they advise to not enable it unless I know what I'm doing
(which I don't, octave was the only program I have ever built before).
So I enabled shared libraries, added the bash code to .profile already
mentioned to set all the variables, and configure ran fine fine this
time. I have then built octave successfully and imread is working
perfectly, reading uint16 images. Problem solved!

Thank you all very much for your help,
Carnë
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave