2

This question still has no solution (scroll down to "EDIT 5" to see the actual status)

I am trying to install Image::Magick on my headless Ubuntu server Ubuntu 14.04.2 LTS

# cpan install Image::Magick
Reading '/root/.cpan/Metadata'
  Database was generated on Thu, 21 May 2015 22:17:02 GMT
Running install for module 'Image::Magick'
Checksum for /root/.cpan/sources/authors/id/J/JC/JCRISTY/PerlMagick-6.89-1.tar.gz ok
Configuring J/JC/JCRISTY/PerlMagick-6.89-1.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Warning (mostly harmless): No library found for -lMagickCore-6.Q16
Generating a Unix-style Makefile
Writing Makefile for Image::Magick
Writing MYMETA.yml and MYMETA.json
  JCRISTY/PerlMagick-6.89-1.tar.gz
  /usr/bin/perl Makefile.PL INSTALLDIRS=site -- OK
Running make for J/JC/JCRISTY/PerlMagick-6.89-1.tar.gz
cp Magick.pm blib/lib/Image/Magick.pm
AutoSplitting blib/lib/Image/Magick.pm (blib/lib/auto/Image/Magick)
Running Mkbootstrap for Image::Magick ()
chmod 644 "Magick.bs"
"/usr/bin/perl" "/usr/local/share/perl/5.18.2/ExtUtils/xsubpp"  -typemap "/usr/share/perl/5.18/ExtUtils/typemap" -typemap "typemap"  Magick.xs > Magick.xsc && mv Magick.xsc Magick.c
cc -c  -I/usr/local/include/ImageMagick-6 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/libxml2 -I"/usr/include/ImageMagick-6" -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fstack-protector -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/freetype2 -g -O2 -Wall -pthread -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -O2 -g   -DVERSION=\"6.89\" -DXS_VERSION=\"6.89\" -fPIC "-I/usr/lib/perl/5.18/CORE"  -D_LARGE_FILES=1 -DHAVE_CONFIG_H Magick.c
Magick.xs:60:31: fatal error: magick/MagickCore.h: Datei oder Verzeichnis nicht gefunden
 #include <magick/MagickCore.h>
                               ^
compilation terminated.
make: *** [Magick.o] Fehler 1
  JCRISTY/PerlMagick-6.89-1.tar.gz
  make -- NOT OK

Obviously the install-script is trying to include the header-file magick/MagickCore.h but can't find it.

When I search in search engines for magick/MagickCore.h then I find lots of postings where some people have the same problem and ask for, but instead of solution i did only find lots of answers saying "I have the same problem" - no solution.

Does anyone of you have a solution that works on a Ubuntu Server 14.04.2 ?

Edit 1:
I already installed the package ImageMagic:

# apt-get install imagemagick

But I still get the error posted above.

Edit 2:
Following the advise from one of the answers I also tried

# apt-get install php5-imagick

followed by

# cpan install Image::Magick  

And I still get the same error (script can't find magick/MagickCore.h)

Edit 3:
I followed another advise and searched for magick/MagickCore.h. the answer was:

libmagickcore-dev: /usr/include/ImageMagick/magick/MagickCore.h

So I installed libmagickcore-dev (I exected sudo -i before):

apt-get install libmagickcore-dev

This installation was successful, the previously missing header-file is now in the file system:

# find / -name MagickCore.h
/usr/include/ImageMagick/magick/MagickCore.h

So I again tried

cpan install Image::Magick

But I still get this error:

Magick.xs:60:31: fatal error: magick/MagickCore.h: Datei oder Verzeichnis nicht gefunden
 #include <magick/MagickCore.h>
                               ^
compilation terminated.

Datei oder Verzeichnis nicht gefunden« is German, my native language, and means »no such file or directory«)

Edit 4:
Someone told me that the compiler is looking for magick/MagickCore.h not in /usr/include/ImageMagick/ but in /usr/include/ImageMagick-6/. So I created a symbolic link:

sudo ln -s /usr/include/ImageMagick /usr/include/ImageMagick-6

and tried again to install the module:

# cpan install Image::Magick
...
chmod 644 "Magick.bs"
"/usr/bin/perl" "/usr/local/share/perl/5.18.2/ExtUtils/xsubpp"  -typemap "/usr/share/perl/5.18/ExtUtils/typemap" -typemap "typemap"  Magick.xs > Magick.xsc && mv Magick.xsc Magick.c
cc -c  -I/usr/local/include/ImageMagick-6 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/libxml2 -I"/usr/include/ImageMagick-6" -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fstack-protector -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/freetype2 -g -O2 -Wall -pthread -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -O2 -g   -DVERSION=\"6.89\" -DXS_VERSION=\"6.89\" -fPIC "-I/usr/lib/perl/5.18/CORE"  -D_LARGE_FILES=1 -DHAVE_CONFIG_H Magick.c
Magick.xs:545:33: error: ‘MagickPixelIntensityOptions’ undeclared here (not in a function)
     { "Grayscale", { {"method", MagickPixelIntensityOptions} } },
                                 ^
Magick.xs: In function ‘XS_Image__Magick_ComplexImages’:
Magick.xs:3475:5: error: unknown type name ‘ComplexOperator’
     ComplexOperator
     ^
Magick.xs:3510:8: error: ‘UndefinedComplexOperator’ undeclared (first use in this function)
     op=UndefinedComplexOperator;
        ^
...
Magick.xs:10939:16: warning: assignment makes pointer from integer without a cast [enabled by default]
           image=MeanShiftImage(image,(size_t) geometry_info.rho,(size_t)
                ^
make: *** [Magick.o] Fehler 1
  JCRISTY/PerlMagick-6.89-1.tar.gz
  make -- NOT OK

So, the script did find magick/MagickCore.h, but now throws lots of other errors.


EDIT 5 (2015-09-17)

I've got the hint to install

apt-get install perlmagick

But it said, that the newest version already is installed. But I tried to install Image::Magick anyway. It still doesn't work:

# cpan install Image::Magick
Reading '/root/.cpan/Metadata'
  Database was generated on Mon, 31 Aug 2015 22:41:03 GMT
Fetching with LWP:
http://ftp.u-tx.net/CPAN/authors/01mailrc.txt.gz
Reading '/root/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Fetching with LWP:
http://ftp.u-tx.net/CPAN/modules/02packages.details.txt.gz
Reading '/root/.cpan/sources/modules/02packages.details.txt.gz'
  Database was generated on Wed, 16 Sep 2015 22:41:02 GMT
............................................................................DONE
Fetching with LWP:
http://ftp.u-tx.net/CPAN/modules/03modlist.data.gz
Reading '/root/.cpan/sources/modules/03modlist.data.gz'
DONE
Writing /root/.cpan/Metadata
Running install for module 'Image::Magick'
Checksum for /root/.cpan/sources/authors/id/J/JC/JCRISTY/PerlMagick-6.89-1.tar.gz ok
tmp-18091 for tmp-18091: Datei oder Verzeichnis nicht gefunden at /usr/share/perl/5.18/CPAN/Distribution.pm line 468.
Configuring J/JC/JCRISTY/PerlMagick-6.89-1.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Warning (mostly harmless): No library found for -lMagickCore-6.Q16
Generating a Unix-style Makefile
Writing Makefile for Image::Magick
Writing MYMETA.yml and MYMETA.json
  JCRISTY/PerlMagick-6.89-1.tar.gz
  /usr/bin/perl Makefile.PL INSTALLDIRS=site -- OK
Running make for J/JC/JCRISTY/PerlMagick-6.89-1.tar.gz
cp Magick.pm blib/lib/Image/Magick.pm
AutoSplitting blib/lib/Image/Magick.pm (blib/lib/auto/Image/Magick)
Running Mkbootstrap for Image::Magick ()
chmod 644 "Magick.bs"
"/usr/bin/perl" "/usr/local/share/perl/5.18.2/ExtUtils/xsubpp"  -typemap "/usr/share/perl/5.18/ExtUtils/typemap" -typemap "typemap"  Magick.xs > Magick.xsc && mv Magick.xsc Magick.c
cc -c  -I/usr/local/include/ImageMagick-6 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/libxml2 -I"/usr/include/ImageMagick-6" -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fstack-protector -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/freetype2 -g -O2 -Wall -pthread -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -O2 -g   -DVERSION=\"6.89\" -DXS_VERSION=\"6.89\" -fPIC "-I/usr/lib/perl/5.18/CORE"  -D_LARGE_FILES=1 -DHAVE_CONFIG_H Magick.c
Magick.xs:545:33: error: ‘MagickPixelIntensityOptions’ undeclared here (not in a function)
     { "Grayscale", { {"method", MagickPixelIntensityOptions} } },
                                 ^
Magick.xs: In function ‘XS_Image__Magick_ComplexImages’:
Magick.xs:3475:5: error: unknown type name ‘ComplexOperator’
     ComplexOperator
     ^
Magick.xs:3510:8: error: ‘UndefinedComplexOperator’ undeclared (first use in this function)
     op=UndefinedComplexOperator;
        ^
Magick.xs:3510:8: note: each undeclared identifier is reported only once for each function it appears in
Magick.xs:3510:7: warning: assignment makes integer from pointer without a cast [enabled by default]
     op=UndefinedComplexOperator;
       ^
Magick.xs:3516:31: error: ‘MagickComplexOptions’ undeclared (first use in this function)
         in=ParseCommandOption(MagickComplexOptions,MagickFalse,(char *)
                               ^
Magick.xs:3517:11: error: incompatible type for argument 1 of ‘ParseCommandOption’
           SvPV(ST(1),na));
           ^
In file included from /usr/include/ImageMagick-6/magick/MagickCore.h:115:0,
                 from Magick.xs:60:
/usr/include/ImageMagick-6/magick/option.h:166:3: note: expected ‘CommandOption’ but argument is of type ‘struct Methods *’
   ParseCommandOption(const CommandOption,const MagickBooleanType,const char *);
   ^
Magick.xs:3516:11: warning: assignment makes integer from pointer without a cast [enabled by default]
         in=ParseCommandOption(MagickComplexOptions,MagickFalse,(char *)
           ^
Magick.xs:3524:13: error: ‘ComplexOperator’ undeclared (first use in this function)
         op=(ComplexOperator) in;
             ^
Magick.xs:3524:11: warning: assignment makes integer from pointer without a cast [enabled by default]
         op=(ComplexOperator) in;
           ^
Magick.xs:3524:30: error: expected ‘;’ before ‘in’
         op=(ComplexOperator) in;
                              ^
Magick.xs:3541:19: error: incompatible type for argument 1 of ‘ParseCommandOption’
                   MagickComplexOptions,MagickFalse,SvPV(ST(i),na));
                   ^
In file included from /usr/include/ImageMagick-6/magick/MagickCore.h:115:0,
                 from Magick.xs:60:
/usr/include/ImageMagick-6/magick/option.h:166:3: note: expected ‘CommandOption’ but argument is of type ‘struct Methods *’
   ParseCommandOption(const CommandOption,const MagickBooleanType,const char *);
   ^
Magick.xs:3540:48: warning: pointer/integer type mismatch in conditional expression [enabled by default]
                 in=!SvPOK(ST(i)) ? SvIV(ST(i)) : ParseCommandOption(
                                                ^
Magick.xs:3540:19: warning: assignment makes integer from pointer without a cast [enabled by default]
                 in=!SvPOK(ST(i)) ? SvIV(ST(i)) : ParseCommandOption(
                   ^
Magick.xs:3548:19: warning: assignment makes integer from pointer without a cast [enabled by default]
                 op=(ComplexOperator) in;
                   ^
Magick.xs:3548:38: error: expected ‘;’ before ‘in’
                 op=(ComplexOperator) in;
                                      ^
Magick.xs:3563:5: warning: implicit declaration of function ‘ComplexImages’ [-Wimplicit-function-declaration]
     image=ComplexImages(image,op,exception);
     ^
Magick.xs:3563:10: warning: assignment makes pointer from integer without a cast [enabled by default]
     image=ComplexImages(image,op,exception);
          ^
Magick.xs: In function ‘XS_Image__Magick_Mogrify’:
Magick.xs:9175:11: warning: implicit declaration of function ‘SolarizeImageChannel’ [-Wimplicit-function-declaration]
           (void) SolarizeImageChannel(image,channel,geometry_info.rho,
           ^
Magick.xs:9824:11: warning: implicit declaration of function ‘RotationalBlurImageChannel’ [-Wimplicit-function-declaration]
           image=RotationalBlurImageChannel(image,channel,geometry_info.rho,
           ^
Magick.xs:9824:16: warning: assignment makes pointer from integer without a cast [enabled by default]
           image=RotationalBlurImageChannel(image,channel,geometry_info.rho,
                ^
Magick.xs:10112:11: warning: implicit declaration of function ‘AutoOrientImage’ [-Wimplicit-function-declaration]
           image=AutoOrientImage(image,image->orientation,exception);
           ^
Magick.xs:10112:16: warning: assignment makes pointer from integer without a cast [enabled by default]
           image=AutoOrientImage(image,image->orientation,exception);
                ^
Magick.xs:10824:11: warning: implicit declaration of function ‘PerceptibleImageChannel’ [-Wimplicit-function-declaration]
           (void) PerceptibleImageChannel(image,channel,epsilon);
           ^
Magick.xs:10853:11: warning: implicit declaration of function ‘PolynomialImageChannel’ [-Wimplicit-function-declaration]
           image=PolynomialImageChannel(image,channel,number_terms >> 1,terms,
           ^
Magick.xs:10853:16: warning: assignment makes pointer from integer without a cast [enabled by default]
           image=PolynomialImageChannel(image,channel,number_terms >> 1,terms,
                ^
Magick.xs:10860:11: error: unknown type name ‘PixelIntensityMethod’
           PixelIntensityMethod
           ^
Magick.xs:10863:18: error: ‘UndefinedPixelIntensityMethod’ undeclared (first use in this function)
           method=UndefinedPixelIntensityMethod;
                  ^
Magick.xs:10863:17: warning: assignment makes integer from pointer without a cast [enabled by default]
           method=UndefinedPixelIntensityMethod;
                 ^
Magick.xs:10865:21: error: ‘PixelIntensityMethod’ undeclared (first use in this function)
             method=(PixelIntensityMethod) argument_list[0].integer_reference;
                     ^
Magick.xs:10865:19: warning: assignment makes integer from pointer without a cast [enabled by default]
             method=(PixelIntensityMethod) argument_list[0].integer_reference;
                   ^
Magick.xs:10865:43: error: expected ‘;’ before ‘argument_list’
             method=(PixelIntensityMethod) argument_list[0].integer_reference;
                                           ^
Magick.xs:10866:11: warning: implicit declaration of function ‘GrayscaleImage’ [-Wimplicit-function-declaration]
           (void) GrayscaleImage(image,method);
           ^
Magick.xs:10895:11: warning: implicit declaration of function ‘CannyEdgeImage’ [-Wimplicit-function-declaration]
           image=CannyEdgeImage(image,geometry_info.rho,geometry_info.sigma,
           ^
Magick.xs:10895:16: warning: assignment makes pointer from integer without a cast [enabled by default]
           image=CannyEdgeImage(image,geometry_info.rho,geometry_info.sigma,
                ^
Magick.xs:10916:11: warning: implicit declaration of function ‘HoughLineImage’ [-Wimplicit-function-declaration]
           image=HoughLineImage(image,(size_t) geometry_info.rho,(size_t)
           ^
Magick.xs:10916:16: warning: assignment makes pointer from integer without a cast [enabled by default]
           image=HoughLineImage(image,(size_t) geometry_info.rho,(size_t)
                ^
Magick.xs:10939:11: warning: implicit declaration of function ‘MeanShiftImage’ [-Wimplicit-function-declaration]
           image=MeanShiftImage(image,(size_t) geometry_info.rho,(size_t)
           ^
Magick.xs:10939:16: warning: assignment makes pointer from integer without a cast [enabled by default]
           image=MeanShiftImage(image,(size_t) geometry_info.rho,(size_t)
                ^
make: *** [Magick.o] Fehler 1
  JCRISTY/PerlMagick-6.89-1.tar.gz
  make -- NOT OK

This is the first error reported:

tmp-18091 for tmp-18091: Datei oder Verzeichnis nicht gefunden at /usr/share/perl/5.18/CPAN/Distribution.pm line 468.

which probably is in english:

tmp-18091 for tmp-18091: no such file or directory at /usr/share/perl/5.18/CPAN/Distribution.pm line 468.

  • I know this is old, and I don't know if it will help or even if you still have the issue, but ... I was having the same error, and found that the solution wasn't with cpan, but to install perlmagick: sudo apt-get install perlmagick After that, I could use Image::Magick in my Perl scripts. – AntonH Sep 17 '15 at 4:29
  • It is not old. I still can't install Image::Magick. I tried to install perlmagick, but i got the message, that I still have the newest version installed. – Hubert Schölnast Sep 17 '15 at 10:24
  • 1
    I'm sorry I can't help more :( I had checked my installation of ImageMagick with sudo apt-get install imagemagick and it told me I had latest version installed (version with Ubuntu 14.04 desktop; I don't know if version between server and desktop is different, or if server doesn't provide dev files). Didn't install and PHP5 modules, and I couldn't find the ImageMagick.h files on my system. Good luck. If I find something I'll check back in. – AntonH Sep 17 '15 at 17:15
2

Diego's solution works.

A similar procedure has worked for me for versions ImageMagick-6.9.1 and ImageMagick-6.9.5.

Build Image::Magick perl module from source

Go to: http://www.imagemagick.org/script/download.php

Download a tar.gz file from one of the mirrors:

ftp://ftp.kddlabs.co.jp/graphics/ImageMagick/ImageMagick-6.9.5-8.tar.gz

Extract into ~/home/src:

$ cd ~/home/src
$ mv ~/Downloads/ImageMagick-6.9.5-8.tar.gz .
$ tar xzvf ImageMagick-6.9.5-8.tar.gz

Configure Image Magic with Perl Bindings

$ cd ImageMagick-6.9.5-8
$ ./configure --with-perl
$ make

Make sure perl dev files are installed

$ sudo-apt get install libperl-dev

Install Image Magick

$ make install  # or sudo make install

Check that it works:

$ perldoc Image::Magick

Resources:

http://www.imagemagick.org/script/perl-magick.php
http://www.imagemagick.org/script/examples.php
http://www.imagemagick.org/script/command-line-options.php
1

My final solution installing Image magick was:

(After trying all your steps)

Download current version of ImageMagick from the source

6.9.2 in my case:

After the download, switch to the Download folder and:

tar xvfz ImageMagick-6.9.2-4.tar.gz
cd ImageMagick-6.9.2-4/
./configure --with-perl
make
(*)
sudo make install

and then all goes smoothly

(*) another missing part, lperl, so in the process I have to add: sudo apt-get install libperl-dev

0

Install the package php5-imagick and try installing via CPAN again.

  • I'm not using php on my server, but I followed you advise and installed php5-imagick. The result: nothing changed. The installation of the cpan-modul still throws the same error. – Hubert Schölnast May 22 '15 at 19:54
  • Thanks for trying. I've had CPAN issues that relied on my installing PHP packages before. Sorry it didn't help in this case. My only other recommendation would be to upgrade CPAN itself via CPAN. – earthmeLon May 22 '15 at 19:56
  • I executed cpan-outdated -p | cpanm immediately before I tried to install Image::Magick. I think this should also have updated cpan itself. – Hubert Schölnast May 22 '15 at 20:02
  • It's looking for imagemagick devel headers - did you verify you have those installed? – Thomas Ward May 23 '15 at 21:47
0

Try to install headers:

sudo apt-get install libmagickcore-6-headers libmagick++-6-headers libmagickwand-6-headers

Along with -dev packages:

sudo apt-get install libmagic-dev libmagick++-6.q16-dev libmagickcore-6.q16-dev libmagickcore-dev libmagick++-dev libmagickwand-6.q16-dev libmagickwand-dev libmagic-ocaml-dev libmagics++-dev libmagics++-metview-dev

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.