简体   繁体   English

在fedora 20上安装TheRubyRacer gem错误

[英]Installing TheRubyRacer gem on fedora 20 Error

I am working on a project, that needs therubyracer. 我正在做一个需要therubyracer的项目。 When I do a bundle install I get the following error message when the bundler tries to install therubyracer. 当我进行捆绑安装时,当捆绑器尝试安装therubyracer时,会出现以下错误消息。

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /usr/bin/ruby extconf.rb 
checking for main() in -lpthread... yes
checking for v8.h... yes
creating Makefile

make "DESTDIR="
g++ -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -D_FILE_OFFSET_BITS=64  -Wall -g -rdynamic -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -march=i686 -mtune=atom -fasynchronous-unwind-tables -m32 -o init.o -c init.cc
g++ -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -D_FILE_OFFSET_BITS=64  -Wall -g -rdynamic -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -march=i686 -mtune=atom -fasynchronous-unwind-tables -m32 -o signature.o -c signature.cc
g++ -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -D_FILE_OFFSET_BITS=64  -Wall -g -rdynamic -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -march=i686 -mtune=atom -fasynchronous-unwind-tables -m32 -o exception.o -c exception.cc
g++ -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -D_FILE_OFFSET_BITS=64  -Wall -g -rdynamic -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -march=i686 -mtune=atom -fasynchronous-unwind-tables -m32 -o primitive.o -c primitive.cc
g++ -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -D_FILE_OFFSET_BITS=64  -Wall -g -rdynamic -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -march=i686 -mtune=atom -fasynchronous-unwind-tables -m32 -o context.o -c context.cc
In file included from context.cc:1:0:
context.cc: In static member function ‘static VALUE rr::Context::SetEmbedderData(VALUE, VALUE, VALUE)’:
context.cc:81:23: error: ‘class v8::Context’ has no member named ‘SetEmbedderData’
   Void(Context(self)->SetEmbedderData(NUM2INT(index), Value(data)));
                       ^
rr.h:33:20: note: in definition of macro ‘Void’
 #define Void(expr) expr; return Qnil;
                    ^
context.cc: In static member function ‘static VALUE rr::Context::GetEmbedderData(VALUE, VALUE)’:
context.cc:85:23: error: ‘class v8::Context’ has no member named ‘GetEmbedderData’
   Void(Context(self)->GetEmbedderData(NUM2INT(index)));
                       ^
rr.h:33:20: note: in definition of macro ‘Void’
 #define Void(expr) expr; return Qnil;
                    ^
make: *** [context.o] Error 1


Gem files will remain installed in /home/anupam/.gem/ruby/gems/therubyracer-0.12.1 for inspection.
Results logged to /home/anupam/.gem/ruby/gems/therubyracer-0.12.1/ext/v8/gem_make.out
An error occurred while installing therubyracer (0.12.1), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.12.1'` succeeds before bundling.

When I run gem install therubyracer -v '0.12.1' or without the version, it still fails. 当我运行gem install therubyracer -v'0.12.1'或没有该版本时,它仍然会失败。

I am new to ruby so I don't really understand what is going on or why it is failing. 我是红宝石的新手,所以我不太了解发生了什么或为什么会失败。

Any help on this is much appreciated. 任何帮助对此表示感谢。

我在Fedora 24 x64上遇到了同样的问题,而sudo dnf -y install gcc-c++解决了我的问题

I removed all gems. 我删除了所有宝石。

Uninstalled ruby 未安装的红宝石

Reinstalled ruby ruby-devel 重新安装了ruby ruby​​-devel

Installed ruby and ruby-devel and install therubyracer and libv8 using yum NOT gem. 安装了ruby和ruby-devel并使用yum NOT gem安装therubyracer和libv8。

Then I ran bundle install and gem used the already installed gems that yum installed. 然后我运行捆绑安装程序,gem使用了yum安装的已经安装的gem。

Thank god for fedora maintainers! 感谢上帝,Fedora的维护者! You guys are awesome 你们真棒

I know it sounds dumb but I had the exact problem and it seems I lacked the package gcc-c++. 我知道这听起来很愚蠢,但我遇到了确切的问题,似乎我缺少gcc-c ++软件包。 Thought already had them. 思想已经有了它们。 yum install gcc-c++ did the trick yum install gcc-c++做到了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM