Trouble installing ruby-oci8 gem - ruby-on-rails

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.

Related

Error Installing Rails 5.2.3 on Ubuntu 18.04

I'm trying to install Rails 5.2.3 on Ubuntu 18.04 PC using Ruby version -2.5.5 and during the installation I'm facing this error.
$ gem install rails -v 5.2.3
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /home/amani/.rvm/gems/ruby-2.5.5/gems/nokogiri-1.10.4/ext/nokogiri
/home/amani/.rvm/rubies/ruby-2.5.5/bin/ruby -I /home/amani/.rvm/rubies/ruby-2.5.5/lib/ruby/site_ruby/2.5.0 -r ./siteconf20190831-23754-eu6kq8.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=/home/amani/.rvm/rubies/ruby-2.5.5/bin/$(RUBY_BASE_NAME)
--help
--clean
/home/amani/.rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /home/amani/.rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/mkmf.rb:574:in `block in try_compile'
from /home/amani/.rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/mkmf.rb:521:in `with_werror'
from /home/amani/.rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/mkmf.rb:574:in `try_compile'
from extconf.rb:138:in `nokogiri_try_compile'
from extconf.rb:162:in `block in add_cflags'
from /home/amani/.rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/mkmf.rb:632:in `with_cflags'
from extconf.rb:161:in `add_cflags'
from extconf.rb:416:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/amani/.rvm/gems/ruby-2.5.5/extensions/x86_64-linux/2.5.0/nokogiri-1.10.4/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/amani/.rvm/gems/ruby-2.5.5/gems/nokogiri-1.10.4 for inspection.
Results logged to /home/amani/.rvm/gems/ruby-2.5.5/extensions/x86_64-linux/2.5.0/nokogiri-1.10.4/gem_make.out
These are the error messages on terminal.
I just looked at your terminal log and realized that you are using RVM (Ruby version manager) as your ruby manager. The catch here is that RVM seems to be heavyweight as it manages not just your ruby version but also your ruby gems. A better option for you should be to use rbenv (Ruby environment), which manages just your ruby version and Bundler which manages ruby gems.
This way you will rarely run into conflicts where RVM and Bundler will be doing the same thing (managing your ruby gems), since rails installation depends on Bundler.
Here's a simple command built-in that will remove RVM and its related directories from your system:
rvm implode
In order to remove the final trace of rvm, you need to remove the rvm gem, too:
gem uninstall rvm
If you've made modifications to your PATH you might want to pull those, too. Check your .bashrc, .profile and .bash_profile files, among other things.
You may also have an /etc/rvmrc file, or one in your home directory ~/.rvmrc that may need to be removed as well.
When you are done with the removal of RVM and all of its files and directories, follow this guide How To Install Ruby on Rails with rbenv on Ubuntu 18.04 to install a fresh copy of Ruby on Rails with rbenv on your Ubuntu machine.
If you still run into any issue relating to bundler while using rbenv, simply follow the instruction below:
You need to simply install an update for RubyGems Package Manager locally. To do this, run
gem update --system
If you don't have bundler version 2 installed locally, then run
gem install bundler
And then finally run
bundler update --bundler
That's all.
I hope this helps.

Cannot compile OCI error while installing ruby-oci8 on linux

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

how to install ruby-oci8 on centOS?

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.

gem install rails ERROR: While executing gem ... (Errno::EACCES)

I somehow messed my $PATH up. (changed it) and my ruby and rails gems weren't working. What I did in efforts to fix this was to reinstall RVM. Now my ruby works fine in the Terminal.
On running gem install railsI get greeted with this:
Permission denied - /Users/emKaro/.rvm/gems/ruby-2.0.0-p247/gems/atomic-1.1.13/test/test_atomic.rb
When I try to install rails through sudo gem install rails, I get this error:
ERROR: While executing gem ... (Errno::EACCES)
I have XCode installed with Command-Line tools installed as well. Even went ahead to install GCC but get the very same error when I try to install rails.
This is the full error message
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /Users/emKaro/.rvm/gems/ruby-2.0.0-p247/gems/atomic-1.1.13/test/test_atomic.rb
emmanuels-imac:~ siaW$ sudo gem install rails
Password:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
*** 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/emKaro/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
--with-atomic_reference-dir
--without-atomic_reference-dir
--with-atomic_reference-include
--without-atomic_reference-include=${atomic_reference-dir}/include
--with-atomic_reference-lib
--without-atomic_reference-lib=${atomic_reference-dir}/
/Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/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 /Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:519:in `try_link0'
from /Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:817:in `try_run'
from extconf.rb:24:in `<main>'
Gem files will remain installed in /Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.13 for inspection.
Results logged to /Users/emKaro/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.13/ext/gem_make.out
I am the admin of my computer and running Mac OS 10.8.3. I'd appreciate some help with the rails install.
EDIT:
Thanks #Christoph
The only code that helped was to actually remove the RVM folder with
sudo rm -rf ~/.rvm/
I tried only to uninstal and it didn't work. So removing the folder and then reinstalling RVM does the job.
Like Dave pointed out up there, there should be no need to sudo any Gem installation. You could try to reset the permissions on your RVM directory:
sudo chown -R emKaro: ~/.rvm/
and try your Gem instllation again. If that doesn't work out, you should consider removing your RVM installation and start over:
sudo rm -rf ~/.rvm/ # remove your RVM directory
There should really be no need for using sudo in any of this.
I'm running 10.8.5 OSX and was trying to install Rails with Ruby 1.9.3-p448 - so I don't know if it's exactly the same problem, but by looking in the mkmf.rb code where it failed, I found that the problem was that the basic CC command wasn't running. For some reason, it needed to search for the folders in /usr/local, and for some reason, /usr/local was set to 740 permissions on my install (which I had gotten from someone else so not sure what he had done prior to my getting the machine.)
So after I did chmod +x /usr/local, everything worked ok.
I had this problem in Ubuntu, but it was because I didn't installed the rvm with "Run command as a login shell", after the installation of rvm they told about this, and the link to look for the information to enable in ubuntu.
Here's the link:
https://rvm.io/integration/gnome-terminal
For RVM to work properly, you have to check the 'Run command as login shell' checkbox on the Title and Command tab of gnome-terminal's Edit ▸ Profile Preferences menu dialog, in case the menu is missing right click the terminal app and navigate Profiles ▸ Profile Preferences.

How to install mysql gem on Mac os 10.6?

i just installed MAMP on this iMac and the rubygems but when i run:
sudo gem install mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config
gives me
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
ERROR: could not find gem — locally or in a repository
ERROR: could not find gem –with-mysql-config=/usr/local/mysql/bin/mysql_config locally or in a repository
how can i install this gem ?
I found this and worked out perfectly:
you can go to http://www.tmtm.org/en/ruby/mysql/ to download the tar
file, and run the command below
# ruby ./install.rb
to install the mysql.rb
Use the following it worked with me
brew install mysql
Do you have the Xcode developer tools installed on Mac OS X? If not, I'd start there.
You can download them here: http://developer.apple.com/technologies/xcode.html
Once you've installed that, try again.
i'm still getting this
$ sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.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/1.8/usr/bin/ruby
--with-mysql-config
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
You need the mysql development libs to compile it. If you were on linux you could use "yum install mysql-devel". Not sure about how to get them installed on a mac, but try downloading the connector libraries from here:
MySql Connector Downloads
You may have to pass in a --with-mysql-libs option to point to the directory when the C libraries are unpacked to. Hope this points you in the right direction.
Or you can just put the libraries in the default directory:
/usr/lib64/mysql
Download mysql-dev from mysql.com

Resources