在linux mint 15中,当我在安装sum gem之后运行bundle install时会发生错误。
使用mono_logger 1.1.0
Gem :: Ext :: BuildError:错误:无法构建gem原生扩展。
/home/jazib/.rvm/rubies/ruby-1.9.3-p547/bin/ruby extconf.rb
checking for ruby/thread.h... no
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
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=/home/jazib/.rvm/rubies/ruby-1.9.3-p547/bin/ruby
--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-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
extconf failed, exit code 1
Gem files will remain installed in /home/jazib/.rvm/gems/ruby-1.9.3-p547/gems/mysql2-0.3.14 for inspection.
Results logged to /home/jazib/.rvm/gems/ruby-1.9.3-p547/extensions/x86-linux/1.9.1/mysql2-0.3.14/gem_make.out
An error occurred while installing mysql2 (0.3.14), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.14'` succeeds before bundling.
我尝试了很多来解决这个错误,但每次尝试都会发生同样的错误。 指导我如何解决这个问题?
答案 0 :(得分:1)
尝试安装mysql库:
sudo apt-get install libmysqlclient-dev
答案 1 :(得分:1)
您需要安装宝石在安装时查找的库。查看最后一行gem install mysql2 -v '0.3.14'
。这是寻找图书馆的宝石。什么时候看上面,它清楚地说
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
所以你需要安装这个库。使用
安装 sudo apt-get install libmysqlclient-dev
这是您需要调试任何捆绑安装失败的方法。
答案 2 :(得分:0)
问题解决了。 在您的服务器上运行以下命令,它将使用old-releases.ubuntu.com替换所有archive.ubuntu.com和security.ubuntu.com包存储库URL
sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
对于Linux Mint,也要运行此命令:
sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list.d/official-package-repositories.list
现在更新apt-get sources:
sudo apt-get update