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.
Related
I installed pkg-config and imagemagick:
brew install pkg-config imagemagick#6
Imagemagick version
identify -version
Version: ImageMagick 6.9.12-28 Q16 arm 2021-10-29 https://imagemagick.org
When trying to install rmagick
gem install rmagick
I get
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
current directory: /opt/homebrew/lib/ruby/gems/3.0.0/gems/rmagick-4.2.3/ext/RMagick
/opt/homebrew/opt/ruby/bin/ruby -I /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0 -r ./siteconf20211112-33588-cd2c64.rb extconf.rb
checking for brew... yes
checking for Ruby version >= 2.3.0... yes
checking for pkg-config... yes
/opt/homebrew/Library/Homebrew/shims/mac/super/pkg-config: line 9: /pkg-config/bin/pkg-config: No such file or directory
/opt/homebrew/Library/Homebrew/shims/mac/super/pkg-config: line 9: exec: /pkg-config/bin/pkg-config: cannot execute: No such file or directory
ERROR: Can't install RMagick 4.2.3.
Can't find the ImageMagick library or one of the dependent libraries.
Check the mkmf.log file for more detailed information.
*** 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=/opt/homebrew/Cellar/ruby/3.0.2_1/bin/$(RUBY_BASE_NAME)
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/opt/homebrew/lib/ruby/gems/3.0.0/extensions/arm64-darwin-20/3.0.0/rmagick-4.2.3/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /opt/homebrew/lib/ruby/gems/3.0.0/gems/rmagick-4.2.3 for inspection.
Results logged to /opt/homebrew/lib/ruby/gems/3.0.0/extensions/arm64-darwin-20/3.0.0/rmagick-4.2.3/gem_make.out
So I created a folder /opt/homebrew/Library/Homebrew/shims/mac/super/pkg-config/bin/ containing a symbolic link
ln -s /opt/homebrew/opt/pkg-config/bin/pkg-config pkg-config
And now when trying to install rmagick I get:
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
current directory: /opt/homebrew/lib/ruby/gems/3.0.0/gems/rmagick-4.2.3/ext/RMagick
/opt/homebrew/opt/ruby/bin/ruby -I /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0 -r ./siteconf20211112-33523-27c8up.rb extconf.rb
checking for brew... yes
checking for Ruby version >= 2.3.0... yes
checking for pkg-config... yes
checking for outdated ImageMagick version (<= 6.7.7)... no
checking for clang... yes
Warning: Found more than one ImageMagick installation. This could cause problems at runtime.
/opt/homebrew/opt/imagemagick#6/bin/Magick-config reports version 6.9.12-28 Q16 is installed in /opt/homebrew/Cellar/imagemagick#6/6.9.12-28
/opt/homebrew/bin/Magick-config reports version 6.9.12-28 Q16 is installed in /opt/homebrew/Cellar/imagemagick#6/6.9.12-28
Using 6.9.12-28 Q16 from /opt/homebrew/Cellar/imagemagick#6/6.9.12-28.
checking for __GNUC__... *** 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=/opt/homebrew/Cellar/ruby/3.0.2_1/bin/$(RUBY_BASE_NAME)
/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:471:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:597:in `block in try_compile'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:546:in `with_werror'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:597:in `try_compile'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:864:in `macro_defined?'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:1006:in `block in have_macro'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:971:in `block in checking_for'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:361:in `block (2 levels) in postpone'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:331:in `open'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:361:in `block in postpone'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:331:in `open'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:357:in `postpone'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:970:in `checking_for'
from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/mkmf.rb:1005:in `have_macro'
from extconf.rb:99:in `configure_compile_options'
from extconf.rb:19:in `initialize'
from extconf.rb:398:in `new'
from extconf.rb:398:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/opt/homebrew/lib/ruby/gems/3.0.0/extensions/arm64-darwin-20/3.0.0/rmagick-4.2.3/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /opt/homebrew/lib/ruby/gems/3.0.0/gems/rmagick-4.2.3 for inspection.
Results logged to /opt/homebrew/lib/ruby/gems/3.0.0/extensions/arm64-darwin-20/3.0.0/rmagick-4.2.3/gem_make.out
It is specified I have to install development tools so I checked if it was installed:
gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: arm64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I've been searching for a long time now and found several topics dealing with similar issues but none of them could help me...
Do you have an idea why this doesn't work ?
I'm using Mac OSX 11.6, ruby 3.0.2p107
Thanks a lot
Okay just by restarting the mac, uninstalling and reinstalling everything I managed to install rmagick v4.2.3.
Uninstall
brew uninstall pkg-config imagemagick#6
Reinstall
brew install pkg-config imagemagick#6
And installed Rmagick
gem install rmagick
I already tried to uninstall and reinstall before but without restarting the mac and the Rmagick installation was failing in the same way... So it seems that restart was needed, maybe one of the paths or environment variables needed this to be set properly for Rmagick...
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"
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 have RVM installed on openSUSE 11.3. My preferred Ruby version is MRI 1.9.2p136.
I tried to install RMagick gem and got the following output:
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/home/user1/.rvm/rubies/ruby-1.9.2-head/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
Warning: Found more than one ImageMagick installation. This could cause problems at runtime.
/usr/bin/Magick-config reports version 6.6.1 Q16 is installed in /usr
/usr/bin/X11/Magick-config reports version 6.6.1 Q16 is installed in /usr
Using 6.6.1 Q16 from /usr.
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=/home/user1/.rvm/rubies/ruby-1.9.2-head/bin/ruby
/home/user1/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /home/user1/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
from /home/user1/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:834:in `block in have_header'
from /home/user1/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
from /home/user1/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
from /home/user1/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /home/user1/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
from /home/user1/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /home/user1/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
from /home/user1/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
from /home/user1/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:833:in `have_header'
from extconf.rb:193:in `<main>'
Here's what I have in mkmf.log:
"gcc -o conftest -I/home/user1/.rvm/rubies/ruby-1.9.2-head/include/ruby-1.9.1/i686-linux -I/home/user1/.rvm/rubies/ruby-1.9.2-head/include/ruby-1.9.1/ruby/backward -I/home/user1/.rvm/rubies/ruby-1.9.2-head/include/ruby-1.9.1 -I. -I/usr/include/ImageMagick -I/usr/include/ImageMagick -fopenmp conftest.c -L. -L/home/user1/.rvm/rubies/ruby-1.9.2-head/lib -Wl,-R/home/user1/.rvm/rubies/ruby-1.9.2-head/lib -L/usr/lib -L/usr/lib -L/usr/lib -lMagickCore -llcms -ltiff -lfreetype -ljpeg -lfontconfig -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lm -lgomp -lpthread -lltdl -Wl,-R -Wl,/home/user1/.rvm/rubies/ruby-1.9.2-head/lib -L/home/user1/.rvm/rubies/ruby-1.9.2-head/lib -lruby-static -lpthread -lrt -ldl -lcrypt -lm -lc"
/usr/lib/gcc/i586-suse-linux/4.5/../../../../i586-suse-linux/bin/ld: cannot find -lbz2
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */
Actually, the error doesn't tell me anything. I have already installed all basic development packages and ImageMagick headers. Am I still missing some development binaries?
Ok, thanks for your post. I had the same problem, but the answer was quite easy.
I've installed the bzip2 development headers.
zypper in libbz2-devel
After this tasks the installation of rmagick worked. (Maybe you have to install the complete bzip2 package?)
So, finally:
to install rmagick gem on openSUSE 11.3, prerequisites are:
ImageMagick-devel, libMagick++-devel, libbz2-devel
su -c 'zypper in ImageMagick-devel libMagick++-devel libbz2-devel' -
I had the same problem. I installed all the packages mentioned in the rest of the thread, to no avail. In the end it took a couple which weren't mentioned, but which had popped up in error messages - the packages I had to install were tdl and libtool.