简体   繁体   中英

Bus Error on Mongodb MongoClient.connect() for Raspberry Pi ARM

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

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().

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?

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

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

  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.

This worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM