I've followed the steps to install v8 and the libv8 gem. After that, I am unable to successfully install therubyracer 0.12.3. The mkmf.log chokes when trying to validate the v8.h header and throws out an unknown type name-error.
My environment:
Ruby: 2.6.3
OSX: 10.15
xcode-select: 2373
libv8: 3.16.14.19
v8:v8#3.15 (via Homebrew)
brew info v8#3.15 = v8#3.15: stable 3.15.11.18 (bottled) [keg-only]
g++: Apple clang version 11.0.0 (clang-1100.0.33.17)
I've worked through the suggestions here. Anyone got a suggestions?
Gem install
gem install therubyracer -v '0.12.3' -- --with-v8-dir=/usr/local/opt/v8#3.15
Failure message
Building native extensions with: '--with-v8-dir=/usr/local/opt/v8#3.15'
This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
current directory: /Users/kristinsmith/.gem/ruby/2.6.0/gems/therubyracer-0.12.3/ext/v8
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I
/Library/Ruby/Site/2.6.0 -r ./siteconf20200120-16109-4pdf22.rb extconf.rb --with-v8-
dir\=/usr/local/opt/v8#3.15
checking for -lpthread... yes
checking for -lobjc... yes
checking for v8.h... no
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
--with-pthreadlib
--without-pthreadlib
--with-objclib
--without-objclib
--enable-debug
--disable-debug
--with-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/lib
/Users/kristinsmith/.gem/ruby/2.6.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:50:in
`configure': By using --with-system-v8, you have chosen to use the version
(Libv8::Location::System::NotFoundError)
of V8 found on your system and *not* the one that is bundled with
the libv8 rubygem.
However, your system version of v8 could not be located.
Please make sure your system version of v8 that is compatible
with 3.16.14.19 installed. You may need to use the
--with-v8-dir option if it is installed in a non-standard location
from /Users/kristinsmith/.gem/ruby/2.6.0/gems/libv8-3.16.14.19/lib/libv8.rb:7:in
`configure_makefile'
from extconf.rb:32:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/kristinsmith/.gem/ruby/2.6.0/extensions/universal-darwin-19/2.6.0/therubyracer-
0.12.3/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/kristinsmith/.gem/ruby/2.6.0/gems/therubyracer-
0.12.3 for inspection.
Results logged to /Users/kristinsmith/.gem/ruby/2.6.0/extensions/universal-darwin .
19/2.6.0/therubyracer-0.12.3/gem_make.out
mkmf.log
...
find_header: checking for v8.h... -------------------- no
"xcrun clang I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.
5.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin19 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/backward -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0 -I. -I/usr/local/opt/v8#3.15/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -Wall -g -rdynamic -g -Os -pipe -DHAVE_GCC_ATOMIC_BUILTINS -arch x86_64 -c conftest.c"
clang: warning: argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument]
In file included from conftest.c:3:
/usr/local/opt/v8#3.15/include/v8.h:98:1: error: unknown type name 'namespace' namespace v8
{
^
/usr/local/opt/v8#3.15/include/v8.h:98:13: error: expected ';' after top level declarator
namespace v8 {
^
;
2 errors generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <v8.h>
/* end */
--------------------
...
I had the same error, and finally it appeared that rbenv ruby version was ignored.
Running eval "$(rbenv init -)" solved the issue and therubyracer was installed correctly.
Many thanks for the help! The final solution turned out to be:
Installing rbenv
Setting a Ruby version (2.6.3) in rbenv
Adding the following lines to my .zshrc:
eval "$(rbenv init -)" (Thanks, Mykolas Kairys)
export LDFLAGS="-L~/.rbenv/versions/2.6.3/lib"
export CPPFLAGS="-I~/.rbenv/versions/2.6.3/include"
Related
I am trying to install Rails by using
sudo gem install rails
on a fresh version of Ubuntu 16.04. Ruby 2.3.1p112 is already installed. During the installation of Rails, once fetching Nokogiri is complete, I get the error below:
Fetching: nokogiri-1.8.0.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/nokogiri-1.8.0/ext/nokogiri
/usr/bin/ruby2.3 -r ./siteconf20170608-1635-1vnwqbn.rb extconf.rb
checking if the C compiler accepts ... *** 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/$(RUBY_BASE_NAME)2.3
--help
--clean
/usr/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/lib/ruby/2.3.0/mkmf.rb:571:in `block in try_compile'
from /usr/lib/ruby/2.3.0/mkmf.rb:522:in `with_werror'
from /usr/lib/ruby/2.3.0/mkmf.rb:571:in `try_compile'
from extconf.rb:138:in `nokogiri_try_compile'
from extconf.rb:162:in `block in add_cflags'
from /usr/lib/ruby/2.3.0/mkmf.rb:629:in `with_cflags'
from extconf.rb:161:in `add_cflags'
from extconf.rb:407:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.8.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/nokogiri-1.8.0 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.8.0/gem_make.out
This is the content of mkmf.log:
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -lm -lc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
I have no idea what is wrong. The log does not help and I already tried installing libgmp-dev, ruby-dev, zlib1g-dev and liblzma-dev as they were suggested to people who are getting errors during Nokogiri gem installation.
After trying to find the missing dependency for a while, I ran the gcc command in the mkmf.log just in case some compilation error messages are being omitted.
It turned out that I didn't have gcc installed. Once I installed it, I got some progress with the installation only to encounter another similar error. In the end, installing the dependencies below resulted in a successful installation of Rails.
Please make sure you have gcc, make, zlib1g-dev, sqlite3 installed before running gem install rails:
sudo apt-get install gcc make zlib1g-dev sqlite3
i tried for a few weeks to install mysql2 for ruby so i can use it with dashing. But the only thing i get is:
gem install mysql2 --platform=ruby -- '--with-mysql-dir="/usr/include/mysql"'
Building native extensions with: '--with-mysql-dir="/usr/include/mysql"'
This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20160203-7890-abpifj.rb extconf.rb --with-mysql-dir="/usr/include/mysql"
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
-----
Cannot find include dir(s) /usr/include/mysql/include
-----
*** 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/local/rvm/rubies/ruby-2.2.4/bin/$(RUBY_BASE_NAME)
--with-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
extconf failed, exit code 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.2.4/gems/mysql2-0.4.2 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.2.4/extensions/armv7l-linux/2.2.0/mysql2-0.4.2/gem_make.out
it is a Raspberry Pi 2 with Ruby 2.2.4 via RVM installed.
libmysqlclient-dev is installed.
mkmf.log tells me:
have_func: checking for rb_thread_blocking_region()... -------------------- no
"gcc -o conftest -I/usr/local/rvm/rubies/ruby-2.2.4/include/ruby-2.2.0/armv7l-linux-eabihf -I/usr/local/rvm/rubies/ruby-2.2.4/include/ruby-2.2.0/ruby/backward -I/usr/local/rvm/rubies/ruby-2.2.4/include/ruby-2.2.0 -I. -D_FILE_OFFSET_BITS=64$
conftest.c: In function ‘t’:
conftest.c:13:57: error: ‘rb_thread_blocking_region’ undeclared (first use in this function)
conftest.c:13:57: note: each undeclared identifier is reported only once for each function it appears in
conftest.c:13:32: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]
It looks like there is a bug in the mysql2 gem you're trying to install.
Try install the previous stable version, 0.3.X
gem install mysql2 --platform=ruby -v '~> 0.3.0'
If that doesn't work, try update your Ruby version.
sudo apt-get install ruby2.2
Or, if you can, upgrade
sudo apt-get install ruby2.3
Install the raspbian specific package, before trying to get the gem this worked for me.
apt-get install ruby-mysql2
ruby new projectname -dmysql
I finally got around this error with the following:
apt-get install libmysql++-dev
you should
apt-get install libmariadbclient-dev
I have gcc6.1 installed on OS X via brew, when I tried to install sciruby-full on my Mac, always got this Error:
>Fetching: nmatrix-0.1.0.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing sciruby-full:
ERROR: Failed to build gem native extension.
/usr/local/opt/ruby/bin/ruby -r ./siteconf20150627-98945-1pk3go6.rb extconf.rb
checking for apparent GNU g++ binary with C++0x/C++11 support... Exception `RuntimeError' at extconf.rb:144 - You need a version of g++ which supports -std=c++0x or -std=c++11. If you're on a Mac and using Homebrew, we recommend using mac-brew-gcc.sh to install a more recent g++.
*** 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
--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/local/Cellar/ruby/2.2.2/bin/$(RUBY_BASE_NAME)
extconf.rb:144:in `<main>': You need a version of g++ which supports -std=c++0x or -std=c++11. If you're on a Mac and using Homebrew, we recommend using mac-brew-gcc.sh to install a more recent g++. (RuntimeError)
extconf failed, exit code 1
Gem files will remain installed in /usr/local/lib/ruby/gems/2.2.0/gems/nmatrix-0.1.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0/nmatrix-0.1.0/gem_make.out
My ruby and OS X is always the newest: Ruby 2.2.2 on updated Yosemite.
From your error message:
extconf.rb:144:in `': You need a version of g++ which supports
-std=c++0x or -std=c++11. If you're on a Mac and using Homebrew, we recommend using mac-brew-gcc.sh to install a more recent g++.
(RuntimeError)
Do the following (using homebrew)
brew tap homebrew/versions
brew install gcc48
if this does not work, try gcc47 or gcc46.
Note: It make take a while to build. gcc is quite large.
So I'm trying to install the audite gem, but having issues with rbenv:
$ bundle install
Fetching gem metadata from https://rubygems.org/...
Installing audite (0.3.0)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/opt/boxen/rbenv/versions/1.9.3-p448/bin/ruby extconf.rb
checking for mpg123.h... no
*** 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=/opt/boxen/rbenv/versions/1.9.3-p448/bin/ruby
please install mpg123 headers
Gem files will remain installed in /opt/boxen/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/audite-0.3.0 for inspection.
Results logged to /opt/boxen/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/audite-0.3.0/ext/mpg123/gem_make. out
An error occurred while installing audite (0.3.0), and Bundler cannot continue.
Make sure that `gem install audite -v '0.3.0'` succeeds before bundling.
I know that these gems require c extensions, and I have them installed with homebrew. And if I go into the cellar for homebrew I can see the file it's looking for (mpg123.h)
/opt/boxen/homebrew/Cellar/mpg123/1.15.4/include/mpg123.h
So, is there a way to add this into the rbenv environment without just sim-linking or copying it directly into /opt/boxen/rbenv/versions/1.9.3-p448/
xcode-select --install
resolved it for me.
I ran into the same issues trying to install audite. Turns out that mkmf writes a file call mkmf.log to tell you more specifically what it does to find out if the headers are availbale or not:
>>> cat mkmf.log
have_header: checking for mpg123.h... -------------------- no
"xcrun cc -E -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common conftest.c -o conftest.i"
xcode-select: Error: No Xcode is selected. Use xcode-select -switch <path-to-xcode>, or see the xcode-select manpage (man xcode-select) for further information.
checked program was:
/* begin */
1: #include <mpg123.h>
/* end */
--------------------
Turns out that I hadn't had xcode installed yet; after installing it and running
xcode-select --print-path
I saw that the path was now set. Then I still had to run xcrun once to agree to Apple's licence agreements, but then the installed installed just fine!
Add the homebrew include directory to your path, rubygems will find it. This isn't really a problem with rbenv.
In a default install, homebrew symlinks all the include folders of the packages to /usr/local/include, in your case, those should be in /opt/boxen/homebrew/include. Just have a look around, there should a be a folder somewhere containing all includes.
So in the end one of the following things fixed it for me, I'm not sure which because I'd rebuild and changed my machine few times since I had this issue:
Switched to Ruby 2.0.0
Upgraded to Mavericks (which does change some
stuff with xcode stuff I believe)
Updated my Boxen/Brew to latest
version
I am having issue while trying to install "rmagick" gem on centos. Following is the output I am having. Can anyone please help me identifying what package I am missing? I have installed all mentioned another stack-overflow thread: RMagick install error
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby 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
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
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.
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/local/bin/ruby
Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.13.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.13.2/ext/RMagick/gem_make.out
After following suggestions, now I am getting this output:
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby 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... *** 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/local/bin/ruby
/usr/local/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
from extconf.rb:194:in `<main>'
Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.13.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.13.2/ext/RMagick/gem_make.out
Output Of mkmf.log:
checking for HDRI disabled version of ImageMagick... -------------------- yes
--------------------
"gcc -o conftest -I/usr/local/include/ruby-1.9.1/x86_64-linux -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/ImageMagick-6 -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/ImageMagick-6 conftest.c -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L/usr/lib -lMagickCore-6.Q16 -L/usr/lib -lMagickCore-6.Q16 -Wl,-R -Wl,/usr/local/lib -L/usr/local/lib -lruby-static -lpthread -lrt -ldl -lcrypt -lm -lc"
/usr/bin/ld: skipping incompatible /usr/lib/libMagickCore-6.Q16.so when searching for -lMagickCore-6.Q16
/usr/bin/ld: skipping incompatible /usr/lib/libMagickCore-6.Q16.so when searching for -lMagickCore-6.Q16
/usr/bin/ld: skipping incompatible /usr/lib/libMagickCore-6.Q16.so when searching for -lMagickCore-6.Q16
/usr/bin/ld: cannot find -lMagickCore-6.Q16
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
Output of gem_make.out is same as the terminal output above.
try installing
sudo apt-get install libmagickwand-dev imagemagick
This ImageMagick 7 with RMagick 2.16 on MacOS Sierra Can't find MagickWand.h works for Rmagick 2.16.
brew install imagemagick#6
brew link --force imagemagick#6
gem install rmagick
The error message says:
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
It seems you missing no package at all, you just have to tell pkg-config where to find the MagickCore.pc file to build the extension. If you have installed the package ImageMagick-devel using yum the file should be inside the directory /usr/lib/pkgconfig or /usr/lib64/pkgconfig (depending on your architecture). Check with this command (from now I assume you are on a amd64 machine, if it's not the case replace lib64 with lib):
$ find /usr/lib64/pkgconfig -name MagickCore.pc
If the file is there you just have to install rmagick with this command:
$ PKG_CONFIG_PATH='/usr/lib64/pkgconfig' gem install rmagick
The problem is, as the error puts it,
Package MagickCore was not found in the pkg-config search path
The solution is also suggested there:
add the directory containing MagickCore.pc to the PKG_CONFIG_PATH environment variable
So,
Find MagickCore.pc location:
sudo find / -name MagickCore.pc
If it is not found, probably ImageMagick is not installed on your system — then install it (Google how to do it, as it depends on the OS)
Save it to the ENV var like that (make sure to put the path found in step 1):
PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
Retry installing RMagick
For Mac with Brew, simply..
brew install imagemagick
Then gem install imagemagick will work smoothly.
It doesn't look like you're missing any packages. The error message is important:
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
Several of the answers on this superuser duplicate give good advice.
On debian (unstable) the correct packages needed to resolve this error were libmagickcore-6.q16-dev, imagemagick and libmagickwand-6-headers
I found them by using apt-file search MagickCore.pc and apt-file search MagickWand.h
For windows users who run into this, and are 100% psotive that they have the devkit installed:
When installing, you will be presented this prompt
Choosing 1 is not enough. Just press enter (1 & 3) and that will install the devkit properly.