Node.js源代码构build在ARM上给出分段错误

tl; dr:我尝试在运行Ubuntu 12.10(quantal)的基于ARMv7的Cubox上安装node.js。 从源编译node.js(参见下面的“第二次尝试”)时, node会产生分段错误。 我能在这里做什么?

第一次尝试

首先,我试着通过包pipe理器来安装node.js,按照Ubuntu的说明在这里给出: 通过包pipe理器安装Node.js:Ubuntu,Mint

使用sudo add-apt-repository ppa:chris-lea/node.js添加在那里提到sudo add-apt-repository ppa:chris-lea/node.js似乎工作正常:

 You are about to add the following PPA to your system: Evented I/O for V8 javascript. Node's goal is to provide an easy way to build scalable network programs More info: https://launchpad.net/~chris-lea/+archive/node.js Press [ENTER] to continue or ctrl-c to cancel adding it gpg: keyring `/tmp/tmpp0owib/secring.gpg' created gpg: keyring `/tmp/tmpp0owib/pubring.gpg' created gpg: requesting key C7917B12 from hkp server keyserver.ubuntu.com gpg: /tmp/tmpp0owib/trustdb.gpg: trustdb created gpg: key C7917B12: public key "Launchpad chrislea" imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) OK 

但是, sudo apt-get install nodejs给我的错误:

 E: Unable to locate package nodejs 

我认为这是因为我有一个基于ARM的系统。 据我可以从包详细信息 ,回购只包含build立i386和amd64。 我的假设是正确的吗?

第二次尝试

所以我的下一个尝试是从源代码安装node.js。 我使用了以下要点中给出的指令: Node.js和NPM在30秒内 。 一切似乎工作,包括make install 。 但是,要点的最后一行中的install.sh脚本的执行失败,因为node产生了分段错误。 现在我想知道我能在我的机器上正确安装node.js吗?

为了说明我的问题,这里有一些输出:

install.sh输出

运行make install ,这是install.sh的输出,如上述要点安装说明中所述。

 cyroxx@cubox:~/node-latest-install$ curl https://npmjs.org/install.sh | sh % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 7882 100 7882 0 0 11251 0 --:--:-- --:--:-- --:--:-- 14984 tar=/bin/tar version: tar (GNU tar) 1.26 Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by John Gilmore and Jay Fenlason. install npm@latest fetching: http://registry.npmjs.org/npm/-/npm-1.2.21.tgz Segmentation fault Segmentation fault You need node to run this program. node --version reports: v0.10.7 Please upgrade node before continuing. It failed 

节点输出

 cyroxx@cubox:~/node-latest-install$ node Segmentation fault 

使debugging版本

使用BUILDTYPE=Debug运行make产生以下输出:

 cyroxx@cubox:~/node-latest-install$ make -C out BUILDTYPE=Debug make: Entering directory `/home/cyroxx/node-latest-install/out' CXX(target) /home/cyroxx/node-latest-install/out/Debug/obj.target/v8_base/deps/v8/src/arm/stub-cache-arm.o ../deps/v8/src/arm/stub-cache-arm.cc: In function 'void v8::internal::ProbeTable(v8::internal::Isolate*, v8::internal::MacroAssembler*, v8::internal::Code::Flags, v8::internal::StubCache::Table, v8::internal::Register, v8::internal::Register, v8::internal::Register, v8::internal::Register, v8::internal::Register, v8::internal::Register)': ../deps/v8/src/arm/stub-cache-arm.cc:106:15: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] cc1plus: all warnings being treated as errors make: *** [/home/cyroxx/node-latest-install/out/Debug/obj.target/v8_base/deps/v8/src/arm/stub-cache-arm.o] Error 1 make: Leaving directory `/home/cyroxx/node-latest-install/out' 

这里有什么问题? 这是V8的ARM实现中的错误吗? 也许没有(正确)设置的任何编译器标志? 还要别的吗? 我完全卡住了。

我在一些不同的ARM计算机上也遇到了这个问题。 编译没有快照function为我工作。 快照是一个V8function,允许节点启动速度更快,似乎有一个ARM的错误。

 ./configure --without-snapshot make sudo make install 

http://www.armhf.com/index.php/node-js-for-the-beaglebone-black/

即使使用--without-snapshot--with-arm-float-abi=hard ,我也无法使用运行Unity的Crouton构build三星Chromebook XE303C12I,所以我使用了Linux ARM设备的预编译二进制文件。

二进制文件可以在nodejs.org/dist/{version号码的release目录中find

例如,v0.10.24的ARM二进制文件可以在这里下载( http://nodejs.org/dist/v0.10.24/node-v0.10.24-linux-arm-pi.tar.gz

这是一个脚本来下载和安装一个二进制文件。 一旦你安装了节点,确保将path/to/bin/node到你的$PATH