gpt4 book ai didi

MySQL安装: ERROR: Failed to build gem native extension

转载 作者:行者123 更新时间:2023-12-01 17:28:34 25 4
gpt4 key购买 nike

由于某些安装过程中出现问题,我正在尝试将 MySQL 安装到最新版本。我运行命令 gem install mysql 并收到以下信息:

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 extconf.rb:4: warning: Insecure world writable dir /usr/bin in PATH, mode 040777 extconf.rb:4: warning: Insecure world writable dir /usr/bin in PATH, mode 040777 extconf.rb:7: warning: Insecure world writable dir /usr/bin in PATH, mode 040777 mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h

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

我已经搜索并尝试了很多事情,从安装特定版本到尝试重新安装 ruby​​,但没有任何运气。

有什么想法我可能会出错吗?

由于某些安装过程中出现问题,我正在尝试将 MySQL 安装到最新版本。我运行命令 gem install mysql 并收到以下信息:

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 extconf.rb:4: warning: Insecure world writable dir /usr/bin in PATH, mode 040777 extconf.rb:4: warning: Insecure world writable dir /usr/bin in PATH, mode 040777 extconf.rb:7: warning: Insecure world writable dir /usr/bin in PATH, mode 040777 mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h

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

我已经搜索并尝试了很多事情,从安装特定版本到尝试重新安装 ruby​​,但没有任何运气。

有什么想法我可能会出错吗?

编辑:我从 Snow Leopard DVD 安装了 XCode,错误仅稍微更改为以下内容:

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 extconf.rb:4: warning: Insecure world writable dir /usr/bin in PATH, mode 040777 extconf.rb:4: warning: Insecure world writable dir /usr/bin in PATH, mode 040777 extconf.rb:7: warning: Insecure world writable dir /usr/bin in PATH, mode 040777 extconf.rb:17: warning: Insecure world writable dir /usr/bin in PATH, mode 040777 checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lz... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lsocket... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lnsl... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lmygcc... no 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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby --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 --with-mlib --without-mlib --with-mysqlclientlib --without-mysqlclientlib --with-zlib --without-zlib --with-mysqlclientlib --without-mysqlclientlib --with-socketlib --without-socketlib --with-mysqlclientlib --without-mysqlclientlib --with-nsllib --without-nsllib --with-mysqlclientlib --without-mysqlclientlib --with-mygcclib --without-mygcclib --with-mysqlclientlib --without-mysqlclientlib

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

在命令行上执行“which mysql”不会返回任何内容,这意味着它无法识别它。我还安装了MySQL系统首选项选项,但无法阻止MySQL运行。现在我完全不知道该怎么办!

编辑编辑

我刚刚使用本指南完全重新安装了 MySQL http://hivelogic.com/articles/installing-mysql-on-mac-os-x

不幸的是,这也不起作用,我仍然收到相同的错误。我什至无法在命令行执行 mysql -uroot,我收到以下错误:

错误2002(HY000):无法通过套接字“/tmp/mysql.sock”连接到本地MySQL服务器(2)

所以我想我已经尝试了一切。

**已解决*

抱歉大家,这个不起作用的原因是 MySQL 路径。我在这里写了博客:http://www.kieransenior.co.uk/2010/02/mysql-cant-connect-using-ruby-on-rails-mac-os-x-snow-leopard/

最佳答案

在 Debian(或 Ubuntu)系统上,只需使用以下命令安装 libmysqlclient-dev 软件包:

sudo apt-get install libmysqlclient-dev

然后:

gem install mysql

安装后不会出现任何错误。

关于MySQL安装: ERROR: Failed to build gem native extension,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2167598/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com