mac*_*cy1 10 ruby mysql macos rubygems
我正在尝试在我的Snow Leopord系统Macbook Pro 13上安装do_mysql,但我不断收到此错误:
n216-160:~ myself$ sudo gem1.9 install do_mysql
Password:
Building native extensions. This could take a while...
ERROR: Error installing do_mysql:
ERROR: Failed to build gem native extension.
/opt/local/bin/ruby1.9 extconf.rb
checking for mysql_query() in -lmysqlclient... no
*** 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=/opt/local/bin/ruby1.9
--with-mysql-config
--without-mysql-config
--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-mysqlclientlib
--without-mysqlclientlib
Gem files will remain installed in /opt/local/lib/ruby1.9/gems/1.9.1/gems/do_mysql-0.10.0 for inspection.
Results logged to /opt/local/lib/ruby1.9/gems/1.9.1/gems/do_mysql-0.10.0/ext/do_mysql_ext/gem_make.out
n216-160:~ myself$
Run Code Online (Sandbox Code Playgroud)
我不知道为什么.我还用MySQL 5.4.3测试版重新安装了我的MySQL版本,64位正如其他人所建议但没有骰子.有谁知道什么是错的?
小智 24
您缺少libmysqlclient-dev软件包.在Deb系统上,你可以使用它来安装它
sudo apt-get install libmysqlclient-dev
Run Code Online (Sandbox Code Playgroud)
不确定mac(也许是"sudo port install libmysqlclient-dev"?)
小智 9
我有同样的问题,上面的解决方案没有工作,直到我修复我的$ PATH:PATH ="/ usr/local/bin:/ usr/local/sbin:$ PATH"#如果还没有出现PATH ="$ PATH :/ usr/local/mysql/bin"export PATH = $ PATH
小智 6
sudo env ARCHFLAGS="-arch x86_64" gem install do_mysql -- --with-mysql-dir=/usr/local/mysql/
Run Code Online (Sandbox Code Playgroud)
尝试这个
sudo env ARCHFLAGS="-arch x86_64"
gem install do_mysql --with-mysql-dir=/usr/local/mysql/ --ruby=/opt/local/bin/ruby1.9
你必须指定 mysql 安装的位置,以及 ruby 安装的位置,因为你使用的是 ruby1.9,我假设你的机器上可能也运行着 1.8。