简体   繁体   English

在ARM上构建mongo shell 3.2.x(armv7l / arm64 / aarch64) - 分段错误

[英]Build mongo shell 3.2.x on ARM (armv7l/arm64/aarch64) - segmentation fault

Over the past days I tried a lot to get mongo shell running on Ubuntu 16.04 for ARM64 (aarch64) at Linaro cluster. 在过去的几天里,我尝试了在Linaro集群上运行Ubuntu 16.04 for ARM64(aarch64)的mongo shell。 I am currently working on the next release fork for meteorjs on ARM architecture. 我目前正在为ARM体系结构上的meteorjs开发下一个版本的fork。

TL;DR TL; DR

While the mongod (DB) is running well after build without seen issues yet, it is not possible to get a running mongo shell [even WITHOUT javascript (mozjs) support] after build. 虽然mongod(DB)在构建之后运行良好而没有看到问题,但是在构建之后不可能获得正在运行的mongo shell [甚至没有javascript(mozjs)支持]。

Simplest build: 最简单的构建:

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 that this build will be run on all tested platforms and architectures (Linux on armv7l, aarch64, amd64) without issues during compiling, the results in case of running programs differs. 即使这个版本将在所有经过测试的平台和架构(Linux on armv7l,aarch64,amd64)上运行,在编译期间没有问题,运行程序的结果也不同。

Running mongo command after build on amd64: 在amd64上构建后运行mongo命令:

Just run mongo shell and try to connect to a non existing instance 只需运行mongo shell并尝试连接到非现有实例

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

this will give this output: 这将给出这个输出:

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:5002, 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: 在aarch64 / armv7l上构建后运行mongo命令:

Instead of this, the output on ARMs is just: 而不是这个,ARM上的输出只是:

MongoDB shell version: 3.2.6
Segmentation fault (core dumped)

It seems to me that the TCP connection part might bring up that "SEGMENTATION FAULT" but I can't debug this. 在我看来,TCP连接部分可能会提出“SEGMENTATION FAULT”但我无法调试它。

I would be happy about any help to get this run. 我很高兴有任何帮助来实现这一目标。

Thanks in advance Tom 在此先感谢汤姆

After running a lot more tries and compiles, I have changed the branch for mongodb release and work with r3.3.9. 在运行了更多的尝试和编译之后,我更改了mongodb发布的分支并使用r3.3.9。

While using the same scons parameters it seems to run without any issue. 使用相同的scons参数时,它似乎运行没有任何问题。 I have not yet digged into details and changes in the versions but to have a running release is fine to me 我还没有深入研究版本中的细节和变化,但对我来说运行正常

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

If you issue ./mongo --help the binary still works but the connection has issues dealing with a non existant database. 如果您发出./mongo --help,则二进制文件仍然有效,但连接存在处理不存在的数据库的问题。 Seg Faulting instead of failing gracefully at the non existant database. Seg Faulting而不是在不存在的数据库中优雅地失败。 Due to a null pointer dereference. 由于空指针取消引用。

The offending code is in /src/mongo/client/mongo_uri_connect.cpp 违规代码位于/src/mongo/client/mongo_uri_connect.cpp中

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

It is claimed to be effected from 3.2.8 until 3.3.9 here. 据称这是从3.2.8到3.3.9。

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

On another note if you require sharding add "core" to the scons line. 另外请注意,如果需要分片,请在scons行添加“core”。 For mongod, mongos and mongo to have them all included with the build. 对于mongod,mongos和mongo来说,它们都包含在构建中。

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

A good way around this would be to just point it to an existing database instead of a sample database. 解决这个问题的一个好方法是将其指向现有数据库而不是示例数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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