Perl Magick install no good

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
mmonk

Perl Magick install no good

Post by mmonk »

Hi, I need to install imagemagick & perl magick on a linux server where I don't have root.

I grabbed the source & compiled to install imagemagick & perl magick in my home dir, configured like this:

Code: Select all

./configure --prefix=/home/me/lib/imagemagick --with-perl-options=PREFIX=/home/me/lib/perl
The install seemed to go fine (install report below) & I was able to run the imagemagick utils from the shell.

However, perl magick did not work. When use Image::Magick ; was invoked in a perl script, it would crash, complaining

Code: Select all

Can't load '/home/me/lib/perl/lib/perl5/site_perl/5.8.7//x86_64-linux/auto/Image/Magick/Magick.so' for module Image::Magick: libMagick.so.10: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.7/x86_64-linux/DynaLoader.pm line 230.
 at test.pl line 8
(incidentally the crashes are very nasty, running on & on & eating up all the memory... if run via the web server it can actually crash the server.

I ran ldd on Magick.so and found it did not know where libMagick.so.10 was located (its actually in /home/me/lib/imagemagick/lib).

When I set the environmental variable LD_LIBRARY_PATH to point to the directory where libMagick.so.10 resides, Magick.so can find it, & perlmagick is able to run.

However, this is not possible to do within the perl program itself (I have tried, but it doesn't work and apparently can't, at least according to reasearch I did--see http://www.thescripts.com/forum/thread49850.html ). This is bad, because now I can't get my web-based programs to work.

So my questions are:
1) shouldn't Magick.so already know where the libMagick.so.10 file is, since they were both installed from the same source durring the same compile? Why does Magick.so need to have LD_LIBRARY_PATH at all?

2) How can I get imagemagick & perlmagick to work properly without having to rely in that environmental variable.... because if I need that variable, I can't run it from the web server, which will make all my web apps that want to use perl magick useless.

3) I don't completely understand the little report I got when configuring Image Magick but it seems to say that the /home/me/lib/imagemagick/lib directory whould already be in the LD PATH (see LDFLAGS below)

I know this should work, I have done it before on other servers but I am flummoxed now.

Perhaps I need to recompile with different options? I would like to avoid recompiling perl if possible.

Please help me with your wisdom.

This is the configuration report from when I installed Image Magick:


Code: Select all

ImageMagick is configured as follows. Please verify that this configuration
matches your expectations.

Host system type : x86_64-unknown-linux-gnu

                  Option                        Value
-------------------------------------------------------------------------
Shared libraries  --enable-shared=yes           yes
Static libraries  --enable-static=yes           yes
Module support    --with-modules=yes            yes
GNU ld            --with-gnu-ld=yes             yes
Quantum depth     --with-quantum-depth=16       16

Delegate Configuration:
BZLIB             --with-bzlib=yes              yes
DPS               --with-dps=yes                no (failed tests)
FlashPIX          --with-fpx=no         no
FontConfig        --with-fontconfig=no          no
FreeType          --with-freetype=yes           yes
GhostPCL          None                          pcl6 (unknown)
Ghostscript       None                          gs (7.07)
Ghostscript fonts --with-gs-font-dir=default    /usr/share/fonts/default/Type1/
Ghostscript lib   --with-gslib=yes              no (failed tests)
Graphviz          --with-gvc=yes                no
JBIG              --with-jbig=yes               no
JPEG v1           --with-jpeg=yes               yes
JPEG-2000         --with-jp2=yes                no
LCMS              --with-lcms=yes               no
Magick++          --with-magick-plus-plus=yes   no (failed tests)
PERL              --with-perl=yes               /usr/local/bin/perl
PNG               --with-png=yes                yes
RSVG              --with-rsvg=no                no
TIFF              --with-tiff=yes               yes
Windows fonts     --with-windows-font-dir=      none
WMF               --with-wmf=yes                yes
X11               --with-x=                     no
XML               --with-xml=yes                yes
ZLIB              --with-zlib=yes               yes

X11 Configuration:

  Not using X11.

Options used to compile and link:
  PREFIX      = /home/me/lib/imagemagick/
  EXEC-PREFIX = /home/me/lib/imagemagick/
  VERSION     = 6.3.1
  CC          = gcc
  CFLAGS      = -g -O2 -Wall -W -pthread
  CPPFLAGS    = -I/home/me/lib/imagemagick//include
  PCFLAGS     =
  DEFS        = -DHAVE_CONFIG_H
  LDFLAGS     = -L/home/me/lib/imagemagick//lib -L/usr/lib64 -Wl,--rpath -Wl,/usr/lib64 -lfreetype -lz -L/usr/lib
  LIBS        = -lMagick -ltiff -lfreetype -ljpeg -lbz2 -lz -lpthread -lm -lpthread
  CXX         = g++
  CXXFLAGS    = -g -O2 -Wall -W -pthread
mferreira

Post by mferreira »

I am getting the same problem

Code: Select all

Can't load '/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Image/Magick/Magick.so' for module Image::Magick: libMagick.so.10: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/DynaLoader.pm line 230.
any response would be helpfull
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

You may need to add the location of your ImageMagick library to your load library path. Something like
  • ldconfig /usr/local/lib
mferreira

Post by mferreira »

Thanks, thats worked for me!
mmonk

can't run ldconfig

Post by mmonk »

There does not seem to be an ldconfig command on my system, and in any case wouldn't I need to have root access?

Isn't there some other way to tell Magick.so where to find its libraries? It seems to me that it should know by itself, given that it was created by the same compile that created those librarys & imagemagick itself.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

You can also add to the build a something like

Code: Select all

LDFLAGS="-R/path/to/IM/library/install/dir"
that will on most UNIXy systems build the library path into the .so file.

How to add it to the build is another matter. Often this type of thing is handled by 'libtool' lookups of '.la' files.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
mmonk

Post by mmonk »

But since LDFLAGS already seems to include the imagemagick directory (see my original post above), shouldn't it already work? Or am I misunderstanding something?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

It should. the -L is for compile time location of the library, -R is for runtime path to look for library. The --rpath I think converts -L into -R equivelents.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
mmonk

Post by mmonk »

OK, I did a make uninstall" and "make distclean" and reconfigured & remade with:

Code: Select all

./configure LDFLAGS=-Wl,-rpath,/home/me/lib/imagemagick/lib --prefix=/home/me/lib/imagemagick/ --with-perl-options=PREFIX=/home/me/lib/perl/
The configure output at the end was the same as above, except:

Code: Select all

  LDFLAGS     = -L/home/northroa/lib/imagemagick//lib -Wl,-rpath,/home/northroa/lib/imagemagick/lib -L/usr/lib64 -Wl,--rpath -Wl,/usr/lib64 -lfreetype -lz -L/usr/lib
The result is the same, though...the new Magick.so file still does not find the libMagick.so.10 file unless the LD_LIBRARY_PATH is set in the envrionment, same as before... so I still can't use perlmagick through the webserver.

Did I set up the ./configure correctly?
mmonk

Post by mmonk »

Anybody have any ideas on how I should proceed? I would really like to get imagemagik working, but I'm really perplexed right now...any help would be appreciated!
asarian

Re:

Post by asarian »

mmonk wrote: Anybody have any ideas on how I should proceed? I would really like to get imagemagik working, but I'm really perplexed right now...any help would be appreciated!


Quite a predicament you found yourself in. LD_LIBRARY_PATH cannot be used. And I believe ldconfig will not accept a path not owned by root.

An ugly way (which I just recommended against in another, similar thread, lol,) is to use a symlink. Figure out what lib dirs ARE reachable from within the webserver (like ~/me/usr/lib perhaps?) and create a symlink from there to the location of libMagick.so.10. Not pretty, but it might tide you over.

- Mark
mmonk

Re: Re:

Post by mmonk »

asarian wrote: An ugly way (which I just recommended against in another, similar thread, lol,) is to use a symlink. Figure out what lib dirs ARE reachable from within the webserver (like ~/me/usr/lib perhaps?) and create a symlink from there to the location of libMagick.so.10. Not pretty, but it might tide you over.

- Mark


Hi Mark, thanks for the reply.

Do you know how I can determine which directorys are "reachable" by Magic.so, though? If I don't know that I don't know where to put the link.

Also, I fear that it may only be directorys that I have no write access to that will be reachable.
asarian

Re: Re:

Post by asarian »

mmonk wrote:
asarian wrote: An ugly way (which I just recommended against in another, similar thread, lol,) is to use a symlink. Figure out what lib dirs ARE reachable from within the webserver (like ~/me/usr/lib perhaps?) and create a symlink from there to the location of libMagick.so.10. Not pretty, but it might tide you over.

- Mark


Hi Mark, thanks for the reply.

Do you know how I can determine which directorys are "reachable" by Magic.so, though? If I don't know that I don't know where to put the link.

Also, I fear that it may only be directorys that I have no write access to that will be reachable.

Code: Select all

Can't load '/home/me/lib/perl/lib/perl5/site_perl/5.8.7//x86_64-linux/auto/Image/Magick/Magick.so' for module Image::Magick: libMagick.so.10: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.7/x86_64-linux/DynaLoader.pm line 230. at test.pl line 8
First things first, how is your Perl set up exactly? As a localized version? Cuz it seems you're running a system wide one with a local module path somehow.

Ok where is Image::Magick located? You could use that path, like:

use lib '/home/me/lib/perl/lib/perl5/site_perl/5.8.7/ImageMagick';
use Image::Magick;

I doubt this will really work, though. But you can always give it a try.

- Mark
mmonk

Re: Re:

Post by mmonk »

asarian wrote: First things first, how is your Perl set up exactly? As a localized version? Cuz it seems you're running a system wide one with a local module path somehow.

Ok where is Image::Magick located? You could use that path, like:

use lib '/home/me/lib/perl/lib/perl5/site_perl/5.8.7/ImageMagick';
use Image::Magick;

I doubt this will really work, though. But you can always give it a try.

- Mark


Hi Mark,

I'm using the system wide perl, and yes, I use a 'use lib' statement like you indicated. However, the probelm isn't that perl can't find the Image::Magick module or that Image::Magick can't find Magick.so; the probelm is that Magick.so can't find libMagick.so.10. And I can't link libMagick.so.10 into a directory that Magick.so knows about because I don't know what directories Magick.so dynamically loads librarys from. I suspect that even if I did know it wouldn't help because I probably can't write to those directories.

Shouldn't it be possbile to create a Magick.so file that knows where libMagick.so.10 is located?
Post Reply