【发布时间】:2015-11-29 14:15:59
【问题描述】:
我使用的是 OS X Yosemite 10.10.2。我不知道我做了什么导致这种情况发生,我正在努力找出问题所在。
基本上我所有的 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'
成功了。
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。
标签: ruby-on-rails ruby gem zsh zshrc