Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install gem on Ubuntu 15.04 #201

Closed
simmogs opened this issue May 27, 2015 · 30 comments
Closed

Can't install gem on Ubuntu 15.04 #201

simmogs opened this issue May 27, 2015 · 30 comments

Comments

@simmogs
Copy link

simmogs commented May 27, 2015

As per this issue (#133).

Having upgraded to Ubuntu 15.04, I can no longer install the rmagick gem. I've tried the suggested fixes but so far no luck and despite kind assistance from @guss77.

Terminal output - https://gist.github.com/simmogs/6307ff927a14ce8f21d9

@vassilevsky
Copy link
Member

I spun up a Digital Ocean droplet with Ubuntu 15.04 and installed these packages:

ruby ruby-dev imagemagick libmagickwand-dev

After that, gem install rmagick worked without problems. I can load irb and require 'rmagick' successfully.

The path to the problematic header file is:

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

So the problem is not with Ubuntu 15.04.

Here's my PATH:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

I noticed that the configuration script tells you there are several ImageMagick installations. Could it be because there are extra directories in some environment variables?

@guss77
Copy link

guss77 commented May 27, 2015

Default installations of Ubuntu (unless its a minimal server install)
usually include GraphicsMagick. The problem with installing rmagick on
Ubuntu 15.04 seems related to the scenario where both GrapgicsMagick and
ImageMagick (or atleast the MagickWand library) are installed.

On Wed, May 27, 2015 at 6:32 PM, Ilya Vassilevsky [email protected]
wrote:

I spun up a Digital Ocean droplet with Ubuntu 15.04 and installed these
packages:

ruby ruby-dev imagemagick libmagickwand-dev

After that, gem install rmagick worked without problems. I can load irb
and require 'rmagick' successfully.

The path to the problematic header file is:

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

So the problem is not with Ubuntu 15.04.

Here's my PATH:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

I noticed that the configuration script tells you there are several
ImageMagick installations. Could it be because there are extra directories
in some environment variables?


Reply to this email directly or view it on GitHub
#201 (comment).

Oded

@vassilevsky
Copy link
Member

Currently RMagick is not compatible with GraphicsMagick.

The droplet didn't have any *magick packages installed. Perhaps that was key to the success.

You can see the simple algorithm for multiple versions detection here:

https://github.com/gemhome/rmagick/blob/master/ext/RMagick/extconf.rb#L166

Looks like you might need to clean up your envvars a little bit and see if that helps.

@guss77
Copy link

guss77 commented May 27, 2015

The multiple versions detection logic assumes all magicks installed have a
Magick-config somewhere in the path, then IIUC, scans for the first
compatible version.

The problem is that under Ubuntu 15.04 the "good" Magick-config is not in
the path at all. From my experience, adding the location of the good
Magick-config to the path works around the problem, but apparently this is
not 100% correct.
On May 27, 2015 19:43, "Ilya Vassilevsky" [email protected] wrote:

Currently RMagick is not compatible with GraphicsMagick.

The droplet didn't have any *magick packages installed. Perhaps that was
key to the success.

You can see the simple algorithm for multiple versions detection here:

https://github.com/gemhome/rmagick/blob/master/ext/RMagick/extconf.rb#L166

Looks like you might need to clean up your envvars a little bit and see if
that helps.


Reply to this email directly or view it on GitHub
#201 (comment).

@vassilevsky
Copy link
Member

I installed Ubuntu 15.04 in VirtualBox from the official ISO and it doesn't have any *magick packages installed and doesn't have any headers.

@guss77
Copy link

guss77 commented May 27, 2015

Hmm. I don't remember installing GraphicsMagick, so I was under the
impression that it comes by default. Looking a bit more into it, some
software available on Ubuntu 15.04, though not installed by default,
depends on the GraphicsMagick packages, or on the compatibility package graphicsmagick-libmagick-dev-compat, e.g. xine. I must have installed one
of those.

Still, even without any GraphicsMagick package installed, rmagic will not
install on Ubuntu 15.04 without the manual PATH manipulation workaround,
because Magick-config is not on the default PATH.

On Wed, May 27, 2015 at 10:34 PM, Ilya Vassilevsky <[email protected]

wrote:

I installed Ubuntu 15.04 in VirtualBox from the official ISO and it
doesn't have any *magick packages installed and doesn't have any headers.


Reply to this email directly or view it on GitHub
#201 (comment).

Oded

@vassilevsky
Copy link
Member

Ubuntu is a pretty popular platform. It makes sense to support it explicitly in extconf.rb. Too bad major CI servers don't offer 15.04 yet. Also, the current extconf.rb is so cumbersome, it needs lots of refactoring. Any help will be greatly appreciated!

@u338steven
Copy link
Contributor

Hi.

@simmogs
Could you try the followings?

PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig gem install rmagick

or

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

Actually, Magick-config merely calls pkg-config now.
Then, from RMagick 2.13.4, if Magick-config cannot be found, extconf.rb calls pkg-config directly.
Therefore, we should just find a pkg-config file MagickCore.pc, but I guess it might be not on default pkg-config path.

/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config
...
/usr/lib/x86_64-linux-gnu/pkgconfig/MagickCore.pc

Ubuntu – File list of package libmagickcore-6.q16-dev/vivid/amd64

@kp666
Copy link

kp666 commented May 28, 2015

@u338steven still same error for me.

I had an error with Magick-config as well so i symlinked
/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config to /usr/bin/Magick-config

Now stuck at 'Can't find MagickWand.h.'
The file is actually here /usr/include/ImageMagick-6/wand/MagickWand.h

@u338steven
Copy link
Contributor

@kp666
Hmm... MagickWand.h obviously exists.
It might be lack of header files that MagickWand.h includes.
Could you compile the following foo.c and tell us the error message?

foo.c:

#include "wand/MagickWand.h"
void main(){}
gcc foo.c `Magick-config --cflags`

@kp666
Copy link

kp666 commented May 28, 2015

@u338steven
I get this error
/usr/include/ImageMagick-6/wand/MagickWand.h:29:36: fatal error: magick/magick-config.h: No such file or directory

@guss77
Copy link

guss77 commented May 28, 2015

Just overriding the PKG_CONFIG_PATH works for me if GraphicsMagick isn't installed, but breaks if both systems are installed.

When PATH is overridden it works with or without PKG_CONFIG_PATH overriding.

@kp666
Copy link

kp666 commented May 28, 2015

@guss77 where do you set the path to?

@guss77
Copy link

guss77 commented May 28, 2015

What @u338steven said.

@kp666
Copy link

kp666 commented May 28, 2015

@guss77 No luck here, with PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH

@guss77
Copy link

guss77 commented May 28, 2015

@kp666, regarding the test C program, can you try to run this with the full path to imagemagick's Magic-config instead of using it from path?

@kp666
Copy link

kp666 commented May 28, 2015

@guss77 The magic-conf.h file is actually missing

ls on imagemagick include folder seems different. I think it should be a wand folder and a magic folder but this is what i get.
ls /usr/include/ImageMagick-6/
Magick++ Magick++.h wand

@guss77
Copy link

guss77 commented May 28, 2015

magick/magick-config.h is part of libmagickcore-6-headers which should be installed by installing libmagickwand-dev. The full path is /usr/include/ImageMagick-6/magick/magick-config.h

When executing /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config --cflags, the output should be:

-fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/x86_64-linux-gnu//ImageMagick-6 -I/usr/include/ImageMagick-6

If any of these is not true on your system, then your system is broken compared to a clean Ubuntu installation.

@kp666
Copy link

kp666 commented May 28, 2015

@guss77 This is weird, I have libmagickwand-dev installed.

ls /usr/include/ImageMagick-6/                                            
Magick++  Magick++.h  wand

Magick++ and wand are the folders . so there is no magick folder and hence no /usr/include/ImageMagick-6/magick/magick-config.h

/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config --cflags
-fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/x86_64-linux-gnu//ImageMagick-6 -I/usr/include/ImageMagick-6 

I just had a new installation today.
Image magick version is 6.8.9 btw.

convert -version
Version: ImageMagick 6.8.9-9 Q16 x86_64 2015-01-06 http:https://www.imagemagick.org

@guss77
Copy link

guss77 commented May 28, 2015

What happens when you run

dpkg -L libmagickcore-6-headers | while read file; do [ -e "$file" ] || echo $file; done

If your system is setup correctly there should be no output at all.

@kp666
Copy link

kp666 commented May 28, 2015

@guss77 i do get a list of files https://gist.github.com/kp666/d6183eb494acb75fc56b
So i guess my system is not setup right then.
I uninstalled libmagickcore-6-headers and resintalled libmagickwand-dev.
After this i could install rmagick.

@guss77
Copy link

guss77 commented May 28, 2015

It looks like the package is actually installed (it also includes a few files that are not in your list, so I'm thinking these are still there), but somehow the include directory was deleted.

I suggest you try to apt-get install --reinstall all the packages in question and then see if it solves your problem.

@kp666
Copy link

kp666 commented May 28, 2015

@guss77 yes, that basically fixed it. Thanks for your time.

@simmogs
Copy link
Author

simmogs commented May 29, 2015

I did the following and success!

sudo apt-get purge graphicsmagick graphicsmagick-dbg imagemagick-common imagemagick imagemagick-6.q16 libmagickcore-6-headers libmagickwand-dev
sudo apt-get autoremove
sudo apt-get install imagemagick libmagickwand-dev
gem install rmagick

@yuszuv
Copy link

yuszuv commented Jun 5, 2015

This worked for me, too. Except, that I also had to sudo apt-get purge graphicsmagick-libmagick-dev-compat on my system.

@mikelkew
Copy link

This worked for me too, but I also needed to run the following symlink, then it installed with no issues:
sudo ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config /usr/bin/Magick-config

@j-dexx
Copy link

j-dexx commented Nov 30, 2015

Symlink works for me too

@peter-g-arnold
Copy link

I have to work on an old Ruby on Rails project. To get it running I have to install RMagick -v 2.12.2. First I had problems with both this version and new version(s) of RMagick. The command

PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig gem install rmagick

mentioned in this thread made it possible for me to install the RMagick version 2.15.4 but the 2.12.2 still throws:

PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig gem install rmagick -v '2.12.2'

checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.3.5... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... yes
checking for InitializeMagick() in -lMagickCore... no
checking for InitializeMagick() in -lMagick... no
Can't install RMagick 2.12.2. Can't find the ImageMagick library or one of the dependent libraries. Check the mkmf.log file for more detailed information.

Everything else (tried simmogs yuszuv and mikelkew's suggestions) posted here did not work unfortunately. Any suggestions?

@vassilevsky
Copy link
Member

Is there a reason you cannot use the latest version? It has been fixed to support newer OSes better.

@taiar
Copy link

taiar commented Jun 10, 2016

Perfect, @simmogs @yuszuv!

Thank you a lot!

@rmagick rmagick deleted a comment from peter-g-arnold Jan 27, 2019
@rmagick rmagick deleted a comment from peter-g-arnold Jan 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests