在 Mac 上使用 Rails3 安装 mysql2 gem 时出现非常奇怪的错误

发布于 2024-10-20 20:20:39 字数 1157 浏览 2 评论 0原文

我收到此错误:

构建本机扩展。这可能需要一段时间......

ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.h... 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.

我已经尝试了一切 这里 但我仍然收到错误。由于某种原因,当我运行 locate mysql_config 时,这是我得到的结果:

/Applications/MAMP/Library/bin/mysql_config /Applications/MAMP/Library/share/man/man1/mysql_config.1

我尝试运行 sudo gem install mysql2 -- –with-mysql config=/path/you/identified/above/ mysql_config 使用每个路径两次,但我仍然收到上面的错误。我下载了新版本的 MySql 并且有 Xcode,但仍然收到这些错误。我做错了什么?

I get this error:

Building native extensions. This could take a while...

ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.h... 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.

I've tried everything here but I still get the error. For some reason when I run locate mysql_config this is the result I get:

/Applications/MAMP/Library/bin/mysql_config
/Applications/MAMP/Library/share/man/man1/mysql_config.1

I tried running sudo gem install mysql2 -- –with-mysql config=/path/you/identified/above/mysql_config twice using each path but I still get the error from above. I downloaded a fresh version of MySql and I have Xcode, but I still get these errors. What am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

海未深 2024-10-27 20:20:39

MAMP 安装是您唯一的 mysql 安装吗?如果你是从 mysql 包安装的,那么我认为 mysql_config 将安装在 /usr/local/bin/mysql_config 中,所以你可能想尝试:

sudo gem install mysql2 -- –with-mysql-config==/usr /local/bin/mysql_config

仅供参考,/Applications/MAMP/Library/share/man/man1/mysql_config.1 路径显然是错误的。这指向 mysql_config 的 man 文件,而不是实际的可执行文件。

只是为了确定,你确实尝试过这个吗? (完全如所写)

sudo gem install mysql2 -- –with-mysql-config=/Applications/MAMP/Library/bin/mysql_config

另外,我不确定用 MAMP 打包的 mysql 是否有您需要的头文件。你可能最好从 http://dev.mysql.com/downloads/mysql/ 然后尝试安装你的 gem。在这种情况下,我认为它会起作用。

Is the MAMP install the only install of mysql you have? If you've installed it from the mysql package then I think mysql_config will be installed in /usr/local/bin/mysql_config, so you might want to try:

sudo gem install mysql2 -- –with-mysql-config==/usr/local/bin/mysql_config

FYI, the /Applications/MAMP/Library/share/man/man1/mysql_config.1 path is clearly wrong. That's pointing to the man file for mysql_config not the actual executable.

Just to be certain, you did try this right? (exactly as written)

sudo gem install mysql2 -- –with-mysql-config=/Applications/MAMP/Library/bin/mysql_config

Also, I'm not sure that mysql packaged with MAMP has the header files you need. You might be best to install mysql from http://dev.mysql.com/downloads/mysql/ and then try to install your gem. In this case I think it will just work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文