rmagick-temp/rmagick

Can't install gem on Ubuntu 15.04

Opened this issue ยท 20 comments

Looks like there are new versions of ImageMagick & deps in Ubuntu 15.04 and I'm unable to meet the dependencies to build the gem with bundle. Last thing to try is install graphicsmagick-libmagick-dev-compat package, but still can't make it work:

 gem install rmagick -v '2.13.2'

throws this error:

checking for wand/MagickWand.h... no
Can't install RMagick 2.13.2. Can't find MagickWand.h

Same problem reported in this stackOverflow question

I have the same issue. After installing libmagickwand-dev, which used to work for previous Ubuntu versions, I still cannot install rmagic.

rmagic's configuration relies on Magick-config, which used to be part of imagemagick, but is now part of graphicsmagick - which is a fork of ImageMagick, specifically the graphicsmagick-libmagick-dev-compat package which is supposed to provide some backward compatibility with ImageMagick APIs and even provides MagicWand which is the API rmagic relies on. Unfortunately GraphicsMagick's Magick-config does not provide correct include paths using the --cflags switch (though it does provide them for --cppflags) - this may be a bug in Ubuntu's GraphicsMagick package, but I'm not going to go into that because I want to use ImageMagick.

ImageMagick can still be installed in Ubuntu 15.04, and does still provide its Magick-config utility, though now it is not on the path so rmagic doesn't know how to call it.

The workaround is to preload the path before you call gem install, like this:

PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH" gem install rmagick

and that solved it for me.

I'm not sure how to go on from here - one way would be to get Ubuntu to fix GraphicsMagic's Magick-config and maybe get rmagic to work with that library. Another may be to allow rmagic to find ImageMagick's configuration utility somehow.

I have the same problem but unfortunately, @guss77's solution didn't work for me. I've checked the path exists and it's there, so it should be ok. The resulting mkmf.log has the following;

have_header: checking for wand/MagickWand.h... -------------------- no

"gcc -E -I/home/graeme/.rvm/rubies/ruby-2.1.2/include/ruby-2.1.0/x86_64-linux -I/home/graeme/.rvm/rubies/ruby-2.1.2/include/ruby-2.1.0/ruby/backward -I/home/graeme/.rvm/rubies/ruby-2.1.2/include/ruby-2.1.$
In file included from conftest.c:3:0:
/usr/include/ImageMagick-6/wand/MagickWand.h:29:36: fatal error: magick/magick-config.h: No such file or directory
 #  include "magick/magick-config.h"
                                ^
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <wand/MagickWand.h>
/* end */

--------------------
Can't install RMagick 2.15.0. Can't find MagickWand.h.

@simmogs , did you run gem with the PATH preloaded, as in my example, and did you make sure to first install libmagickwand-dev?

Maybe I missed something... try to install libmagickcore-6.q16-dev and see if that solves your problem?

Nope, that's already installed too.

bf4 commented

Please close this issue as the repo has moved rmagick/rmagick#120 At this time we do not have access to this repo.

@simmogs , I have failed to reproduce your problem on a docker installation (obviously my system is not a clean installation, and docker is faster than installing in a VM).

This is my Dockerfile:

FROM ubuntu:15.04
RUN apt-get update && apt-get install -y imagemagick libmagickwand-dev curl
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
RUN curl -sSL https://get.rvm.io | bash -s stable --ruby
RUN bash -lc 'PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH" gem install rmagick'

I've moved the query across to the correct repo. Should this one be closed?

Yes, it's better to close it.

Same problem that @simmogs here

here's what i did on 15.10,
sudo apt-get install libmagickwand-dev
sudo apt-get install graphicsmagick-imagemagick-compat
PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH" gem install rmagick -v '2.13.2'

Assuming I have gotten my shit together, do you have a more concrete proposal?

@vassilevsky, as I've mentioned previously, I'm not sure how to solve this issue. I think there are two possible ways to go about fixing this:

  1. rmagick will commit to support the ImageMagick fork called GraphicsMagick. I have no idea how much work this entails for rmagick - GraphicsMagick purports to be 100% ImageMagick compatible, but its likely some newer feature are missing or not 100% compatible. If we go this way, likely the MagickConfig implementation in Ubuntu will need some small changes which will be easy to push upstream (or it might just work).
  2. rmagick will require an ImageMagick Installation, in which case we'd need to go back to Ubuntu and figure out how to have ImageMagick installed and discoverable without manual PATH modifications. This will obviously be harder to work in Ubuntu and will take a much longer time for whoever is doing the Ubuntu coordination.
bf4 commented

Please move respectful conversation to the rmagick repository: https://github.com/rmagick/rmagick

If you're going to be a jerk, feel free to keep commenting here.

The relevant issue in the "official" rmagick repo is here: rmagick/rmagick#201 . It looks like there is a start of a solution there, but as can be seen from the comments above, as well as the June 15 comments in the mentioned issue, it is incomplete.

Thanks for your solution and I suppose to fix it permanently we could just do:
ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config /usr/bin/Magick-config

@deXterbed thank you!!! ๐Ÿ‘

I've tried to reinstall every single package, but none of them creates an ImageMagick folder inside x_86_64-linux-gnu so I can't replicate your solution.

I have a Magick-config file in /usr/bin/Magick-config with the following content:

#!/bin/sh
#
# Configure options script for re-calling MagickCore compilation options
# required to use the MagickCore library.
#

prefix=/usr
exec_prefix=${prefix}

usage="\
Usage: Magick-config [--cflags] [--cppflags] [--exec-prefix] [--ldflags] [--libs] [--prefix] [--version]"

if test $# -eq 0; then
      echo "${usage}" 1>&2
      echo "Example: gcc \`Magick-config --cflags --cppflags\` -o core core.c \`Magick-config --ldflags --libs\`" 1>&2
      exit 1
fi

while test $# -gt 0; do
  case "$1" in
    -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
    *) optarg= ;;
  esac
  case $1 in
    --prefix=*)
      prefix=$optarg
      ;;
    --prefix)
      echo $prefix
      ;;
    --exec-prefix=*)
      exec_prefix=$optarg
      ;;
    --exec-prefix)
     echo $exec_prefix
      ;;
    --version)
      echo '6.7.7 Q16 '
      ;;
    --cflags)
      pkg-config --cflags MagickCore
      ;;
    --cxxflags)
      pkg-config --cflags MagickCore
      ;;
    --cppflags)
      pkg-config --cflags MagickCore
      ;;
    --ldflags)
      pkg-config --libs MagickCore
      ;;
    --libs)
      pkg-config --libs MagickCore
      ;;
    *)
      echo "${usage}" 1>&2
      exit 1
      ;;
  esac
  shift
done

And I found the Magickwand.h file in /usr/include/ImageMagick/wand

My convert command is working properly, this is my convert version:

Version: ImageMagick 7.0.1-3 Q16 x86_64 2016-05-14

And in case is useful, this is the output of the convert -list configure command:

Path: /usr/local/lib/ImageMagick-7.0.1//config-Q16HDRI/configure.xml

Name           Value
-------------------------------------------------------------------------------
CC             gcc -std=gnu99 -std=gnu99
CFLAGS         -I/usr/include/libxml2   -I/usr/include/libpng12     -I/usr/include/freetype2      -fopenmp -g -O2 -Wall -mtune=corei7-avx -fexceptions -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
CODER_PATH     /usr/local/lib/ImageMagick-7.0.1/modules-Q16HDRI/coders
CONFIGURE      ./configure 
CONFIGURE_PATH /usr/local/etc/ImageMagick-7/
COPYRIGHT      Copyright (C) 1999-2016 ImageMagick Studio LLC
CPPFLAGS       -I/usr/local/include/ImageMagick-7
CXX            g++
CXXFLAGS       -g -O2 -pthread
DEFS           -DHAVE_CONFIG_H
DELEGATES      bzlib mpeg freetype jbig jng jpeg lzma png ps tiff wmf x xml zlib
DISTCHECK_CONFIG_FLAGS  --disable-deprecated  --with-quantum-depth=16  --with-jemalloc=no  --with-umem=no  --with-autotrace=no  --with-gslib=no  --with-fontpath=  --with-rsvg=no  --with-perl=no 
DOCUMENTATION_PATH /usr/local/share/doc/ImageMagick-7
EXEC-PREFIX    /usr/local
EXECUTABLE_PATH /usr/local/bin
FEATURES       DPC HDRI Cipher OpenMP
FILTER_PATH    /usr/local/lib/ImageMagick-7.0.1/modules-Q16HDRI/filters
GIT_REVISION   10854
HOST           x86_64-unknown-linux-gnu
INCLUDE_PATH   /usr/local/include/ImageMagick-7
LDFLAGS        -L/usr/local/lib  
LIB_VERSION    0x701
LIB_VERSION_NUMBER 7,0,1,3
LIBRARY_PATH   /usr/local/lib/ImageMagick-7.0.1
LIBS            -ljbig  -ltiff -lfreetype    -ljpeg   -lpng12          -lwmflite  -lXext -lXt   -lSM -lICE -lX11  -llzma   -lbz2     -lxml2    -lz    -lm -lgomp    
NAME           ImageMagick
PCFLAGS        -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
PREFIX         /usr/local
QuantumDepth   16
RELEASE_DATE   2016-05-14
SHARE_PATH     /usr/local/share/ImageMagick-7
SHAREARCH_PATH /usr/local/lib/ImageMagick-7.0.1/config-Q16HDRI
TARGET_CPU     x86_64
TARGET_OS      linux-gnu
TARGET_VENDOR  unknown
VERSION        7.0.1
WEBSITE        http://www.imagemagick.org

Path: [built-in]

Name           Value
-------------------------------------------------------------------------------
FEATURES       OpenMP 
NAME           ImageMagick
QuantumDepth   16

I'd like to know if is there any way to specify the location of the missing file when installing the gem.

Thank you in advance

I was facing the same problem. I tried every solution on stackoverflow from making symlinks to installing libraries.

In the end, only install the required version of ImageMagick worked for me.

You can find instructions for it from here and source files from here