How to install Nokogiri with Rails on Ubuntu 16.04 - ruby

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

Related

gem install therubyracer -v 0.12.3 on OSX 10.15

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"

Trouble installing pg gem on OSX 10.10

I'm trying to install the pg gem on my system (macbook pro running 10.10, Postgresql 9.3.5_1, Ruby 1.9.3p547, Xcode v6.1 (6A1052c)) with this command:
ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/usr/local/Cellar/postgresql/9.3.5_1/bin/pg_config
Returns this:
Building native extensions with: '--with-pg-config=/usr/local/Cellar/postgresql/9.3.5_1/bin/pg_config'
This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/Users/thomas/.rvm/rubies/ruby-1.9.3-p547/bin/ruby extconf.rb --with-pg-config=/usr/local/Cellar/postgresql/9.3.5_1/bin/pg_config
Using config values from /usr/local/Cellar/postgresql/9.3.5_1/bin/pg_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.
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=/Users/thomas/.rvm/rubies/ruby-1.9.3-p547/bin/ruby
--with-pg
--without-pg
--with-pg-config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
/Users/thomas/.rvm/rubies/ruby-1.9.3-p547/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 /Users/thomas/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
from /Users/thomas/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
from extconf.rb:39:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/thomas/.rvm/gems/ruby-1.9.3-p547/gems/pg-0.17.1 for inspection.
Results logged to /Users/thomas/.rvm/gems/ruby-1.9.3-p547/extensions/x86_64-darwin-13/1.9.1/pg-0.17.1/gem_make.out
What?
I'm pretty sure I have the developer tools installed:
xcode-select --print-path
Returns:
/Applications/Xcode.app/Contents/Developer
My mkmf.log file contains this:
"/usr/local/opt/gcc46/bin/gcc-4.6 -o conftest -I/Users/thomas/.rvm/rubies/ruby-1.9.3-p547/include/ruby-1.9.1/x86_64-darwin13.4.0 -I/Users/thomas/.rvm/rubies/ruby-1.9.3-p547/include/ruby-1.9.1/ruby/backward -I/Users/thomas/.rvm/rubies/ruby-1.9.3-p547/include/ruby-1.9.1 -I. -I/usr/local/Cellar/postgresql/9.3.5_1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fno-common -pipe conftest.c -L. -L/Users/thomas/.rvm/rubies/ruby-1.9.3-p547/lib -L/usr/local/Cellar/postgresql/9.3.5_1/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -lruby.1.9.1 -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
Doesn anyone have a clue about what's going on here? Any help would be greatly appreciated!
This solved my problem
First you should download the Postgres App (http://postgresapp.com/) and place it in your Applications folder. Extract and open it, now write this in your console.
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
I wrote 9.4 because it was my latest version.
I finally solved this by ripping out all my rubies thus: rvm implode. Then I reinstalled rvm and Ruby 2.1.3 instead of 1.9.3. Sadly, I don't know exactly what the cause of the problem was, but I'm suspecting Ruby 1.9.3 does not install nicely with rvm on OSX 10.10.

unable to install compass

Last week I made an update in cygwin because of the bash "vulnerable problem".
After that I couldn't compile sass anymore.
I tried to reinstall ruby, after some install fails and reinstalling cygwin I installed it and updated with "gem update --system"
it run, but when I tried to install compass I got following message:
> /usr/bin/ruby.exe -r ./siteconf20141006-7856-1td7wzb.rb extconf.rb
> checking for ffi.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/bin/ruby
> --with-ffi_c-dir
> --without-ffi_c-dir
> --with-ffi_c-include
> --without-ffi_c-include=${ffi_c-dir}/include
> --with-ffi_c-lib
> --without-ffi_c-lib=${ffi_c-dir}/
> --with-libffi-config
> --without-libffi-config
> --with-pkg-config
> --without-pkg-config /usr/share/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
> You have to install development tools first. from
> /usr/share/ruby/2.0.0/mkmf.rb:565:in `try_cpp' from
> /usr/share/ruby/2.0.0/mkmf.rb:1044:in `block in have_header' from
> /usr/share/ruby/2.0.0/mkmf.rb:895:in `block in checking_for' from
> /usr/share/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
> from /usr/share/ruby/2.0.0/mkmf.rb:310:in `open' from
> /usr/share/ruby/2.0.0/mkmf.rb:340:in `block in postpone' from
> /usr/share/ruby/2.0.0/mkmf.rb:310:in `open' from
> /usr/share/ruby/2.0.0/mkmf.rb:336:in `postpone' from
> /usr/share/ruby/2.0.0/mkmf.rb:894:in `checking_for' from
> /usr/share/ruby/2.0.0/mkmf.rb:1043:in `have_header' from
> extconf.rb:16:in `<main>'
>
> extconf failed, exit code 1
I tried to install ffi ("gem install ffi" and "gem install ffi --pre"),I got the same message
here is the log (.gem/ruby/extensions/x86_64-cygwin/ffi-1.9.5/gem_make.out)
package configuration for libffi is not found
"gcc -o conftest.exe -I/usr/include/ruby-2.0.0 -I/usr/include/ruby-2.0.0/ruby/backward -I/usr/include/ruby-2.0.0 -I. -ggdb -O2 -pipe -Wimplicit-function-declaration conftest.c -L. -L/usr/lib -L. -fstack-protector -lruby200 -lpthread -lrt -ldl -lcrypt "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
I'm really frustrated!!'
system Windows 7 64bit
Cygwin
Yep, for me it's just the gcc environment,so you can try
sudo apt-get install gcc
That worked for me in ubuntu :)
make sure that xcode is installed.
xcode-select --install
if it is already installed, make sure that you have accepted the TOS.
sudo xcodebuild -license
scroll down to the bottom and type agree.
it should work with above steps.
if you see following issue after doing above 2 steps
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/compass
try following.
sudo su
sudo gem install -n /usr/local/bin compass
On OSX this worked:
if gem install compass fails, try
gem install ffi
in case that also fails, the error seems to be, that the ffi build looks in /usr/bin for gcc-4.2
if you have gcc installed, just create a symlink within /usr/bin by typing
sudo ln -s gcc gcc-4.2
otherwise you may need to first install gcc (google that)
try this out:
download and install ruby dev kit as per your ruby version
http://rubyinstaller.org/downloads/
in case of any issue follow this wiki on github.
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
This is very old thread, but as I struggled a long time trying to work around that same issue I thought it could be helpful for someone else...
What worked in the end for me : uninstall ruby 3.1.x and reinstall it using the rubyinstaller-devkit-2.7.5-1-x64.exe available here : https://rubyinstaller.org/downloads/
Make sure to install the devTools at the end

rbenv and gems that require C extensions

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

Install RMagick on openSUSE 11.3 - gem failed to build its extension

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.

Resources