Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gem install mysql2 v '0.3.11' not working on Yosemite

When doing bundle install or direct gem install of mysql2 version 0.3.11 on ruby version 1.9.3 (rvm) I'm getting the error below. But when I install the latest version 0.3.16 it works. I also included my gcc version for reference.

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/ginocarlocortez/.rvm/rubies/ruby-1.9.3-p547/bin/ruby extconf.rb 
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile

make  clean

make
compiling client.c
couldn't understand kern.osversion `14.0.0'
compiling mysql2_ext.c
couldn't understand kern.osversion `14.0.0'
compiling result.c
couldn't understand kern.osversion `14.0.0'
linking shared-object mysql2/mysql2.bundle
couldn't understand kern.osversion `14.0.0'
ld: -rpath can only be used when targeting Mac OS X 10.5 or later
collect2: ld returned 1 exit status
make: *** [mysql2.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/ginocarlocortez/.rvm/gems/ruby-1.9.3-p547@willh/gems/mysql2-0.3.11 for inspection.
Results logged to /Users/ginocarlocortez/.rvm/gems/ruby-1.9.3-p547@willh/extensions/x86_64-darwin-14/1.9.1/mysql2-0.3.11/gem_make.out
An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling.

gcc version

$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
like image 241
steamboy Avatar asked Oct 20 '14 00:10

steamboy


1 Answers

Error happens because of this:

ld: -rpath can only be used when targeting Mac OS X 10.5 or later

Try to specify OSX deployment target like this:

export MACOSX_DEPLOYMENT_TARGET=10.5
like image 104
maikonas Avatar answered Sep 19 '22 16:09

maikonas