Can't install RMagick 2.15.4. Can't find MagickWand.h - ruby

While I'm trying to install rmagic, it shows following error
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/***/.rvm/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20170814-
44982-1i5w4mc.rb extconf.rb
checking for gcc... yes
checking for Magick-config... no
checking for pkg-config... yes
checking for outdated ImageMagick version (<= 6.4.9)... no
checking for Ruby version >= 1.8.5... yes
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no
Can't install RMagick 2.15.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.
I'm using MacOS sierra, ruby version 2.2.3

I had this issue a while back. You need to install imagemagick. Per the github repo for the rmagic gem
Pre-reqs:
ImageMagick Version 6.4.9 or later. You can get ImageMagick from www.imagemagick.org.
I believe you can also install it with brew
$ brew install imagemagick#6
$ brew link imagemagick#6 --force
$ gem install rmagick

brew unlink pkgconfig
bundle install
brew link pkgconfig
did the trick for me

Related

Can't install RMagick 4.2.6 on MacOS BigSur

Whenever I try to install rmagick I get ERROR: Can't install RMagick 4.2.6. Can't find ImageMagick with pkg-config. I tried all the other options, with installing imagemagick#6, setting PKG_CONFIG_PATH, unlinking, reinstalling & linking imagemagick, setting the pkg-config path from the lib folder of imagemagick, nothing worked.
More detailed error:
checking for brew... yes
checking for Ruby version >= 2.3.0... yes
checking for pkg-config... yes
ERROR: Can't install RMagick 4.2.6. Can't find ImageMagick with pkg-config
*** 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.
I used to get an error and also the rmagick installation issue:
pkg-config --list-all
[1] 664 segmentation fault pkg-config --list-all
pkg-config has version 0.29.2, I tried both removing the proj.pc file and changing it to the details from this comment.
pkg-config --exists --print-errors "proj" even returns nothing, so I don't think there's an error on that side.
I managed to fix the issue by uninstall highway (brew uninstall highway), because it has a conflict over a variable. Running pkg-config --debug --list-all will show that.

Issues building the libffi gem native extension when trying to install Jekyll on macOS Catalina

EDIT: I wrote up a more detailed solution on my blog here if you want to walk through all the steps.
I'm trying to install Jekyll via gem install Jekyll on macOS Catalina using Ruby install via homebrew and located at /usr/local/opt/ruby/bin/ruby and I'm running into the following error
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/Users/foobar/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/ffi-1.9.21/ext/ffi_c
/Users/foobar/.rbenv/versions/2.5.1/bin/ruby -r ./siteconf20181118-49440-k8mjki.rb
extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... no
checking for shlwapi.h... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
creating extconf.h
creating Makefile
current directory:
/Users/foobar/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/ffi-1.9.21/ext/ffi_c
make "DESTDIR=" clean
current directory:
/Users/foobar/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/ffi-1.9.21/ext/ffi_c
make "DESTDIR="
Running autoreconf for libffi
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal -I m4 --output=aclocal.m4t
Can't exec "aclocal": No such file or directory at
/usr/local/Cellar/autoconf/2.69/share/autoconf/Autom4te/FileUtils.pm line 326.
autoreconf: failed to run aclocal: No such file or directory
make: ***
["/Users/foobar/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/ffi-1.9.21/ext/ffi_c/libffi-x86_64-darwin18"/.libs/libffi_convenience.a]
Error 1
make failed, exit code 2
Gem files will remain installed in
/Users/foobar/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/ffi-1.9.21 for inspection.
Results logged to
/Users/foobar/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-18/2.5.0-static/ffi-1.9.21/gem_make.out
An error occurred while installing ffi (1.9.21), and Bundler cannot continue.
I've already tried updating my Xcode Command Line tools via xcode-select --install but I got back the following message:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
Does anyone know how I can build libffi on my machine so that I Jekyll can use it as a dependency?
Aaaaaand I figured it out! Credit to #ffleming here. Here's what you need to do:
reinstall libffi on brew using brew reinstall libffi
add the new brew-installed libffi flags to your shell instance, e.g.
export LDFLAGS="-L/usr/local/opt/libffi/lib"
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
Run gem install jekyll and you should be sorted!

Can't find wand/MagickWand.h

I have update my system to Ubuntu 15.04 and now Rmagick can't be installed...
It gives me the following error:
$ gem install rmagick -v '2.13.2'
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/home/maria/.rvm/rubies/ruby-2.1.1/bin/ruby -r ./siteconf20150428-16155-3f5duq.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 HDRI disabled version of ImageMagick... yes
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no
Can't install RMagick 2.13.2. 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.
I install all the packages needed (imagemagick libmagickwand-dev, etc, I have tried all the packages described in other questions)
Does someone had the same problem? Any clue?
Everything was working fine before updating to 15.04
EDIT
I managed to make it work purging imagemagick and installing from source http://www.imagemagick.org/script/install-source.php?ImageMagick=9s6tlikqbn5eb0u0spg5o38sa4#unix
Now gives me this error: This installation of RMagick was configured with ImageMagick 6.9.1 but ImageMagick 6.8.9-9 is in use.
I had the same problem and I fixed it up updating rmagick. What I did was:
sudo apt-get install libmagickwand-dev imagemagick
bundle update rmagick
And now bundle works correctly.
I am on ubuntu 15.04 and was able to get it by specifying version of rmagick
gem 'rmagick', '2.15.0'
I ran into same problem on clean Ubuntu 15.4 installation. Upgrade rmagick from 2.13.2 to 2.15.0 helped.
Things I tried, that did not help:
manually symlink in /usr/include/wand MagickWand.h ⇒ magick_wand.h;
rolling back to libmagickcore-dev.
Hope it helps.
If you are on Debian/Ubuntu I was able to fix it by doing the following:
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'
your lib versions may be different so check the version in /usr/lib/x86...
I got this from this discussion: https://github.com/ttscoff/Slogger/issues/344

some readline lib missing for ruby on ubuntu 12.04 with rvm

We are installing readline on ubuntu 12.04 for ruby 1.9.3. Some files are missing when running extconf:
$ ruby extconf.rb -- --with-readline-dir="$HOME/.rvm/usr"
checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... no
checking for readline() in -ledit... no
checking for editline/readline.h... no
How do we install the last 3 files missed before running make install? Thanks so much.
Try to download libreadline5-dev package for your architecture, for example, from here and install install it manually.
sudo dpkg -i downloaded_package.deb
It should help you.

Issue installing the Nokogiri gem in Mac OS X 10.5.8

I'm trying to install the Nokogiri gem under an RVM managed Ruby 1.8.7 installation in OS X Leopard (10.5.8).
I'm getting the following error:
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/user/.rvm/rubies/ruby-1.8.7-p352/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... yes
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... yes
checking for exsltFuncRegister() in -lexslt... yes
checking for xmlHasFeature()... no
-----
The function 'xmlHasFeature' is missing from your installation of libxml2. Likely this means that your installed version of libxml2 is old enough that nokogiri will not work well. To get around this problem, please upgrade your installation of libxml2.
Please visit http://nokogiri.org/tutorials/installing_nokogiri.html for more help!
*** extconf.rb failed ***
I have the latest libxml2 installed via homebrew (brew install libxml2), so I don't know what else to try.
Update:
I tried the instructions from the Nokogiri website and I can't get the Nokogiri gem installation to recognize libxml2.
Per the instructions
I installed and linked libxml2 and libxslt via homebrew:
brew install libxml2 libxslt
brew link libxml2 libxslt
gem install nokogiri
The error message has changed, but the Nokogiri installation complains that libxml2 is missing:
...
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... yes
checking for xmlParseDoc() in -lxml2... no
-----
libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies
The installed libxml2 version is 2.7.8.
Update update:
I tried installing the iconv library from homebrew to see if I could solve the error checking for iconv_open() in iconv.h... no, so I ran the commands:
brew install libiconv
brew link libiconv
And after finishing the installation, I tried to install the nokogiri gem again, to get this error message, where the installer now complains that libiconv is missing
hecking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... no
-----
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
I'm clueless.
Per the directions at: http://nokogiri.org/tutorials/installing_nokogiri.html you needed to use:
brew install libxml2 libxslt
brew link libxml2 libxslt
then
gem install nokogiri
Did you use those or only brew install libxml2?
Make sure there is no Nokogiri version available:
use gem uninstall nokogiri
First install the command-line tool for Xcode. Refer to "How to use/install gcc on Mac OS X 10.8 / Xcode 4.4".
Then run the following commands:
brew install libxml2
gem install nokogiri
Now it works well, I tried it.
brew install libxml2 libxslt
gem install nokogiri -- \
--with-xml2-lib=/usr/local/Cellar/libxml2/2.7.x/lib \
--with-xslt-dir=/usr/local/Cellar/libxslt/1.1.xx \
--with-iconv-lib=/usr/lib \
--with-iconv-include=/usr/local/include

Resources