javascript - 为 armv7 编译 node.js v0.10.31 时出错

标签 javascript node.js compiler-errors raspberry-pi

尝试在 Ubuntu 14.04 上编译 Node.js v0.10.31(和 v0.10.30)以用于 Raspberry pi(运行 ARM)时。我正在使用以下编译器标志:

export AR=arm-linux-gnueabihf-ar
export CC=arm-linux-gnueabihf-gcc
export CXX=arm-linux-gnueabihf-g++
export LINK=arm-linux-gnueabihf-g++

但是我得到以下错误:

make -C out BUILDTYPE=Release V=1
make[1]: Entering directory `/home/ubuntu/node/out'
  arm-linux-gnueabihf-g++ -pthread -rdynamic -Wl,--whole-archive /home/ubuntu/node/out/Release/libopenssl.a -Wl,--no-whole-archive -Wl,--whole-archive /home/ubuntu/node/out/Release/obj.target/deps/v8/tools/gyp/libv8_base.a -Wl,--no-whole-archive -pthread  -o /home/ubuntu/node/out/Release/node -Wl,--start-group /home/ubuntu/node/out/Release/obj.target/node/src/fs_event_wrap.o /home/ubuntu/node/out/Release/obj.target/node/src/cares_wrap.o /home/ubuntu/node/out/Release/obj.target/node/src/handle_wrap.o /home/ubuntu/node/out/Release/obj.target/node/src/node.o /home/ubuntu/node/out/Release/obj.target/node/src/node_buffer.o /home/ubuntu/node/out/Release/obj.target/node/src/node_constants.o /home/ubuntu/node/out/Release/obj.target/node/src/node_extensions.o /home/ubuntu/node/out/Release/obj.target/node/src/node_file.o /home/ubuntu/node/out/Release/obj.target/node/src/node_http_parser.o /home/ubuntu/node/out/Release/obj.target/node/src/node_javascript.o /home/ubuntu/node/out/Release/obj.target/node/src/node_main.o /home/ubuntu/node/out/Release/obj.target/node/src/node_os.o /home/ubuntu/node/out/Release/obj.target/node/src/node_script.o /home/ubuntu/node/out/Release/obj.target/node/src/node_stat_watcher.o /home/ubuntu/node/out/Release/obj.target/node/src/node_string.o /home/ubuntu/node/out/Release/obj.target/node/src/node_zlib.o /home/ubuntu/node/out/Release/obj.target/node/src/pipe_wrap.o /home/ubuntu/node/out/Release/obj.target/node/src/signal_wrap.o /home/ubuntu/node/out/Release/obj.target/node/src/string_bytes.o /home/ubuntu/node/out/Release/obj.target/node/src/stream_wrap.o /home/ubuntu/node/out/Release/obj.target/node/src/slab_allocator.o /home/ubuntu/node/out/Release/obj.target/node/src/tcp_wrap.o /home/ubuntu/node/out/Release/obj.target/node/src/timer_wrap.o /home/ubuntu/node/out/Release/obj.target/node/src/tty_wrap.o /home/ubuntu/node/out/Release/obj.target/node/src/process_wrap.o /home/ubuntu/node/out/Release/obj.target/node/src/v8_typed_array.o /home/ubuntu/node/out/Release/obj.target/node/src/udp_wrap.o /home/ubuntu/node/out/Release/obj.target/node/src/node_crypto.o /home/ubuntu/node/out/Release/obj.target/deps/openssl/libopenssl.a /home/ubuntu/node/out/Release/obj.target/deps/zlib/libchrome_zlib.a /home/ubuntu/node/out/Release/obj.target/deps/http_parser/libhttp_parser.a /home/ubuntu/node/out/Release/obj.target/deps/cares/libcares.a /home/ubuntu/node/out/Release/obj.target/deps/uv/libuv.a /home/ubuntu/node/out/Release/obj.target/deps/v8/tools/gyp/libv8_base.a /home/ubuntu/node/out/Release/obj.target/deps/v8/tools/gyp/libv8_nosnapshot.a -Wl,--end-group -lm -ldl -lrt
/home/ubuntu/node/out/Release/libopenssl.a(armcap.o): In function `OPENSSL_cpuid_setup':
armcap.c:(.text.startup+0x0): multiple definition of `OPENSSL_cpuid_setup'
/home/ubuntu/node/out/Release/libopenssl.a(cryptlib.o):cryptlib.c:(.text+0x360): first defined here
/home/ubuntu/node/out/Release/libopenssl.a(armcap.o): In function `OPENSSL_rdtsc':
armcap.c:(.text+0x36): undefined reference to `_armv7_tick'
/home/ubuntu/node/out/Release/libopenssl.a(armcap.o): In function `OPENSSL_cpuid_setup':
armcap.c:(.text.startup+0xe0): undefined reference to `_armv7_tick'
armcap.c:(.text.startup+0x10c): undefined reference to `_armv7_neon_probe'
collect2: error: ld returned 1 exit status
make[1]: *** [/home/ubuntu/node/out/Release/node] Error 1
make[1]: Leaving directory `/home/ubuntu/node/out'
make: *** [node] Error 2

有什么办法可以解决这个错误吗?谢谢!

最佳答案

我最近在 Raspberry Pi 上安装了 Node(不要使用 apt-get,即使是在 Raspbian 上也是如此。如果你可以转移到 Raspbian,据我所知 Ubuntu 不喜欢 ARM)。试试这个:

$ cd /home/pi/node/ #or any directory you want
$ wget http://node-arm.herokuapp.com/node_latest_armhf.deb
$ sudo dpkg -i node_latest_armhf.deb

如果您尝试打开 REPL ($ node) 而这给您一个错误,可能是因为它找不到可执行文件 find。在那种情况下,以下命令使它对我有用:

$ hash -r

关于javascript - 为 armv7 编译 node.js v0.10.31 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25540180/

相关文章:

javascript - 如何让网页一次只能访问一次?(JS+HTML)

javascript - 从 React v4 中的事件处理程序重定向 URL

javascript - 与 JS 的包容性 mixin

node.js - 使用 supertest、express 和 mocha 对 api 进行 grunt 测试

linux - 无法在 Linux Mint 15 中编译简单的 c 程序

javascript - 我们如何在控制台中记录通过/失败的 url 检查结果?

javascript - 如何使用 fetch API 发布多个文件?

node.js - 找不到命名空间 'NodeJS' 也有类型 Node

Java 1.7 仍然告诉我 switch 语句中的字符串不兼容

c - 反转数组时,出现以下错误: invalid operands to binary * (have ‘int’ and ‘int *’ ) [closed]