Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Cannot compile Image::Magick

by gulliver.smith (Initiate)
on Jan 03, 2019 at 20:04 UTC ( #1227999=perlquestion: print w/replies, xml ) Need Help??

gulliver.smith has asked for the wisdom of the Perl Monks concerning the following question:

Imagemagick seems to have changed its directory structure, include file names, and internal APIs in moving from 6.9 to 7.x.x.

Strawberry Perl on Windows 10 is not compiling. I hacked Magick.xs and Makefile.PL but still get a large number of compile errors.

Is there a solution or a maintainer for Image::ImageMagick?

Thanks

Gulliver

Replies are listed 'Best First'.
Re: Cannot compile Image::Magick
by Discipulus (Abbot) on Jan 03, 2019 at 20:40 UTC
    Hello gulliver.smith and welcome to the monastery,

    The tester matrix is not promising at all..

    Also seems you are not the only experiencing problems

    The module documentation points to a forum where similar probelms are discussed.

    iirc it was always a problematic, but wonderful, module to install..

    I assume you followed the steps suggested in the installation output:

    # Please check the following prerequisites: # # 1) You need to have installed ImageMagick Windows binaries from # http://www.imagemagick.org/script/binary-releases.php#windows # # 2) We only support dynamic (DLL) ImageMagick binaries # note: it is not possible to mix 32/64-bit binaries of perl and Im +ageMagick # # 3) During installation select that you want to install ImageMagick's # development files (libraries+headers) # # 4) You also need to have ImageMagick's directory in your PATH # note: we are checking the presence of convert.exe and/or identify +.exe tools # # 5) You might need Visual C++ Redistributable Package installed on yo +ur system # see instructions on ImageMagick's Binary Release webpage #

    Please note that the first link given is broken and you should browse this one and download the appropriate binary release (selecting the right options)

    The Author section of the module has an email address: as last hope..

    L*

    PS infact, being a strawberry user, last time I checked the module I decided to use GD

    PPS as vr suggested below ppm install http://www.sisyphusion.tk/ppm/Image-Magick.ppd works! I confirm it in strawberry 5.26 64 bit on windows10 (even if it cannot remove a temporary folder: cannot remove directory for X:\PATH\perl5.26.64bit\data\.ppm/Image-Magick-9092: Permission denied at X:/PATH/perl5.26.64bit/perl/vendor/lib/PPM.pm line 490.)

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

      So a lot of those reports suffer from fatal error: magick/MagickCore.h: No such file or directory. A quick work around is to find the file and put it in the correct place:

      marto@Shemp:~/PerlMagick-6.89$ locate magick-baseconfig.h /usr/include/i386-linux-gnu/ImageMagick-6/magick/magick-baseconfig.h marto@Shemp:~/PerlMagick-6.89$ sudo cp /usr/include/i386-linux-gnu/Ima +geMagick-6/magick/magick-baseconfig.h /usr/include/ImageMagick-6/magi +ck/

      Installing Image::Magick now succeeds. If I get time later I'll investigate a better fix.

        I was not sure whether this new version of Magick suffered from the same "problem" I encountered in the past but marto confirmed it. That is, installation of the development package of ImageMagick via package-manager is a prerequisitive. For example, in my system this is ImageMagick-devel.x86_64 Notice the devel

        Once this is done and in an ideal world, the header files (e.g. magick/MagickCore.h) and libraries will be found automatically because the system knows where header files and libraries are likely to be installed and conveys that to Magick's Makefile. But sometimes, they are not found, although they are there. This is fixed by what marto suggested (Re^2: Cannot compile Image::Magick) making a link of the whole dir could be better) or by running make thusly: CFLAGS="${CFLAGS} -I/usr/include/blah/blah" make in dir of extracted Magick distribution.

        If you only want to use cpan[m] to install Magick and avoid CFLAGS and the like, then:

        • 1) install ImageMagick development module via your package manager (this has nothing to do with Perl),
        • 2) try again to install Perl's Magick,
        • 3) if it fails, then locate the headers like marto does and make a symbolic link from their folder to a standard include dir like /usr/include. e.g. ln -s /usr/include/i386-linux-gnu/ImageMagick-6 /usr/include (as root) and try again (2)

        Of course, if this is the case, then it is not a problem but an external dependency missing / not found.

        Edit: you may find that you have problems also with linking, that is the Magick libraries (for example libMagickWand-6.Q16.so) are located somewhere unknown to Magick's Makefile. To solve this you either have to make a soft link to each of these libraries to a standard library path, like /usr/lib or export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/unconventional-location-to-magick-libs"; and then in the same terminal re-try installing Magick. Ouphhh!

Re: Cannot compile Image::Magick
by vr (Curate) on Jan 04, 2019 at 12:39 UTC

    W.r.t. Windows 10 & Strawberry Perl, I just checked: the latest IM comes with pre-compiled PerlMagick and PPD file to install it. You have to mark checkbox in installer GUI for these files to be unpacked. Unfortunately, it was compiled for 5.20, but if your project runs OK with this Perl version, then you get "latest official 7.0.8-23" IM, and the demo.pl runs all tests flawlessly. Unfortunately, there was a glitch while unpacking and installing with PPM command ((*) - see below), so I had to extract and copy 3 files (*.pm, *.xs.dll, *.ix) manually.

    Alternatively, if fresher than 5.20 Perl is required (I tested with 5.26, don't have 5.28 installed here), you may have luck running

    ppm install http://www.sisyphusion.tk/ppm/Image-Magick.ppd

    to install a little bit older (6.89) PerlMagick, but, sadly, I had to comment-out, IIRC, "RadialBlur" call in demo.pl, and yet JPG file failed to save -- though PNG was written OK. Other things may also be broken.

    BTW, same as Discipulus, I tend to avoid PerlMagick because of its state of sad eternal neglect -- either run external IM commands or prefer Imager and/or PDL::IO::Image for "pure Perl" image manipulation.

    ------

    (*) I don't know what PPM comes with Strawberry Perl, they say it's

    ...
    320.	PPM	11.11_03
    ...
    

    can't find it on CPAN, but, anyway, it seems to be broken:

    if ($have_zip) { $basename =~ /(.*).zip/i; } else { $tarzip->extract($tarzip->list_files); $basename =~ /(.*).tar/i; } { local $ENV{HOME} = undef; chdir($1); }

    starting from line 384. But then the $1 is undefined because matching is localized to scope, isn't it? How it was supposed to work...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1227999]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2021-03-05 08:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (109 votes). Check out past polls.

    Notices?