我在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