安装Mysql2 gem- 10.6服务器时出现错误[英] Error installing Mysql2 gem- 10.6 Server

本文是小编为大家收集整理的关于安装Mysql2 gem- 10.6服务器时出现错误的处理方法,想解了安装Mysql2 gem- 10.6服务器时出现错误的问题怎么解决?安装Mysql2 gem- 10.6服务器时出现错误问题的解决办法?那么可以参考本文帮助大家快速定位并解决问题。

问题描述

我正在尝试在 10.6 服务器上安装 mysql2 gem,但收到一条我没有看到的错误消息:

EBuilding native extensions.  This could take a while...
ERROR:  Error installing mysql2:
    ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... no
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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
    --with-mysql-config
    --without-mysql-config


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/ext/mysql2/gem_make.out

我已经尝试了几件事,指定内置 MySQL 的存储位置 sudo gem install mysql2 -- --with-mysql-dir=/var/mysql 并将内置 mysql 替换为来自 mysql.com 的预构建 64 位安装程序

有什么想法吗?

推荐答案

想通了:

sudo env ARCHFLAGS="-arch x86_64" gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

本文地址:https://www.itbaoku.cn/post/786751.html