Build mongo shell 3.2.x on ARM (armv7l / arm64 / aarch64) - segmentation error

In recent days, I tried hard to get the mongo shell on Ubuntu 16.04 for ARM64 (aarch64) in a Linaro cluster. I am currently working on the next version of fork for meteorites in the ARM architecture.

TL DR

While mongod (DB) works after the build without visible problems, it is not possible to create a working mongo shell [even WITHOUT javascript (mozjs) support] after build.

The simplest assembly:

  mkdir -p / tmp / mongo-build

 cd / tmp / mongo-build

 git clone --branch "r3.2.6" --depth 1 https://github.com/mongodb/mongo.git

 cd mongo

 scons --disable-warnings-as-errors --prefix = / tmp / mongo-build / mongo --js-engine = mozjs mongo mongod

Even if this assembly is launched on all tested platforms and architectures (Linux on armv7l, aarch64, amd64) without problems during compilation, the results are different when running programs.

Running the mongo command after building on amd64:

Just run the mongo shell and try connecting to a non-existing instance

  ./mongo mongodb: // localhost: 5002 / sample

this will give this result:

  MongoDB shell version: 3.2.6
 connecting to: mongodb: // localhost: 5002 / sample
 2016-07-05T14: 10: 23.772 + 0200 W NETWORK [thread1] Failed to connect to 127.0.0.1β–Ί002, reason: errno: 111 Connection refused
 2016-07-05T14: 10: 23.772 + 0200 E QUERY [thread1] Error: couldn't connect to server localhost: 5002, connection attempt failed:
 connect@src /mongo/shell/mongo.js:223:14
 @ (connect): 1: 6

 exception: connect failed

Running mongo command after build on aarch64 / armv7l:

Instead, the output to ARM is as follows:

  MongoDB shell version: 3.2.6
 Segmentation fault (core dumped)

It seems to me that part of the TCP connection may cause this "SEGMENTAL FAULT", but I cannot debug it.

I would welcome any help to complete this run.

Thanks in advance Tom

+5
source share
2 answers

After starting more attempts and compiling, I changed the branch to release mongodb and work with r3.3.9.

Using the same scons options, it seems to work without any problems. I have not yet delved into the details and changes in versions, but for me there was a free version

  mkdir -p / tmp / mongo-build

 cd / tmp / mongo-build

 git clone --branch "r3.3.9" --depth 1 https://github.com/mongodb/mongo.git

 cd mongo

 scons --disable-warnings-as-errors --prefix = / tmp / mongo-build / mongo --js-engine = mozjs mongo mongod
+3
source

If you give out. / mongo --help, the binary still works, but there are problems with the connection to a non-existent database. Seg Faulting instead of gracefully failing in a nonexistent database. Due to dereferencing of a null pointer.

The violation code is in / src / mongo / client / mongo _uri_connect.cpp

if (!_user.empty()) { ret->auth(_makeAuthObjFromOptions(ret->getMaxWireVersion())); } return ret; } 

It is alleged that it is carried out from 3.2.8 to 3.3.9.

https://jira.mongodb.org/browse/SERVER-23126

In another note, if you need a shape, add a β€œcore” to the line of accounts. For mango, mongo and mongo so that they are all included in the assembly.

 scons --disable-warnings-as-errors --prefix=/tmp/mongo-build/mongo --js-engine=mozjs core 

A good way to do this would be to simply point it to an existing database instead of the sample database.

+1
source

All Articles