2014-10-20 66 views
15

在Rubyy版本1.9.3(rvm)上執行mysql2版本0.3.11的捆綁安裝或直接gem安裝時出現以下錯誤。但是,當我安裝最新版本0.3.16它的作品。我還包括我的gcc版本供參考。gem install mysql2 v'0.3.11'在Yosemite上無法正常工作

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/[email protected]/gems/mysql2-0.3.11 for inspection. 
Results logged to /Users/ginocarlocortez/.rvm/gems/[email protected]/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版本

$ 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 
+0

同樣的錯誤爲http:/ /stackoverflow.com/questions/26417431/error-instal ling-ruby-1-9-2-on-yosemite – Substantial 2014-10-20 00:59:02

+0

對gcc打開bug:https://gcc.gnu.org/bugzilla/show_bug.cgi?id = 61407 – Substantial 2014-10-20 01:07:24

+0

@實質上看起來不一樣錯誤。 – EightyEight 2014-10-21 21:53:48

回答

38

錯誤發生,因爲這樣:

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

試圖指定這樣的OSX部署目標:

export MACOSX_DEPLOYMENT_TARGET=10.5 
+4

考慮添加解釋到您的答案 – arghtype 2014-10-22 06:51:44

+1

簡單地添加導出之前運行'捆綁安裝'解決我的情況。 @steamboy - 你可以標記接受(如果它也解決了你的問題)?謝謝@maikonas! – 2014-11-26 16:18:03

+0

'$ MACOSX_DEPLOYMENT_TARGET = 10.5 bundle install'爲我工作。非常感謝! – 2016-12-06 02:13:59

相關問題