难以在Ubuntu上安装mysql gem

bod*_*tva 50 mysql rubygems ruby-on-rails ubuntu-10.04

我正在尝试安装mysql 2.8.1 gem.我将使用它在Ubuntu 10.04上构建Rails 2.0.2应用程序.我会使用Ruby 1.8.7.我已经安装了开发依赖项(其他宝石).由于某些原因,我无法安装它.我无法弄清楚如何修复它.请帮忙!!

我尝试安装时在终端中获得以下内容:

mohnish@pc146724-desktop:~/Downloads$ sudo gem install mysql-2.8.1.gem 
Building native extensions.  This could take a while...
ERROR:  Error installing mysql-2.8.1.gem:
    ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb
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... yes
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=/usr/bin/ruby1.8
    --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 /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
mohnish@pc146724-desktop:~/Downloads$ 
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助!!

Zab*_*bba 122

试试这个,然后安装mysql gem:

sudo apt-get install libmysqlclient-dev 
Run Code Online (Sandbox Code Playgroud)

如果这还不够,请尝试这样做

 sudo apt-get install libmysqlclient-dev libmysqlclient16 ruby-dev
Run Code Online (Sandbox Code Playgroud)

  • 如果libmysqlclient16不工作,请尝试libmysqlclient18 (27认同)
  • `sudo apt-get install libmysqlclient-dev libmysqlclient18` (22认同)
  • 为我工作,但我根本不需要安装`libmysqlclient*` (4认同)
  • 为我工作,*只*安装`libmysqlclient` (3认同)
  • ruby-dev包在这里是可选的 (2认同)

And*_*mer 9

试试这个,然后安装mysql gem:

sudo apt-get install libmysqlclient-dev libmysqlclient16

这工作在运行sudo gem install mysql之后.

文档仍然没有正确安装(大量的"无定义"错误,虽然这不是真正的大问题.