0
votes

I tried to install rmagick using these commands, but it doesn't work.

sudo apt-get install imagemagick
sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev
sudo gem install rmagick

It ended up with the following error.

Building native extensions.
This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/rmagick-2.16.0/ext/RMagick /usr/bin/ruby2.3
-r ./siteconf20170603-20826-3to4j3.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.3.0/gems/rmagick-2.16.0 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/rmagick-2.16.0/gem_make.out

1

1 Answers

0
votes

You need to install also the ruby-dev package. That is why the ruby.h is not found when compiling a native extension.

Use the following command to install it.

sudo apt-get install ruby-dev

Basing on the package description, that will install the ruby2.3-dev package. That was the package it installed on my Ubuntu 16.04.

Package: ruby-dev
State: not installed
Multi-Arch: same
Version: 2:2.3.0+1bbox1~xenial1
Priority: optional
Section: devel Maintainer: Antonio Terceiro
Architecture: amd64
Uncompressed Size: 20.5 k
Depends: ruby2.3-dev
Provided by: ruby1.8-dev (1:1.8.7.375-1bbox1~xenial2)
Description: Header files for compiling extension modules for Ruby (default version) Ruby is the interpreted scripting language for quick and easy object-oriented programming. It has many features to process text files and to do system management tasks (as in perl). It is simple, straight-forward, and extensible. This package contains the header files and the mkmf library, necessary to make extension library for Ruby. It is also required to build many gems. This package is a dependency package, which depends on Debian's default Ruby version (currently v2.3).

I then installed Ruby 2.4, so now that package doesn't result installed on my computer.