我已经在aws服务器上安装了我的项目。现在我正在做bundle install,我得到这个错误。
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20160628-9837-1r9tsw1.rb extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
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... yes
checking for mysql.h... no
checking for mysql/mysql.h... yes
checking for errmsg.h... no
-----
errmsg.h is missing. You may need to 'apt-get install libmysqlclient-dev' or 'yum install mysql-devel', and try again.
-----
*** 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/local/rvm/rubies/ruby-2.2.1/bin/$(RUBY_BASE_NAME)
--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
extconf failed, exit code 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.2.1/gems/mysql2-0.3.21 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.2.1/extensions/x86_64-linux/2.2.0/mysql2-0.3.21/gem_make.out
Using raindrops 0.16.0
Using sass 3.4.22
Using tilt 2.0.5
Using spring 1.7.1
Using sqlite3 1.3.11
Using will_paginate 3.1.0
Using rdoc 4.2.2
Using tzinfo 1.2.2
Using nokogiri 1.6.8
Using rack-test 0.6.3
Using warden 1.2.6
Using mime-types 3.1
Using net-scp 1.2.1
Using binding_of_caller 0.7.2
Using sprockets 3.6.0
Using coffee-script 2.4.1
Using uglifier 3.0.0
Using httparty 0.13.7
An error occurred while installing mysql2 (0.3.21), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.21'` succeeds before bundling.<br/>
我做了gem install mysql2 -v '0.3.21'或yum install mysql2 -devel都没有为我工作。谁能告诉我什么可能是问题
yum install libmysqlclient-dev
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror.nbrc.ac.in
* epel: mirror.wanxp.id
* extras: mirror.nbrc.ac.in
* updates: mirror.nbrc.ac.in
No package libmysqlclient-dev available.
Error: Nothing to do
在安装mysql2
gem之前,需要先安装libmysqlclient-dev
包。查看本页的MySql部分。即使mysql服务器已经安装在你的机器上,你也需要这个mysql客户端包。
您可以使用sudo apt-get install libmysqlclient-dev
或yum install libmysqlclient-dev
,这取决于您的linux发行版。确保这是成功完成的。只有在此之后,你才能安装mysql2 gem: gem install mysql2
希望有帮助
日志中的错误已经建议解决问题:
errmsg.h is missing. You may need to 'apt-get install libmysqlclient-dev' or 'yum install mysql-devel', and try again.
sudo apt-get install libmysqlclient-dev libmysqlclient18
或
sudo yum install mysql-devel