用于 Raspberry Pi ARM 的 Mongodb MongoClient.connect() 上的总线错误 [英] Bus Error on Mongodb MongoClient.connect() for Raspberry Pi ARM

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

问题描述

我尝试在 x64 计算机上执行此节点脚本,它似乎工作正常.

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

然而,同样的脚本在树莓派上运行时会报告总线错误.它给出了 [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 中提取 repo、编辑 bson.h 并执行 node- 来修复错误gyp 重建就可以了.

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 重建 以重新编译库.
  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() 上的总线错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆