为什么therubyracer无法在我的Debian上构建?

时间:2012-01-24 18:22:14

标签: ruby-on-rails compiler-errors build-process debian

我想更新到rails 3.2,但是therubyracer(0.9.9)的构建过程失败了。我不知道我该做什么。

我的环境: Debian Squeeze(2.6.32-5-amd64)

make
compiling v8_external.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_external.cpp:4:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::External]’:
v8_external.cpp:51:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
v8_external.cpp: At global scope:
v8_external.cpp:10: warning: ‘<unnamed>::references’ defined but not used
compiling v8_context.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_context.cpp:2:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Context]’:
v8_context.cpp:15:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::ObjectTemplate]’:
v8_context.cpp:22:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Value]’:
v8_context.cpp:23:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8_value.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_value.cpp:1:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Value]’:
v8_value.cpp:10:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8_message.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_message.cpp:2:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Message]’:
v8_message.cpp:10:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8_date.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_date.cpp:4:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Date]’:
v8_date.cpp:21:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8_handle.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
compiling v8_v8.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
compiling v8_callbacks.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
compiling v8_array.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_array.cpp:1:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Array]’:
v8_array.cpp:13:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8_exception.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_exception.cpp:3:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::StackTrace]’:
v8_exception.cpp:48:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::StackFrame]’:
v8_exception.cpp:68:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
v8_exception.cpp: At global scope:
v8_exception.cpp:10: warning: ‘<unnamed>::stack’ defined but not used
compiling v8_weakref.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
compiling v8_debug.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
compiling v8_function.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_function.cpp:5:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Function]’:
v8_function.cpp:13:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Array]’:
v8_function.cpp:23:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::String]’:
v8_function.cpp:49:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8_object.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_object.cpp:1:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Object]’:
v8_object.cpp:17:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8_locker.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
v8_locker.cpp: In function ‘VALUE<unnamed>::Lock::Delete(VALUE)’:
v8_locker.cpp:45: warning: no return statement in function returning non-void
v8_locker.cpp: In function ‘VALUE<unnamed>::Unlock::Delete(VALUE)’:
v8_locker.cpp:85: warning: no return statement in function returning non-void
compiling v8_script.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_script.cpp:2:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Script]’:
v8_script.cpp:25:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8_string.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_string.cpp:3:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::String]’:
v8_string.cpp:13:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
compiling rr.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
rr.cpp: In function ‘VALUE rr_define_finalizer(VALUE, void*, VALUE)’:
rr.cpp:48: warning: no return statement in function returning non-void
In file included from rr.cpp:3:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Value]’:
rr.cpp:159:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8_template.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from v8_template.cpp:2:
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Template]’:
v8_template.cpp:42:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::ObjectTemplate]’:
v8_template.cpp:45:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::FunctionTemplate]’:
v8_template.cpp:48:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
v8_handle.h: In function ‘v8::Persistent<T>& rr_v8_handle(VALUE) [with T = v8::Data]’:
v8_template.cpp:54:   instantiated from here
v8_handle.h:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
compiling v8_try_catch.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
linking shared-object v8.so
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.a(functexcept.o): relocation R_X86_64_32 against `std::bad_typeid::~bad_typeid()' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [v8.so] Error 1

更新

我尝试了以下内容:

  1. 下载了源git clone https://github.com/cowboyd/therubyracer.git
  2. 的副本
  3. $CPPFLAGS += " -fPIC"添加到ext/v8/extconf.rb
  4. 使用gem build therubyracer.gemspec
  5. 制作宝石
  6. 使用gem install therubyracer-0.9.9.gem
  7. 安装的gem

    向我展示了同样的错误!问题:https://github.com/cowboyd/therubyracer/issues/135

3 个答案:

答案 0 :(得分:2)

在debian上(使用amd64内核的686)我必须卸载livb8,下载gem并重新编译我的架构

gem uninstall libv8
wget http://rubygems.org/downloads/libv8-3.3.10.4.gem
ARCHFLAG='-arch i386' gem install ./libv8-3.3.10.4.gem
ARCHFLAG='-arch i386' gem install therubyracer

然后安装了Therubyracer(0.10.1)。

答案 1 :(得分:1)

recompile with -fPIC

您是否尝试添加-fPIC作为附加构建标记?您可以在gem安装中测试它:

$ gem install therubyracer -- -fPIC

或者,使用Bundler:

$ bundle config build.therubyracer -fPIC

看起来其他人在issue中指出了它。如果上述方法不起作用,您可能需要查看它。

答案 2 :(得分:0)

一种解决方案是将0.9.8版本作为0.9.9版本运行。 (解决不是真正的问题):

  1. 克隆therubyracer的来源git clone https://github.com/cowboyd/therubyracer.git
  2. 结帐标记v0.9.8 git checkout v0.9.8
  3. ./lib/v8/version.rb中的版本号更改为0.9.9
  4. 构建gem gem build therubyracer.gemspec
  5. 安装gem gem install therubyracer-0.9.9.gem