jay*_*ode 30 bundler mysql2 ruby-on-rails-3
在我的mac OSX 10.6 32位,我可以很容易地安装mysql2 gem,但不能在mini mac 10.6 64bit服务器上安装.
我在麻烦的服务器上安装了MySQL 5.5.11,而在我的家里mac MySQL 5.5.0.m2不知何故当我运行bundle install时,在服务器中它试图在家里安装mysql2.0.3.2 mysql2.0.2.6
请不要告诉我
env ARCHFLAGS =" - arch x86_64"sudo gem install mysql2 --version'= 0.2.6' - --with-mysql-config =/usr/local/mysql/bin/mysql_config
我试过了,不行.
$ PATH中包含的/ usr/local/mysql/bin也没有帮助.
错误代码:
Installing mysql2 (0.3.2) with native extensions /Users/administrator/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/administrator/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing. please check your installation of mysql and try again.
-----
*** 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/administrator/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
--with-mysql-config
--without-mysql-config
Gem files will remain installed in /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.2 for inspection.
Results logged to /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.2/ext/mysql2/gem_make.out
from /Users/administrator/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:511:in `block in build_extensions'
from /Users/administrator/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:486:in `each'
from /Users/administrator/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:486:in `build_extensions'
from /Users/administrator/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:159:in `install'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/source.rb:96:in `install'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/installer.rb:55:in `block in run'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in `block in each'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in `each'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in `each'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/installer.rb:44:in `run'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/installer.rb:8:in `install'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/cli.rb:225:in `install'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/vendor/thor/task.rb:22:in `run'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/vendor/thor/base.rb:389:in `start'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/bin/bundle:13:in `<top (required)>'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/bin/bundle:19:in `load'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/bin/bundle:19:in `<main>'
Run Code Online (Sandbox Code Playgroud)
gui*_*ido 92
我尝试了这里发布的所有解决方案,但并不幸运.我用自制软件重新安装了几次mysql但仍然没有运气.然后我遇到了一个带有解决方案的博客文章.
我编辑了mysql_config文件/usr/local/Cellar/mysql/5.6.12/bin
并删除了W编译器选项
-Wno-null-conversion
以及
-Wno-unused-private-field
cflags和cxxflags.
这解决了gem install mysql2
和的问题bundle install
参考:http://www.randomactsofsentience.com/2013/05/gem-install-mysql2-missing-mysqlh-on-os.html
小智 28
我在redmine repo上做了一个bundle install并得到了同样的错误信息:
缺少mysql.h.请检查你的mysql安装,然后再试一次.
运行Fedora 16 64位,我所做的只是mysql-devel
从发行版rpm 安装(开发包),问题解决了!
所以我认为你可以
yum install mysql-devel
Run Code Online (Sandbox Code Playgroud)
或者apt-get缺少devel包.
对于那些没有使用brew来安装mysql并使用mysql 5.6及更高版本的人:
根据这个答案
你需要编辑mysql_config
我在这里放置的内容:/usr/local/mysql-5.6.12-osx10.7-x86_64/bin
并改变cflags
和cxxflags
:
cflags="-I$pkgincludedir -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space!
cxxflags="-I$pkgincludedir -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space!
Run Code Online (Sandbox Code Playgroud)
在这种操纵之后
$ gem install mysql2 -v '0.3.13'
Run Code Online (Sandbox Code Playgroud)
完美无瑕
归档时间: |
|
查看次数: |
26408 次 |
最近记录: |