我在Arch Linux上遇到此错误,尽管系统中存在mysql.h。有谁知道如何解决这个问题?这里有一些命运:
$ find /usr -name mysql.h
/usr/include/mysql/mysql.h
$ echo $PATH
/home/chris/.rvm/gems/ruby-1.8.7-p302@bogen/bin:/home/chris/.rvm/gems/ruby-1.8.7-p302@global/bin:/home/chris/.rvm/rubies/ruby-1.8.7-p302/bin:/home/chris/.rvm/bin:/bin:/usr/bin:/usr/lib:/sbin:/usr/sbin:/home/chris/bin:/home/chris/lib:/usr/share/eclipse:/opt/kde/bin:/usr/bin/perlbin/site:/usr/bin/perlbin/vendor:/usr/bin/perlbin/core:/opt/qt/bin:/usr/include:/usr/local/include:/opt/ruby1.8/bin:/usr/local/bin:/usr/local/sbin:/usr/bin/vendor_perl:/usr/bin/core_perl
以下是gem install mysql
$ which ruby
/home/chris/.rvm/rubies/ruby-1.8.7-p302/bin/ruby
$ gem install mysql
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/home/chris/.rvm/rubies/ruby-1.8.7-p302/bin/ruby extconf.rb
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.
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=/home/chris/.rvm/rubies/ruby-1.8.7-p302/bin/ruby
--with-mysql-config
--without-mysql-config
Gem files will remain installed in /home/chris/.rvm/gems/ruby-1.8.7-p302@bogen/gems/mysql-2.8.1 for inspection.
Results logged to /home/chris/.rvm/gems/ruby-1.8.7-p302@bogen/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
由于这是Arch linux,因此没有像Ubuntu或CentOS那样的开发包。我尝试过的上述命令的变化包括:
gem install mysql -- --with-mysql-include=/usr/include/mysql --with-mysql-config
gem install mysql -- --with-mysql-include=/usr/include/mysql
gem install mysql -- --with-mysql-include=/usr/include
一切都无济于事。不幸的是,我能够找到的这个错误的其他报告要么与Mac OS有关,要么在其他Linux发行版上没有devel包。由于头文件在我的情况下并且似乎在标准位置,我不知道接下来要尝试什么。任何提示都会非常感激。
答案 0 :(得分:0)
这也可能是由于未安装GCC造成的,因为这是检查的完成方式。
答案 1 :(得分:0)
这个对我有用。
yum install libodb-mysql-devel.i686 mysql-devel.i686 soci-mysql-devel.i686