Tôi cố gắng để cài đặt mysql2
đá quý thông qua Bundler, nhưng nó vẫn không ngừng hấp hối với các lỗi sau:lỗi Cài đặt đá quý mysql2 qua Bundler
** executing command
/home/cc_rails/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems/installer.rb:483:in 'rescue in block in build_extensions':
ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/home/cc_rails/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb --with-mysql-config=/usr/bin/mysql_config
checking for rb_thread_blocking_region()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing. please check your installation of mysql 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=/home/cc_rails/.rvm/rubies/ruby-1.9.2-p0/bin/ruby
--with-mysql-config
Gem files will remain installed for inspection.
Hầu hết những điều tôi tìm thấy qua Googling đề nghị đi qua các --with-mysql-config
tham số để sửa nó. Vì vậy, dựa trên:
$ which mysql_config
/usr/bin/mysql_config
Tôi được thêm vào sau để cấu hình của Bundler:
$ bundle config build.mysql2 --with-mysql-config='/usr/bin/mysql_config'
Tuy nhiên, vẫn không có may mắn - cùng vụ tai nạn như trên.
Vì nó chết với lỗi mysql.h is missing
, tôi đã kiểm tra điều đó và bị cáo buộc là không thể tìm thấy bởi Bundler.
$ find/-name mysql.h
/usr/include/mysql5/mysql/mysql.h
Bạn nghĩ gì?
Bạn đã thử giải pháp tại http://stackoverflow.com/questions/3608287/installing-mysql2-gem-for-rails-3 chưa? – Wrikken
Nếu không, bạn có thể chỉ cần chỉnh sửa 'ext/mysql2/extconf.rb' và nhập đúng đường dẫn tới thư mục mysql của bạn (nó ở gần đầu). – Wrikken