我无法在树莓pi 3开发板的Raspbian操作系统上编译iotivity节点源。但是,我可以在我的笔记本电脑上用Ubuntu16.04LTS操作系统成功地编译同一个源代码。
我在屏幕上看到了下面的错误信息。
有人知道如何解决这个问题吗?谢谢。
(请参考我的要点中的完整日志。iotivity-node fail log

> COPY Release/nothing.node
  CXX(target) Release/obj.target/iotivity/generated/constants.o
virtual memory exhausted: Cannot allocate memory
iotivity.target.mk:131: recipe for target
 elease/obj.target/iotivity/generated/constants.o' failed
make: *** [Release/obj.target/iotivity/generated/constants.o] Error 1
make: Leaving directory '/home/pi/workspace/iotivity-node/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit
 (/home/pi/.nvm/versions/node/v9.5.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:160:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit
(internal/child_process.js:209:12)
gyp ERR! System Linux 4.9.59-v7+
gyp ERR! command "/home/pi/.nvm/versions/node/v9.5.0/bin/node"
 "/home/pi/.nvm/versions/node/v9.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/workspace/iotivity-node
gyp ERR! node -v v9.5.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional  logging output above.

最佳答案

我想你需要给你的圆周率增加更多的记忆:
查看关于在ARM上构建iotivity的帖子:
https://blogs.s-osg.org/building-iotivity-arm-artik-devices/
应该很容易适应基于debian的发行版,
例如通过NFS
file="$mnt/swap.tmp"dd if=/dev/zero of=$file bs=1k count=2097152 # 2GBlosetup /dev/loop0 "$file"mkswap /dev/loop0swapon /dev/loop0

09-26 23:00