node.js - 构建 Node.js 出现错误 : Node. js 配置错误:找不到可接受的 C 编译器

标签 node.js compiler-construction arm raspberry-pi cross-compiling

在尝试使用 Ubuntu 14.04 系统交叉编译 Node.js v0.10.30 for ARM (Raspberry Pi B) 时,我遇到错误消息:

Node.js configure error: No acceptable C compiler found!

        Please make sure you have a C compiler installed on your system and/or
        consider adjusting the CC environment variable if you installed
        it in a non-standard prefix.

如何解决这个问题并成功编译 node.js?

在全新的 Ubuntu 14.04 x64 安装上使用的命令:

sudo apt-get install gcc g++ git

git clone git://github.com/joyent/node.git
cd node
git checkout v0.10.30-release

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

./configure --without-snapshot --dest-cpu=arm --dest-os=linux

最佳答案

尝试在我的 Node 目录中运行 ./configure 后,我也遇到了这个错误。以下是我运行的命令,让 Node 在 ubuntu 服务器上为我工作:

  1. cd ..(回到创建 Node 目录的目录)
  2. sudo apt-get install build-essential
  3. cd Node/
  4. ./配置
  5. make(对于像我这样的新手来说,这一步需要一段时间才能完成,所以如果您遇到这种情况,请不要 panic )
  6. sudo 进行安装

然后尝试从它的目录运行你的 Node 文件。顺便说一句,我在这样做时也遇到了以下错误:

错误:ENOENT,stat '/home/ubuntu/local' 出错时( native )

为了解决这个问题,我运行了:sudo npm install -g npm

关于node.js - 构建 Node.js 出现错误 : Node. js 配置错误:找不到可接受的 C 编译器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25170492/

相关文章:

javascript - Node.js 和线程

java - 在 Mac OS X 中的命令行上编译 Java 代码

c - 在 C (GNU/Linux) 中运行动态生成的程序集

c - 在汇编 x86 或 ARM 中引发软中断

linux-kernel - 在/init 之后退出代码 = 0x00000004 的内核 panic

assembly - 了解 ARM 汇编代码

javascript - Electron:要求使程序崩溃

html - 通过 postcss uncss 插件流式传输 css 以最大限度地减少缓冲区使用?

node.js - Node.js 中的 XML 到 PEM

C++ 编译器对齐 - 仅字符无填充