【问题标题】:Ruby and Mysql2红宝石和Mysql2
【发布时间】:2016-01-14 17:05:14
【问题描述】:

我正在尝试在本地安装一个已有 5 年历史的网站,它是一个 1.9.2 Ruby 网站。为此,我需要 mysql2 gem 文件,但我经常因错误消息 belove 失败。

Installing mysql2 0.3.20 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /home/li/.rvm/rubies/ruby-1.9.2-p330/bin/ruby -r ./siteconf20160114-7831-msi06n.rb extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... no
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... no
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
-----
Using mysql_config at /usr/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Setting libpath to /usr/lib64/mysql
-----
creating Makefile

make  clean

make
gcc -I. -I/home/li/.rvm/rubies/ruby-1.9.2-p330/include/ruby-1.9.1/x86_64-linux -I/home/li/.rvm/rubies/ruby-1.9.2-p330/include/ruby-1.9.1/ruby/backward -I/home/li/.rvm/rubies/ruby-1.9.2-p330/include/ruby-1.9.1 -I. -I/usr/include/mysql -DHAVE_RUBY_THREAD_H -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_RB_HASH_DUP -DHAVE_RB_INTERN3 -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H    -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long  -fPIC -Wall -funroll-loops  -o mysql2_ext.o -c mysql2_ext.c
In file included from ./mysql2_ext.h:32:0,
                 from mysql2_ext.c:1:
/usr/include/ruby/thread.h:26:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
 void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1);
 ^
In file included from ./mysql2_ext.h:41:0,
                 from mysql2_ext.c:1:
./client.h:39:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘typedef’
 typedef struct {
 ^
Makefile:180: recipe for target 'mysql2_ext.o' failed
make: *** [mysql2_ext.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/li/.rvm/gems/ruby-1.9.2-p330@trafo/gems/mysql2-0.3.20 for inspection.
Results logged to /home/li/.rvm/gems/ruby-1.9.2-p330@trafo/extensions/x86_64-linux/1.9.1/mysql2-0.3.20/gem_make.out

你能帮帮我吗?

【问题讨论】:

  • 也许这个link 会有所帮助。
  • 正在查看,抱歉回复慢,最近有很多东西进来,必须列出优先级。你知道这是怎么回事...

标签: mysql ruby-on-rails ruby mysql2


【解决方案1】:

谢谢!关于那个链接解决方案,我删除了 ruby​​ 并发现安装了多个版本。删除后,一切正常。

【讨论】:

    【解决方案2】:

    我也遇到了这个问题,但无法删除系统 ruby​​,因为它是在 RVM 之外使用的。

    但是,事实证明,您需要删除的只是 ruby-devel 包。似乎由于某种原因,当尝试在 RVM 中编译 mysql 本机扩展时,一些包含的文件是从系统包含目录而不是 RVM 包含目录中获取的,从而导致 ruby​​ 版本之间发生冲突。

    【讨论】:

      猜你喜欢
      • 2013-12-16
      • 2011-09-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多