macos 无法安装 do_mysql gem?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1857059/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 06:35:45  来源:igfitidea点击:

Can't install do_mysql gem?

mysqlrubymacosrubygems

提问by maccy1

I'm trying to install the do_mysql on my Snow Leopord system Macbook Pro 13", but I keep getting this error:

我正在尝试在我的 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$ 

I have no idea why. I also reinstalled my verison of MySQL with the MySQL 5.4.3 beta, 64-bit as others suggested but no dice. Does anyone have any idea what is wrong?

我不知道为什么。我还按照其他人的建议,使用 MySQL 5.4.3 测试版(64 位)重新安装了我的 MySQL 版本,但没有骰子。有谁知道出了什么问题?

回答by Raghu

You are missing libmysqlclient-dev package. On Deb systems you could install this using

您缺少 libmysqlclient-dev 包。在 Deb 系统上,您可以使用

sudo apt-get install libmysqlclient-dev

Not sure about mac (maybe "sudo port install libmysqlclient-dev" ?)

不确定 mac(也许是“sudo port install libmysqlclient-dev”?)

回答by David

I had the same issue, and the above solution did not work until I fixed my $PATH: PATH="/usr/local/bin:/usr/local/sbin:$PATH" # if not already present PATH="$PATH:/usr/local/mysql/bin" export PATH=$PATH

我遇到了同样的问题,直到我修复了 $PATH: PATH="/usr/local/bin:/usr/local/sbin:$PATH" # if not already present PATH="$PATH :/usr/local/mysql/bin" 导出 PATH=$PATH

回答by fannar

sudo env ARCHFLAGS="-arch x86_64" gem install do_mysql -- --with-mysql-dir=/usr/local/mysql/

回答by fannar

You require both Mysql to be installed and the path to the Mysql binary added to your profile.

您需要安装 Mysql 并将 Mysql 二进制文件的路径添加到您的配置文件中。

1) Download and install the MySQL binary (make sure you pick the correct CPU architecture).

1) 下载并安装 MySQL 二进制文件(确保选择正确的 CPU 架构)。

2) Edit the file ~/.profileand add :/usr/local/mysql/binto your path.

2) 编辑文件~/.profile并添加:/usr/local/mysql/bin到您的路径中。

3) In a new terminal window do sudo gem install do_mysql

3)在一个新的终端窗口做 sudo gem install do_mysql

Hope that helps!

希望有帮助!

Cheers,

干杯,

Marcus

马库斯

回答by Shiv

Try this

试试这个

sudo env ARCHFLAGS="-arch x86_64"
gem install do_mysql --with-mysql-dir=/usr/local/mysql/ --ruby=/opt/local/bin/ruby1.9

sudo env ARCHFLAGS="-arch x86_64"
gem install do_mysql --with-mysql-dir=/usr/local/mysql/ --ruby=/opt/local/bin/ruby1.9

You have to specify the location of your mysql installation, as well as the location of the ruby installation, since you are using ruby1.9, I am assuming you may have 1.8 running as well on your machine.

您必须指定 mysql 安装的位置,以及 ruby​​ 安装的位置,因为您使用的是 ruby​​1.9,我假设您的机器上也可能运行 1.8。