I am install Oracle Instant Client: Basic, SDK and SQL*Plus packages v 10.2.0.5.
mkdir /opt
mkdir /opt/oracle
cd /opt/oracle
unzip path/to/instantclient-basic-OS-VERSION.zip
unzip path/to/instantclient-sdk-OS-VERSION.zip
unzip path/to/instantclient-sqlplus-OS-VERSION.zip
after that i set vim ~/.oracle_client
export ORACLE_HOME=/opt/oracle/
export TNS_ADMIN=/admin/network/
export LD_LIBRARY_PATH="/opt/oracle/instantclient_10_2/"
echo "source ~/.oracle_client" >> ~/.bash_profile
source ~/.bash_profile
create tnsnames.ora and test connection sqlplus opsvod/agatb137#FESTEST
SQL*Plus: Release 10.2.0.5.0 - Production on Thu Oct 31 14:55:17 2013
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
But whan i try to install gem install ruby-oci8 -v '2.1.5' i have error:
Building native extensions. This could take a while...
ERROR: Error installing ruby-oci8:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for load library path...
LD_LIBRARY_PATH...
checking /opt/oracle/instantclient_10_2/... skip: /opt/oracle/instantclient_10_2/libclntsh.so.10.1 is for i386 cpu.
checking ld.so.conf... skip: /opt/oracle/instantclient_10_2/libclntsh.so.10.1 is for i386 cpu.
no
checking for cc... ok
checking for gcc... yes
checking for LP64... yes
checking for sys/types.h... yes
checking for ruby header... ok
Get the version of Oracle from SQL*Plus... *** 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/bin/ruby
--with-instant-client
--without-instant-client
/usr/local/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:760:in `get_version': RuntimeError (RuntimeError)
from /usr/local/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:709:in `initialize'
from /usr/local/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:320:in `new'
from /usr/local/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:320:in `get'
from extconf.rb:18:in `<main>'
---------------------------------------------------
Error Message:
cannot get Oracle version from sqlplus
Backtrace:
/usr/local/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:760:in `get_version'
/usr/local/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:709:in `initialize'
/usr/local/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:320:in `new'
/usr/local/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:320:in `get'
extconf.rb:18:in `<main>'
---------------------------------------------------
See:
* http://ruby-oci8.rubyforge.org/en/HowToInstall.html
* http://ruby-oci8.rubyforge.org/en/ReportInstallProblem.html
Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5/ext/oci8/gem_make.out
How to resols this isue?
We don't install the gem for our Oracle deployments, but build from source:
Make sure that ORACLE_HOME is pointing to the oracle full client or oracle instaclient
Make sure that inside the $ORACLE_HOME/lib libclntsh.so exists as a symbolic link to libclntsh.so.11.1
Change into the ruby-oci8-2.1.x directory and run
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install
Install activerecord-oracle_enhanced-adapter ONLY WHEN the ruby-oci8 adapter is installed.
skip: /opt/oracle/instantclient_10_2/libclntsh.so.10.1 is for i386 cpu.
The instant client is 32-bit.
checking for LP64... yes
The ruby is 64-bit.
The bitness of instant client must be same with that of ruby.
You need 64-bit instant client to use with the 64-bit ruby.
If you are by any chance trying to install this gem on Fedora 27 and are faced with a very similar error message, try to do:
dnf install rpm-build libnsl*
This fixed my errors (found it here).
EDIT: As of Fedora 28, libnsl* is no longer included as default dependency. This will make the ruby-oci8 gem fail for less than obvious reasons. The install directive above has been updated with this finding.
Related
I got cannot compile OCI error while installing ruby-oci8 on linux
the command i used is gem install ruby-oci8 -v '2.2.7'
i'm using oracle full client
[root#advlints01 redf]# gem install 'ruby-oci8' -v '2.2.7'
Building native extensions. This could take a while...
ERROR: Error installing ruby-oci8:
ERROR: Failed to build gem native extension.
current directory: /usr/local/rvm/gems/ruby-2.5.1#real_estate_fund/gems/ruby-oci8-2.2.7/ext/oci8
/usr/local/rvm/rubies/ruby-2.5.1/bin/ruby -I /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0 -r ./siteconf20190916-29697-1loq660.rb extconf.rb
checking for load library path...
LD_LIBRARY_PATH...
checking /oracle/app/oracle/product/12.2.0/client_1/lib... skip: /oracle/app/oracle/product/12.2.0/client_1/lib/libclntsh.so.12.1 is for i386 cpu.
checking ld.so.conf... no
checking for cc... ok
checking for gcc... yes
checking for LP64... yes
checking for sys/types.h... yes
checking for ruby header... ok
Get the version of Oracle from SQL*Plus... 1220
try -I/oracle/app/oracle/product/12.2.0/client_1/rdbms/public
checking for oci.h... yes
checking for OCIEnvCreate() in oci.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=/usr/local/rvm/rubies/ruby-2.5.1/bin/$(RUBY_BASE_NAME)
--with-instant-client
--without-instant-client
/usr/local/rvm/gems/ruby-2.5.1#real_estate_fund/gems/ruby-oci8-2.2.7/ext/oci8/oraconf.rb:755:in `initialize': RuntimeError (RuntimeError)
from /usr/local/rvm/gems/ruby-2.5.1#real_estate_fund/gems/ruby-oci8-2.2.7/ext/oci8/oraconf.rb:269:in `new'
from /usr/local/rvm/gems/ruby-2.5.1#real_estate_fund/gems/ruby-oci8-2.2.7/ext/oci8/oraconf.rb:269:in `get'
from extconf.rb:22:in `<main>'
---------------------------------------------------
Error Message:
cannot compile OCI
Backtrace:
/usr/local/rvm/gems/ruby-2.5.1#real_estate_fund/gems/ruby-oci8-2.2.7/ext/oci8/oraconf.rb:755:in `initialize'
/usr/local/rvm/gems/ruby-2.5.1#real_estate_fund/gems/ruby-oci8-2.2.7/ext/oci8/oraconf.rb:269:in `new'
/usr/local/rvm/gems/ruby-2.5.1#real_estate_fund/gems/ruby-oci8-2.2.7/ext/oci8/oraconf.rb:269:in `get'
extconf.rb:22:in `<main>'
---------------------------------------------------
See:
* http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/install-full-client.md for Oracle full client
* http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/install-instant-client.md for Oracle instant client
* http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/install-on-osx.md for OS X
* http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/report-installation-issue.md to report an issue.
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/rvm/gems/ruby-2.5.1#real_estate_fund/extensions/x86_64-linux/2.5.0/ruby-oci8-2.2.7/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.5.1#real_estate_fund/gems/ruby-oci8-2.2.7 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.5.1#real_estate_fund/extensions/x86_64-linux/2.5.0/ruby-oci8-2.2.7/gem_make.out
[root#advlints01 redf]#
Looks like I found the cause of the issue. Im running arch linux (manjaro 18 xfce), there is a specific to arch linux oracle installation process using makepkg and pacman, so, everything goes ok with oracle-xe package and after installing it I can run sqlplus and connect to xe database which is a database created by default (usually), but I was not able to compile ruby-oci8 gem (2.2.8 v), after some researches I've found out that the problem were missing links in $ORACLE_HOME/lib folder:
libclntsh.so -> libclntsh.so.11.1 and
libocci.so -> libocci.so.11.1
11.1 is a lib version (it depends on oracle version, eg. 11.2, 19.5 and etc.)
After creating these links via ln -s under oracle user, ruby-oci8 can be compiled.
Note:
I'm using a full oracle client instead of instant one and all the guides do not say a word about linking these .so files but all the guides related to instant client do say it =D, here is a guide from developer of ruby-oci8 - instant client installation
I'm trying to install a gem ruby-oci8 on the rails.
I get the following error,
$ gem install ruby-oci8
Building native extensions. This could take a while...
ERROR: Error installing ruby-oci8:
ERROR: Failed to build gem native extension.
current directory: /home/solovievga/.rvm/gems/ruby-2.4.2/gems/ruby-oci8-2.2.5.1/ext/oci8
/home/solovievga/.rvm/rubies/ruby-2.4.2/bin/ruby -r ./siteconf20180213-21757-1hli0rl.rb extconf.rb
checking for load library path...
LD_LIBRARY_PATH is not set.
checking ld.so.conf... no
checking for cc... ok
checking for gcc... yes
checking for LP64... yes
checking for sys/types.h... yes
checking for ruby header... ok
*** 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/solovievga/.rvm/rubies/ruby-2.4.2/bin/$(RUBY_BASE_NAME)
--with-instant-client
--without-instant-client
/home/solovievga/.rvm/gems/ruby-2.4.2/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:909:in `get_home': RuntimeError (RuntimeError)
from /home/solovievga/.rvm/gems/ruby-2.4.2/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:728:in `initialize'
from /home/solovievga/.rvm/gems/ruby-2.4.2/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:269:in `new'
from /home/solovievga/.rvm/gems/ruby-2.4.2/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:269:in `get'
from extconf.rb:22:in `<main>'
---------------------------------------------------
Error Message:
Set the environment variable ORACLE_HOME if Oracle Full Client.
Append the path of Oracle client libraries to LD_LIBRARY_PATH if Oracle Instant Client.
Backtrace:
/home/solovievga/.rvm/gems/ruby-2.4.2/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:909:in `get_home'
/home/solovievga/.rvm/gems/ruby-2.4.2/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:728:in `initialize'
/home/solovievga/.rvm/gems/ruby-2.4.2/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:269:in `new'
/home/solovievga/.rvm/gems/ruby-2.4.2/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:269:in `get'
extconf.rb:22:in `<main>'
---------------------------------------------------
See:
* http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/install-full-client.md for Oracle full client
* http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/install-instant-client.md for Oracle instant client
* http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/install-on-osx.md for OS X
* http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/report-installation-issue.md to report an issue.
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/solovievga/.rvm/gems/ruby-2.4.2/extensions/x86_64-linux/2.4.0/ruby-oci8-2.2.5.1/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/solovievga/.rvm/gems/ruby-2.4.2/gems/ruby-oci8-2.2.5.1 for inspection.
Results logged to /home/solovievga/.rvm/gems/ruby-2.4.2/extensions/x86_64-linux/2.4.0/ruby-oci8-2.2.5.1/gem_make.out
I wonder how I can install the ruby-oci8 package?
You have to set LD_LIBRARY_PATH to install ruby-oci8 gem. Here I am assuming you are using linux os. Try this on your terminal.
$ LD_LIBRARY_PATH=$ORACLE_HOME/lib
$ export LD_LIBRARY_PATH
$ gem install ruby-oci8
Edit:
If you uses mswin32 ruby, use the following command instead.
gem install --platform x86-mingw32 ruby-oci8
or
gem install --platform x64-mingw32 ruby-oci8
Let me know If you have any query or question.
Happy Coding
These steps take you through the instant client installation process as well, just to provide some context. Download the instant and SDK zip files here:
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
Unzip both files in the following directory as root.
/opt/oracle
Enter the instantclient_12_2 directory following the unzip and create a symlink for the libclntsh.so file:
ln -s libclntsh.so.12.1 libclntsh.so
Now, depending on your OS, you'll need to update your LD_LIBRARY_PATH location. In Ubuntu, do the following:
sudo nano /etc/ld.so.conf.d/moreLibs.conf
And enter the following in the file and save
/opt/oracle/instantclient_12_2
Now run the following command:
sudo ldconfig
And rerun your gem install
gem install ruby-oci8
This solution worked for me
Before executing bundle install, Run below code on the console or add it to bash and source.
Export OCI_DIR=/opt/oracle/instantclient_12_2
Here /opt/oracle/instantclient_12_2 is path to instantclient on my mac machine.
You need to download instantclient from
https://www.oracle.com/database/technologies/instant-client/downloads.html
Unzip the download into /opt/oracle directory and export OCI_DIR environment variable.
I have a similar problem installing the ruby-oci8 gem. In my case, there is already an app that uses it. When I deployed another app using the same gem, during bundle install, this error occurred. It asked for the LD_LIBRARY_PATH environment variable. Apparently, the installer of the old app did not set the variable to persist.
I thought that there should be an oracle library somewhere in the server so I searched for it. It was not in /opt but in /usr/lib. I set the variable to /usr/lib/oracle/11.1/client64/lib then the gem was installed smoothly.
Here is the logs: http://pastebin.com/CAgur9xd
Installing nio4r 1.2.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby2.2.0/bin/ruby.exe -r ./siteconf20160720-8272-c88sgk.rb extconf.rb --with-cflags=-std=c99
checking for unistd.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=C:/RailsInstaller/Ruby2.2.0/bin/$(RUBY_BASE_NAME)
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:587:in `try_cpp'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:1060:in `block in have_header'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:347:in `postpone'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for'
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:1059:in `have_header'
from extconf.rb:3:in `<main>'
extconf failed, exit code 1
when installing bundle it returns(starts at line 117 in the logs ):
Installing nio4r 1.2.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
So the bundle can't be installed. It returns at the end :
An error occurred while installing nio4r (1.2.1), and Bundler cannot continue.
Make sure that `gem install nio4r -v '1.2.1'` succeeds before bundling.
Note :I have tried the solutions in other questions, but it is still the same.
If it is possible to install "nio4r" manually please tell me how .
I am facing the same issue while I was trying to upgrade my Rails to V5.0.0, I follow this instruction and it works perfectly. Read the section "Install the Ruby DevKit" here >> http://jekyll-windows.juthilo.com/1-ruby-and-devkit/
Solution for Fedora 64bit
sudo dnf install redhat-rpm-config
I had a similar problem and running this command solved my issue.
bundle config build.nio4r --with-cflags="-std=c99"
Now you can successfully run bundle install afterwards.
I came across this problem as i was setting up rails too. (looking for an alternative to php).
I realized that i had installed x86 ruby with x64 Devkit, so i first downloaded x64 ruby which i installed and uninstalled the x86 version. I made sure my path variables were well set.
Then i installed devkit using the instructions on this page http://rubyonwindowsguides.github.io/book/ch02-04.html
Finally i installed rails and it worked fine without the errors this time
Hope this helps
My son fixed this problem for me. The problem was that I installed first, Ruby and then the Rails installer. So I had to uninstall Ruby and reinstall with the Rails installer only.
Had this same issue on Ubuntu 16.04.
What I did to fix this :
Remove Gemfile.lock : sudo rm Gemfile.lock
Installed Ruby-Dev:
sudo apt-add-repository ppa:brightbox/ruby-ng
sudo apt-get update
sudo apt-get install ruby2.4-dev
and the important step : REBOOT!
this may be related: GCC compilation error when installing Nokogiri
I found a error. i had a 2 gcc versions installed on my system and I just run brew unlink gcc and that solved the problem.
this was my case too. benw unlink gcc worked
Remove the Gemfile.lock and run bundle install command
To quote from your log output:
The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
On windows, you need to install the DevKit in order to be able to compile gems.
If you use Windows and installed ruby with RubyInstaller with version more or equal to 2.4, than you should not install DevKit from RubyInstaller website and only use 'msys64' which is installed after Ruby with RubyInstaller (make sure you type number 3 to install both msys and mingw). Delete devkit directory and its path from PATH environment variable, so when rubygems will try to install nio4r and call C compilers, it will call msys ones.
Read here https://rubyinstaller.org/2017/05/25/rubyinstaller-2.4.1-1-released.html for more info about MSYS2 and DevKit in RubyInstaller
I was using Ruby 1.9.2 for my RoR 3.2.11 project
All worked fine until I had to upgrade to Ruby 1.9.3 because a gem required it.
By the same occasion I tried to make good use of RVM.
Installed ruby 1.9.3
rvm install 1.9.3 -C --with-openssl-dir=$HOME/.rvm/usr
Created .rvmrc
cd ./my_project/
rvm --create --rvmrc 1.9.3#project
Cleaned up my global gemset
rvm gemset empty
cd into my project and run installed gems
bundle
Error log
Installing rmagick (2.13.2)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/joel/.rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for /opt/local/bin/gcc-apple-4.2... yes
checking for Magick-config... yes
Warning: Found more than one ImageMagick installation. This could cause problems at runtime.
/usr/local/ImageMagick/bin/Magick-config reports version 6.7.3 Q16 is installed in
/usr/local/bin/Magick-config reports version 6.7.1 Q16 is installed in /usr/local/Cellar/imagemagick/6.7.1-1
Using 6.7.3 Q16 from .
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
--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/joel/.rvm/rubies/ruby-1.9.3-p429/bin/ruby
/Users/joel/.rvm/rubies/ruby-1.9.3-p429/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/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
from /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
from extconf.rb:194:in `<main>'
Gem files will remain installed in /Users/joel/.rvm/gems/ruby-1.9.3-p429#creativebank/gems/rmagick-2.13.2 for inspection.
Results logged to /Users/joel/.rvm/gems/ruby-1.9.3-p429#my_project/gems/rmagick-2.13.2/ext/RMagick/gem_make.out
An error occurred while installing rmagick (2.13.2), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.2'` succeeds before bundling.
At first sight, it looks like I have 2 installations of ImageMagick and that I could spare one.
So my first question would be how to uninstall clean ImageMagick version 6.7.1 Q16?
and of course if there is something else I could try to solve this issue.
ADDITIONAL INFO about packages installed
I know that MacPort and Brew don't work well together but I always been worried about removing MacPort in its entirety. Could that be the problem?
port list | grep magick
p5-perlmagick #6.8.6-0 perl/p5-perlmagick
p5.8-perlmagick #6.8.6-0 perl/p5-perlmagick
p5.10-perlmagick #6.8.6-0 perl/p5-perlmagick
p5.12-perlmagick #6.8.6-0 perl/p5-perlmagick
p5.14-perlmagick #6.8.6-0 perl/p5-perlmagick
p5.16-perlmagick #6.8.6-0 perl/p5-perlmagick
php-gmagick #1.1.2RC1 php/php-gmagick
php53-gmagick #1.1.2RC1 php/php-gmagick
php54-gmagick #1.1.2RC1 php/php-gmagick
php55-gmagick #1.1.2RC1 php/php-gmagick
php-imagick #3.1.0RC2 php/php-imagick
php53-imagick #3.1.0RC2 php/php-imagick
php54-imagick #3.1.0RC2 php/php-imagick
php55-imagick #3.1.0RC2 php/php-imagick
php-magickwand #1.0.9-2 php/php-magickwand
php53-magickwand #1.0.9-2 php/php-magickwand
php54-magickwand #1.0.9-2 php/php-magickwand
php55-magickwand #1.0.9-2 php/php-magickwand
php5-gmagick #1.1.2RC1 php/php5-gmagick
php5-imagick #3.0.1 php/php5-imagick
php5-magickwand #1.0.9-2 php/php5-magickwand
rb-rmagick #2.13.2 ruby/rb-rmagick
brew list
faac grc jasper lame libtiff libvpx pkg-config wget xvid
ffmpeg imagemagick jpeg libogg libvorbis little-cms theora x264 yasm
UPDATE
Remove MacPorts
sudo port -f uninstall installed
Uninstalled brew ImageMagick and installed it again with brew
Installed XCode latest version
and ran bundle, I do get a different message, C compiler missing ... argh, what should I do next, I am trying installing gcc with brew, but not sure that I am heading the right direction, please help:
Installing rmagick (2.13.2)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/joel/.rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for /opt/local/bin/gcc-apple-4.2... no
No C compiler found in ${ENV['PATH']}. See mkmf.log for details.
*** 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/joel/.rvm/rubies/ruby-1.9.3-p429/bin/ruby
Gem files will remain installed in /Users/joel/.rvm/gems/ruby-1.9.3-p429#creativebank/gems/rmagick-2.13.2 for inspection.
Results logged to /Users/joel/.rvm/gems/ruby-1.9.3-p429#creativebank/gems/rmagick-2.13.2/ext/RMagick/gem_make.out
An error occurred while installing rmagick (2.13.2), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.2'` succeeds before bundling.
GCC 4.2
which gcc => /usr/bin/gcc
gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
echo $PATH
/bin;/usr/bin;/usr/sbin;/sbin;/usr/local/ImageMagick/bin:/usr/local/heroku/bin:/Applications/Postgres.app/Contents/MacOS/bin:/Users/joel/.rvm/gems/ruby-1.9.3-p429#biowatts/bin:/Users/joel/.rvm/gems/ruby-1.9.3-p429#global/bin:/Users/joel/.rvm/rubies/ruby-1.9.3-p429/bin:/Users/joel/.rvm/bin:/usr/bin;usr/local/ImageMagick/bin:/usr/local/heroku/bin:/Applications/Postgres.app/Contents/MacOS/bin:/usr/local/ImageMagick/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/joel
NEW ERROR MESSAGE:
Installing json (1.8.0)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/joel/.rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb
creating Makefile
make
compiling generator.c
make: /opt/local/bin/gcc-apple-4.2: No such file or directory
make: *** [generator.o] Error 1
Gem files will remain installed in /Users/joel/.rvm/gems/ruby-1.9.3-p429#biowatts/gems/json-1.8.0 for inspection.
Results logged to /Users/joel/.rvm/gems/ruby-1.9.3-p429#biowatts/gems/json-1.8.0/ext/json/ext/generator/gem_make.out
It obviously looking for /opt/local/bin/gcc-apple-4.2 which I deleted recklessly while following these instructions to move from Macportd to homebrew :(
NOW INSTALLING MISSING PACKAGES with homebrew
brew install apple-gcc42
brew install libxml2
Couple things:
Remove MacPorts (you may list all things you installed with them and reinstall those with brew)
Remove imagemagick from homebrew
Install imagemagick again with brew
You're getting this error You have to install development tools first. which (I guess) means you need to install XCode command line tools.
Then bundle install should work!
you need to reinstall your ruby after removing the package manager you used to install it, the easiest way is to:
rvm reinstall 1.9.3-p429
In combination to the 2 first answers
brew uninstall imagemagick
and used http://cactuslab.com/imagemagick/
Then in my .bash_profile I set
PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig
C_INCLUDE_PATH=/opt/ImageMagick/include/ImageMagick-6
and finally
bundle
I am facing issues with installing rmagick in mountain lion. I have installed Xcode 4.4 and developer tools. Still facing this issue.
Installing rmagick (2.13.1) with native extensions Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks!
/Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:552:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/mohit/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for clang... 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
--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/mohit/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
/Users/mohit/.rvm/rubies/ruby-1.9.3-p125/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/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
from extconf.rb:193:in `<main>'
Gem files will remain installed in /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:530:in `block in build_extensions'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:505:in `each'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:505:in `build_extensions'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:180:in `install'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/source.rb:90:in `block in install'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/rubygems_integration.rb:82:in `preserve_paths'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/source.rb:89:in `install'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/installer.rb:73:in `block in install_gem_from_spec'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/rubygems_integration.rb:97:in `with_build_args'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/installer.rb:72:in `install_gem_from_spec'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/installer.rb:56:in `block in run'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/installer.rb:55:in `run'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/installer.rb:12:in `install'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/cli.rb:220:in `install'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/vendor/thor/task.rb:22:in `run'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/vendor/thor.rb:263:in `dispatch'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/vendor/thor/base.rb:386:in `start'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/bin/bundle:13:in `<top (required)>'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/bin/bundle:19:in `load'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/bin/bundle:19:in `<main>'
I just updated to Mountain Lion this morning and had rmagick troubles. I had installed ImageMagick through homebrew at some point in the past, so this worked for me after installing the new commandline tools through xcode's preferences window.
brew update
brew uninstall ImageMagick
brew install ImageMagick
gem uninstall rmagick
gem install rmagick
I didn't have to get funky with gcc like some above posts mentioned.
I finally solved this using:
$ cd /usr/local/Cellar/imagemagick/6.8.0-10/lib
$ ln -s libMagick++-Q16.7.dylib libMagick++.dylib
$ ln -s libMagickCore-Q16.7.dylib libMagickCore.dylib
$ ln -s libMagickWand-Q16.7.dylib libMagickWand.dylib
The solution comes from https://coderwall.com/p/wnomjg
I was getting the same
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
did it as it says in https://gist.github.com/1860511
So after updating my mac pro to Mountain Lion, my ruby environment started screaming with different errors one after another.
After 1-2 hours of trial - error and googling, here is how I fixed my ruby on rails environment.
First I got ruby env errors.It was not detecting git commands and Bundler was screaming with
errors when I ran foreman start
Step1 : Update XCode. Get the latest one Xcode 4.6
Mountain Lion does not come with ruby headers installed before hand, so you need to do this manually from XCode. Go to Xcode Preferences/Downloads.
Install Command Line Tools
Step2: Install XQuartz
Logout and Login again. (You might not need this as imagemagick formula has been updated
Step 3: Now your ruby env would start speaking about Imagemagick errors
Do this:
brew update
brew uninstall imagemagick
brew install --fresh imagemagick
gem uninstall rmagick 2.13.2
gem install rmagick
After trying the last one, now it will give you native extension errors like this
Installing rmagick (2.13.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/priyanka/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for /usr/bin/gcc-4.2... no
No C compiler found in ${ENV['PATH']}. See mkmf.log for details.
*** 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=/Users/priyanka/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
Gem files will remain installed in /Users/priyanka/.rvm/gems/ruby-1.9.2-p180/gems/rmagick- 2.13.1 for inspection.
Results logged to /Users/priyanka/.rvm/gems/ruby-1.9.2-p180/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
An error occured while installing rmagick (2.13.1), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.1'` succeeds before bundling.
Step 4:
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
This should fix all issues that Mountain Lion gifted you after the upgrade.
Just run bundle.
Try changing your path such that /usr/local/bin is inserter before /usr/bin. I found this running brew doctor and it allowed me to finish compiling imagemagick.
Here is a quick summary of how I was able to get RMagick work, after several tries. I feel the following is the best way to get it without going to the pains of downloading source tarballs and compilation - leave that to experts
You need to have Xcode and Command Line Tools installed for gcc/g++ etc. Command line tools do not get installed automatically with Xcode, go Preferences and install it
Next install Macport
Install Homebrew as well
Make sure you have X11 server installed - if not install it - sudo
port install -v xorg-server. I use -v option as it is a long install
and you might wonder whether it is doing something or just hanging
Install pkgconfig - sudo brew install pkgconfig
now it is time to install ImageMacick - sudo port install -v
ImageMagick do not use brew to install ImageMagick - it does not install all the dependencies and delegates properly.
once ImageMagick is installed - set DISPLAY env variable - export DISPLAY=:0.0 - better still put it in your .profile
Now test your ImageMagick installation
start X11 server (after X11 server installation it is will there in
your App List)
from command line run - $convert logo: logo.gif; identify logo.gif; display logo.gif - it should pop up a window displaying logo.gif
also run a command from command line - $convert -list configure | grep -i delegates. It should output the following DELEGATES bzlib fftw fontconfig freetype gs jpeg jng lcms2 lzma png tiff x11 xml zlib
Now you should be set to run
sudo gem install RMagick
After RMagick is installed successfully - check where it is installed, go to examples directory within and run some of the programs.
No solutions were working for me, eventually I ran brew doctor and discovered that I needed to link imagemagick with brew link --overwrite imagemagick
I had similar issue but on El Captain. Better explained here.
Fixed after installing xcode command-line tools:
xcode-select --install
You need to install XCode 4.4, command line tools, etc. Check out the full listing here:
http://tektastic.com/2012/07/getting-rmagic-and-friends-to-work-on.html
I found the solution for me was a combination of the steps listed above, at http://tektastic.com/2012/07/getting-rmagic-and-friends-to-work-on.html and here http://robots.thoughtbot.com/post/27985816073/the-hitchhikers-guide-to-riding-a-mountain-lion, although I didn't have to do all the steps listed in either post. But I did need to install the command line tools from XCode, I missed that detail the first few times. I also had to install gcc-4.2 using homebrew, and make a sym link to that installation in my bin directory.
I could be confused about what's going on with the different compilers, but I would be cautious about sym linking /usr/bin/gcc to /usr/bin/gcc-4.2 (which may in turn be a link to gcc-4.2 installed by homebrew). Before I realized I needed to install the command line tools, I had tried making that sym link and then I started seeing other gem build failures. Installing the command line tools fixed those issues - I believe the xcode command line tools made it a sym link to llvm-gcc-4.2.
I just installed rmagick 2.13.2 and this issue is gone.