rmagick-temp / rmagick

An interface to the ImageMagick and GraphicsMagick image processing libraries.
http://rmagick.rubyforge.org/
MIT License
790 stars 102 forks source link

"checking for ImageMagick version >= 6.4.9... no" on Debian Sid + rbenv #126

Closed btakita closed 9 years ago

btakita commented 9 years ago

I have graphicsmagick-libmagick-dev-compat installed.

$ gem install rmagick
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
    ERROR: Failed to build gem native extension.

    /home/phoenix/.rbenv/versions/1.9.3-p551/bin/ruby -r ./siteconf20150107-31574-1yd0diy.rb extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... no
Can't install RMagick 2.13.4. You must have ImageMagick 6.4.9 or later.

*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/home/phoenix/.rbenv/versions/1.9.3-p551/bin/ruby

extconf failed, exit code 1

Gem files will remain installed in /home/phoenix/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/rmagick-2.13.4 for inspection.
Results logged to /home/phoenix/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/extensions/x86_64-linux/1.9.1-static/rmagick-2.13.4/gem_make.out

It seems this is a new regression.

$ gem install rmagick -v '2.13.3'
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
    ERROR: Failed to build gem native extension.

    /home/phoenix/.rbenv/versions/1.9.3-p551/bin/ruby -r ./siteconf20150107-32745-173qgl0.rb extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no

Can't install RMagick 0.0.0. Can't find MagickWand.h.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/home/phoenix/.rbenv/versions/1.9.3-p551/bin/ruby

extconf failed, exit code 1

Gem files will remain installed in /home/phoenix/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/rmagick-2.13.3 for inspection.
Results logged to /home/phoenix/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/extensions/x86_64-linux/1.9.1-static/rmagick-2.13.3/gem_make.out

Here's the result of running convert.

$ convert -version
GraphicsMagick 1.3.20 2014-08-16 Q8 http://www.GraphicsMagick.org/
Copyright (C) 2002-2014 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See http://www.GraphicsMagick.org/www/Copyright.html for details.

Feature Support:
  Native Thread Safe       yes
  Large Files (> 32 bit)   yes
  Large Memory (> 32 bit)  yes
  BZIP                     yes
  DPS                      no
  FlashPix                 no
  FreeType                 yes
  Ghostscript (Library)    no
  JBIG                     yes
  JPEG-2000                yes
  JPEG                     yes
  Little CMS               yes
  Loadable Modules         no
  OpenMP                   yes (201307)
  PNG                      yes
  TIFF                     yes
  TRIO                     no
  UMEM                     no
  WebP                     no
  WMF                      yes
  X11                      yes
  XML                      yes
  ZLIB                     yes

Host type: x86_64-pc-linux-gnu

Configured using the command:
  ./configure  '--build' 'x86_64-linux-gnu' '--enable-shared' '--enable-static' '--enable-libtool-verbose' '--prefix=/usr' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--docdir=${prefix}/share/doc/graphicsmagick' '--with-gs-font-dir=/usr/share/fonts/type1/gsfonts' '--with-x' '--x-includes=/usr/include/X11' '--x-libraries=/usr/lib/X11' '--without-dps' '--without-modules' '--without-frozenpaths' '--with-perl' '--with-perl-options=INSTALLDIRS=vendor' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-Wall -g -fno-strict-aliasing -O2' 'LDFLAGS=' 'CXXFLAGS=-Wall -g -fno-strict-aliasing -O2'

Final Build Parameters:
  CC       = gcc -std=gnu99
  CFLAGS   = -fopenmp -Wall -g -fno-strict-aliasing -O2 -Wall -pthread
  CPPFLAGS = -I/usr/include/X11 -I/usr/include/freetype2 -I/usr/include/libxml2
  CXX      = g++
  CXXFLAGS = -Wall -g -fno-strict-aliasing -O2 -pthread
  LDFLAGS  = -L/usr/lib/X11 -L/usr/lib -L/usr/lib
  LIBS     = -ljbig -llcms2 -ltiff -lfreetype -ljasper -ljpeg -lpng12 -lwmflite -lXext -lSM -lICE -lX11 -llzma -lbz2 -lxml2 -lz -lm -lgomp -lpthread
btakita commented 9 years ago

I have wand/MagickWand.h.

$ ls /usr/include/ImageMagick-6/wand/MagickWand.h 
/usr/include/ImageMagick-6/wand/MagickWand.h

I then commented out the check for RMagick in ext/RMagick/extconf.rb and got the following:

$ ruby extconf.rb 
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes

Warning: Found a partial ImageMagick installation. Your operating system likely has some built-in ImageMagick libraries but not all of ImageMagick. This will most likely cause problems at both compile and runtime.
Found partial installation at: /usr
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no

Can't install RMagick 2.13.4. Can't find MagickWand.h.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/ruby2.1

I also have this issue when running gem install rmagick -v '2.13.2'

btakita commented 9 years ago

I traced the issue to setting $CPPFLAGS using Magick-config --cppflags.

$ Magick-config --cppflags
-I/usr/include/GraphicsMagick
$ ls /usr/include/GraphicsMagick/wand/
drawing_wand.h  magick_wand.h  pixel_wand.h  wand_api.h  wand_symbols.h
$ ls /usr/include/ImageMagick-6/wand/
animate.h  composite.h  convert.h    display.h       identify.h  magick-image.h     magick_wand.h  MagickWand.h        mogrify.h  pixel-iterator.h  stream.h
compare.h  conjure.h    deprecate.h  drawing-wand.h  import.h    magick-property.h  magick-wand.h  method-attribute.h  montage.h  pixel-wand.h      wand-view.h
btakita commented 9 years ago

I found another dependency issue. When both Magick-config and pkg-config exist, Magick-config is used. Magick-config --cppflags does not have wand/MagickWand.h

  if find_executable("Magick-config")
    $magick_config = true
  elsif find_executable("pkg-config")
    $pkg_config = true
  else
    exit_failure "Can't install RMagick #{RMAGICK_VERS}. Can't find Magick-config or pkg-config in #{ENV['PATH']}\n"
  end

Changing it to the following works for me.

  if find_executable("pkg-config")
    $pkg_config = true
  elsif find_executable("Magick-config")
    $magick_config = true
  else
    exit_failure "Can't install RMagick #{RMAGICK_VERS}. Can't find Magick-config or pkg-config in #{ENV['PATH']}\n"
  end

This git repo seems to be on version 2.13.2, however the latest rmagick gem is on version 2.13.4.

btakita commented 9 years ago

Moved the discussion to https://github.com/gemhome/rmagick/issues/161.