欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

MySQL - Failed to build gem native extension

程序员文章站 2022-07-12 21:26:48
...

I am using Fedora 14 and I have MySQL and MySQL server 5.1.42 installed and running. Now I tried to do this as root user:

gem install mysql

But I get this error:
Buildingnative extensions.This could take a while...
ERROR:Error installing mysql:
    ERROR:Failed to build gem native extension./usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

What's wrong here? In installed ruby 1.8.7. and the latest rubygems 1.8.25.

 

解决办法:

For those who may be confused by the accepted answer, as I was, you also need to have the ruby headers installed [ruby-devel].

The article that saved my hide is here.

And this is the revised solution (note that I'm on Fedora 13):

yum -y install gcc mysql-devel ruby-devel rubygems
gem install -y mysql ----with-mysql-config=/usr/bin/mysql_config