首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Rails - mysql2安装错误

Rails - mysql2安装错误
EN

Stack Overflow用户
提问于 2016-09-20 21:10:30
回答 2查看 1.2K关注 0票数 2

我最近在我当前的系统中安装了rvm来使用rails5和rails3.x版本。当我尝试创建新的rails5应用程序时,我得到了以下错误

代码语言:javascript
复制
Could not find proper version of railties (3.2.13) in any of the sources
Run `bundle install` to install missing gems.

当我尝试安装捆绑包时,我遇到了这个问题

代码语言:javascript
复制
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.

在相当长的一段时间里,我一直被困在这个问题上,任何帮助都将不胜感激。

EN

回答 2

Stack Overflow用户

发布于 2016-09-20 21:21:33

从终端尝试执行以下操作:

对于Ubuntu:

代码语言:javascript
复制
sudo apt-get install mysql-client libmysqlclient-dev
sudo gem install mysql2

对于Mac:

代码语言:javascript
复制
brew install mysql
sudo gem install mysql2
票数 0
EN

Stack Overflow用户

发布于 2016-09-20 21:25:03

请尝试以下操作:

代码语言:javascript
复制
gem install rails

然后安装mysql服务器

代码语言:javascript
复制
sudo apt-get install mysql-client libmysqlclient-dev

然后是bundle install

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39595050

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档