本文介绍了Raspberry Pi ARM的Mongodb MongoClient.connect()上的总线错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已尝试在x64计算机上执行此节点脚本,并且看起来工作正常.

I have tried executing this node script on an x64 computer, and it appears to work fine.

但是,相同的脚本在Raspberry Pi上运行时报告总线错误.它给出[6047.715610]未处理的错误:对齐异常错误,并在下一行报告此错误,作为总线错误.看来该错误源于MongoClient.connect().

However, the same script reports a bus error when run on the Raspberry Pi. It gives a [6047.715610] Unhandled Fault: alignment exception error, with the error reported on the next line, as a Bus error. It appears that the error stems from MongoClient.connect().

该脚本利用了mongodb模块中的MongoClient和GridStore.另外,我尝试从此存储库重新安装(似乎执行gyp-rebuild),但失败.

The script utilizes MongoClient and GridStore from the mongodb module. In addition, I have attempted a re-installation from this repository (which appears to do a gyp-rebuild), and it fails.

是否应该设置任何编译选项?

Is there any compilation option that should be set?

推荐答案

我设法通过从github中提取存储库,编辑bson.h并对其执行node-gyp rebuild来解决该错误.

I managed to fix the error by pulling the repo from github, editing bson.h, and doing a node-gyp rebuild on it.

显然,该错误是由ARM设备不支持的编译选项引起的. 以防万一有人感兴趣:

Apparently, the error is caused by a compilation option which is not supported by ARM devices. Just in case anyone is interested:

  1. 此处的Git克隆存储库:https://github.com/mongodb/node-mongodb-native
  2. 打开./node-mongodb-native/node_modules/bson/ext/bson.h
  3. #define USE_MISALIGNED_MEMORY_ACCESS1更改为0
  4. 执行node-gyp rebuild重新编译库.
  1. Git clone repository here: https://github.com/mongodb/node-mongodb-native
  2. Open ./node-mongodb-native/node_modules/bson/ext/bson.h
  3. Change #define USE_MISALIGNED_MEMORY_ACCESS from 1 to 0
  4. do a node-gyp rebuild to recompile the library.

这对我有用.

这篇关于Raspberry Pi ARM的Mongodb MongoClient.connect()上的总线错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-27 17:24