我正在尝试在本地安装一个5岁的网站,这是一个1.9.2 Ruby网站。对于它,我需要mysql2 gem文件,但我经常失败的错误mesasge 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
你能帮我一点吗?
答案 0 :(得分:0)
谢谢!关于那个链接解决方案,我删除了ruby,发现安装了多个版本。删除后,一切正常。
答案 1 :(得分:0)
我也有这个问题,但无法删除系统ruby,因为它在RVM之外使用。
但是,事实证明,为了实现这一目标,您需要删除的只是ruby-devel
包。看起来出于某种原因,当尝试在RVM中编译mysql本机扩展时,一些包含的文件是从系统包含目录而不是RVM包含目录中获取的,导致ruby版本之间发生冲突。