[英]Rails - mysql2 installation error
I have recently installed rvm to use rails5 along with rails3.x version in my current system. 我最近安装了rvm,以在当前系统中将rails5和rails3.x版本一起使用。 When i tried to create new rails5 application, i have got the below error
当我尝试创建新的rails5应用程序时,出现以下错误
Could not find proper version of railties (3.2.13) in any of the sources
Run `bundle install` to install missing gems.
And when i try to do bundle install, i got stuck with this 当我尝试进行捆绑安装时,我陷入了困境
gem install mysql2 -v '0.3.11'
Building native extensions. This could take a while...
/home/himanth/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/ext/builder.rb:73: warning: Insecure world writable dir /home/himanth/.rvm/gems in PATH, mode 040777
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/home/himanth/.rvm/rubies/ruby-2.3.1/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling mysql2_ext.c
In file included from ./client.h:11:0,
from ./mysql2_ext.h:39,
from mysql2_ext.c:1:
/home/himanth/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/ruby/backward/rubysig.h:14:2: warning: #warning rubysig.h is obsolete [-Wcpp]
In file included from ./mysql2_ext.h:39:0,
from mysql2_ext.c:1:
./client.h: In function 'rb_thread_blocking_region':
./client.h:23:3: error: 'TRAP_BEG' undeclared (first use in this function)
./client.h:23:3: note: each undeclared identifier is reported only once for each function it appears in
./client.h:25:3: error: 'TRAP_END' undeclared (first use in this function)
mysql2_ext.c: At top level:
./client.h:16:1: warning: 'rb_thread_blocking_region' defined but not used [-Wunused-function]
make: *** [mysql2_ext.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/himanth/.rvm/gems/ruby-2.3.1@rails5/gems/mysql2-0.3.11 for inspection.
Results logged to /home/himanth/.rvm/gems/ruby-2.3.1@rails5/extensions/x86_64-linux/2.3.0/mysql2-0.3.11/gem_make.out
An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling.
Got stuck with this for quite some time, any help would be much appreciated. 坚持了很长时间,任何帮助将不胜感激。
From Terminal try following: 从终端尝试以下操作:
For Ubuntu: 对于Ubuntu:
sudo apt-get install mysql-client libmysqlclient-dev
sudo gem install mysql2
For Mac: 对于Mac:
brew install mysql
sudo gem install mysql2
try the below: 请尝试以下方法:
gem install rails
After that install mysql server 之后安装mysql服务器
sudo apt-get install mysql-client libmysqlclient-dev
then bundle install
然后
bundle install
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.