gad*_*eel 14 ruby mysql macos gem ruby-on-rails
我尝试了几个想法......它们都没有用......我只是想安装mysql2作为宝石.我的mysql正在运行,但每次我的系统说,mysql.h都丢失了......有人有想法吗?现在非常令人沮丧......
我正在使用osx 10.8.3,ruby 1.9.3,rails 3.2.13和home-brew.
gem install mysql2 -v '0.3.11'
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/Users/gadreel/.rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... 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
--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/gadreel/.rvm/rubies/ruby-1.9.3-p429/bin/ruby
--with-mysql-config
--without-mysql-config
file `which mysql`
/usr/local/mysql/bin/mysql: Mach-O 64-bit executable x86_64
Run Code Online (Sandbox Code Playgroud)
Vla*_*ich 46
在Mountain Lion Rails安装(使用Homebrew和RVM)中对我-Wno-null-conversion -Wno-unused-private-field有用的是编辑/usr/local/Cellar/mysql/5.XX.XX/bin/mysql_config并从cxflags和cxflags选项中删除如下:
之前:
cflags="-I$pkgincludedir -Wall -Wno-null-conversion -Wno-unused-private-field -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space!
cxxflags="-I$pkgincludedir -Wall -Wno-null-conversion -Wno-unused-private-field -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space!
Run Code Online (Sandbox Code Playgroud)
后:
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)
之后,宝石安装mysql2继续没有hickups
注意:这可能是由于5.6.10之后引入mysql_config的更改:http://bugs.mysql.com/bug.php?id = 69645
使用像Homebrew或MacPorts这样的包管理器可以非常简单地解决这个问题。直接来自 Oracle 的 MySQL 二进制发行版和与 OS X 本身捆绑的二进制发行版没有开发标头,开发标头就是其中mysql.h之一。
Homebrew 会这样修复它:
brew install mysql
Run Code Online (Sandbox Code Playgroud)
MacPorts 非常相似:
sudo port install mysql
Run Code Online (Sandbox Code Playgroud)
这两个都安装库、命令行客户端和库的相关开发标头。启用服务器是可选的。
作为替代方案,您可以直接从 Apple获取源代码并以您认为合适的方式进行安装。
一般来说,自制程序是最好的方法。
| 归档时间: |
|
| 查看次数: |
11789 次 |
| 最近记录: |