MySQL安装:错误:无法构建gem本机扩展 [英] MySQL Install: ERROR: Failed to build gem native extension

查看:88
本文介绍了MySQL安装:错误:无法构建gem本机扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让MySQL安装到最新版本,因为某些安装在某处沿途出错。我运行命令 gem install mysql ,并收到以下内容:
$ b


扩展。这
可能需要一段时间...错误:错误
安装mysql:错误:无法
构建gem原生扩展。



/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
extconf.rb extconf.rb:4:警告:
不安全的可写目录dir / usr / bin
在PATH中,模式040777 extconf.rb:4:
警告:不安全的可写目录$ PATH中的
/ usr / bin,模式040777
extconf.rb:7:警告:不安全的世界
在PATH中可写dir / usr / bin,模式
040777 mkmf.rb找不到头文件

/ System / Library / Frameworks / RBy.framework / Versions /1.8/usr/lib/ruby/ruby.h


Gem文件将保持安装在
/Library/Ruby/Gems/1.8/gems/mysql- 2.8.1
进行检查。结果记录到
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out


我搜索了,并尝试了一大堆东西,从安装特定的版本到试图重新安装ruby没有任何运气。



任何想法,我可以会出错?



我试图让MySQL安装到最新版本,因为某些安装在某处沿途出错。我运行命令 gem install mysql ,并收到以下内容:
$ b


扩展。这
可能需要一段时间...错误:错误
安装mysql:错误:无法
构建gem原生扩展。



/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
extconf.rb extconf.rb:4:警告:
不安全的可写目录dir / usr / bin
在PATH中,模式040777 extconf.rb:4:
警告:不安全的可写目录$ PATH中的
/ usr / bin,模式040777
extconf.rb:7:警告:不安全的世界
在PATH中可写dir / usr / bin,模式
040777 mkmf.rb找不到头文件

/ System / Library / Frameworks / RBy.framework / Versions /1.8/usr/lib/ruby/ruby.h


Gem文件将保持安装在
/Library/Ruby/Gems/1.8/gems/mysql- 2.8.1
进行检查。结果记录到
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out


我搜索了,并尝试了一大堆东西,从安装特定的版本到试图重新安装ruby没有任何运气。



任何想法,我可以会出错吗?



编辑:我在雪豹DVD上安装了XCode,并且该错误稍微改变如下:


构建原生扩展。这可能需要一段时间...
错误:安装mysql时出错:
错误:未能构建gem原生扩展。



/ System / Library /Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
extconf.rb:4:警告:不安全的可写dir / usr / bin在PATH中,模式040777
extconf。 rb:4:警告:不安全的可写dir / usr / bin在PATH中,模式040777
extconf.rb:7:警告:不安全的可写dir / usr / bin在PATH中,模式040777
extconf。 rb:17:警告:不安全的可写dir / usr / bin在PATH中,模式040777
在-lmysqlclient中检查mysql_query()... no
在-lm中检查main()是
在-lmysqlclient中检查mysql_query()...没有
在-lz中检查main()...是
在-lmysqlclient中检查mysql_query()... no
在-lsocket中检查main()... no
在-lmysqlclient中检查mysql_query()... no
在-lnsl中检查main()... no
检查mysql_que ry()in -lmysqlclient ... no
在-lmygcc中检查main()... no
在-lmysqlclient中检查mysql_query()... no
* extconf.rb失败*
由于某种原因无法创建Makefile,可能缺少
必需的库和/或头文件。查看mkmf.log文件以获取更多
的详细信息。您可能需要配置选项。



提供的配置选项:
--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-myg cclib
--with-mysqlclientlib
--without-mysqlclientlib



Gem文件将保持安装在/Library/Ruby/Gems/1.8/gems /mysql-2.8.1进行检查。
结果记录到/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out


在命令行上执行哪个mysql不会返回任何内容,这意味着它不能识别它。我还安装了MySQL系统首选项选项,并且我无法阻止MySQL运行。现在我完全停留在做什么了!



编辑编辑



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



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

ERROR 2002(HY000):无法连接到本地MySQL服务器socket'/tmp/mysql.sock'(2)



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



**已解决*



对不起,这是因为MySQL路径导致无法正常工作的原因。我在这里发表了博文: http://www.kieransenior.co.uk/2010/02/mysql-cant-connect-using-ruby-on-rails-mac-os-x-snow-leopard/

解决方案



在终端中。First做一个'locate mysql_config',然后将下面的命令中的路径替换为的文件。

 <$ c $ $> sudo gem install mysql  -  --with-mysql-config = / usr / local / mysql / bin / mysql_config 
构建本机扩展。这可能需要一段时间...
已成功安装mysql-2.7
1已安装gem


I'm trying to get MySQL installed to the latest version due to some installation going wrong somewhere along the line. I run the command gem install mysql and I receive the following:

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

I've searched, and tried a whole host of things, from installing specific versions to trying to reinstall ruby without any luck.

Any ideas where I may be going wrong?

I'm trying to get MySQL installed to the latest version due to some installation going wrong somewhere along the line. I run the command gem install mysql and I receive the following:

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

I've searched, and tried a whole host of things, from installing specific versions to trying to reinstall ruby without any luck.

Any ideas where I may be going wrong?

EDIT: I installed XCode off my Snow Leopard DVD and the error just changed slightly to the following:

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

doing "which mysql" on the command line returns nothing, which means it's not recognizing it. I also installed the MySQL system preferences option, and I can't stop MySQL from running. Now I'm completely stuck as what to do!

EDIT EDIT

I've just completely reinstalled MySQL using this guide http://hivelogic.com/articles/installing-mysql-on-mac-os-x

Unfortunately this didn't work either, I still receive the same errors. I can't even do mysql -uroot at the command line, I get the error of:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

So I think I've tried everything.

**SOLVED*

Sorry guys, the reason for this not working was because of the MySQL paths. I've blogged on it here: http://www.kieransenior.co.uk/2010/02/mysql-cant-connect-using-ruby-on-rails-mac-os-x-snow-leopard/

解决方案

Installing the mysql gem on OSX

in a terminal.. First do a ‘locate mysql_config’ and then replace the path in the following command with where that file is.

$ sudo gem install mysql -- —–with-mysql-config=/usr/local/mysql/bin/mysql_config
Building native extensions. This could take a while…
Successfully installed mysql-2.7
1 gem installed

这篇关于MySQL安装:错误:无法构建gem本机扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆