我在OS X Yosemite 10.10.2上。我不知道我爲此做了什麼,我正在努力弄清楚問題所在。軟件包安裝失敗。無法安裝mysql2寶石
基本上我的大多數rails命令都失敗了。我正在使用zsh。
當我嘗試運行bundle install
,我得到
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/name/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150903-44386-11qoex1.rb extconf.rb --with-mysql-config=usr/local/bin/mysql_config/
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
-----
Cannot find mysql_config at usr/local/bin/mysql_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
--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/name/.rvm/rubies/ruby-2.2.1/bin/$(RUBY_BASE_NAME)
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysql-config
extconf failed, exit code 1
Gem files will remain installed in /Users/name/workspace/application/vendor/bundle/ruby/2.2.0/gems/mysql2-0.3.20 for inspection.
Results logged to /Users/name/workspace/application/vendor/bundle/ruby/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/mysql2-0.3.20/gem_make.out
An error occurred while installing mysql2 (0.3.20), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.20'` succeeds before bundling.
我做到了,
gem install mysql2 -v '0.3.20'
它suceeded。
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.20
Parsing documentation for mysql2-0.3.20
Done installing documentation for mysql2 after 0 seconds
1 gem installed
現在,當我做了bundle install
,它再次給我同樣的錯誤。
所以,我想which mysql2
,它說:mysql2 not found
每此評論https://stackoverflow.com/a/16132663/5245746,我檢查了我的CFLAGS,這對我來說很好。這裏是我的,
cflags="-I$pkgincludedir -O3 -g -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF " #note: end space!
我檢查了mkmf.log文件。這裏的日誌http://pastebin.com/aZ8ySXd8
我已經花了半天的時間,這真是令人沮喪。我倒了這不是與mysql2的問題,有一個更大的問題背後。任何人都可以告訴我一些方向?你們知道爲什麼會發生這種情況嗎?
在此先感謝
您使用的是什麼版本的RubyGems?轉到您的控制檯並運行'gem -v'。 – MarsAtomic