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

I tried to run this node script on an x64 machine and it seems to be working fine.

However, the same script reports a bus error when running on a Raspberry Pi. It gives the error [6047.715610] Unhandled Fault: alignment exception error with an error message on the next line as a bus error. It seems that the error is related to MongoClient.connect ().

The script uses MongoClient and GridStore from the mongodb module. Also, I tried to reinstall from this repository (which seems to be doing gyp-rebuild ) and it does not work.

Is there any compilation option that needs to be set?

+4
source share
1 answer

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

The error appears to be caused by a compilation option that is not supported by ARM devices. Just in case, someone is interested:

  • Git repository clone: https://github.com/mongodb/node-mongodb-native
  • Open ./node-mongodb-native/node_modules/bson/ext/bson.h
  • Change #define USE_MISALIGNED_MEMORY_ACCESS from 1 to 0
  • run a node-gyp rebuild to recompile the library.

It worked for me.

+3
source

Source: https://habr.com/ru/post/1482681/


All Articles