[Raspberry Pi3] aarch64 MongoDB Compilation and Installation

Source: Internet
Author: User
Tags git clone mongodump rpmbuild

Raspberry Pi3 Official support is 32bit system, use MongoDB when there is 2G database size limit, 32bit of data on the system is basically can not be used, so to install 64bit of openSUSE.

After installing SuSE, found no MongoDB program, so installed the Factory_arm database rpm source, but found that the source inside Mongod is not available, because there is no aarch64 configuration, resulting in no can use the store Engine, will tell you can not find Wiredtiger or MMAPV1 engine, should be aarch64 default compilation is not worthy of the store engine, we need to configure the compilation of one.

The bad thing is to use the virtual machine found after installing a openSUSE, installed the default CROSS-AARH64-GCC after the use of the next toolchain, found that only GCC, but there is no glibc, really do not know what to say, do not know what I did wrong, or openSUSE community more wonderful, at least SuSE is also a commercial version of Ah, lack of things too much, you can only engage a third party toolchain use.

Finally, Linaro's Toolchain was selected.

https://releases.linaro.org/components/toolchain/binaries/5.3-2016.05/aarch64-linux-gnu/ Gcc-linaro-5.3.1-2016.05-x86_64_aarch64-linux-gnu.tar.xz

Since the glibc version of openSUSE is 2.22 and Linaro's glibc version does not appear 2.22, the 2.21 version is chosen.

Extract:

Tar xvf gcc-linaro-5.3.1-2016.05-x86_64_aarch64-linux-gnu.tar.xz

Toolchain will download the code when it's ready.

MongoDB Code Download:

git clone https://github.com/mongodb/mongo.git

Because I want to make a RPM package, so do the following SRC packages, here choose the newer version 3.4.2

tar. GZ--prefix mongodb-org-3.4. 2/--output ~/rpmbuild/sources/mongodb-org-3.4. 2. tar. GZ  R3.  4.2

The default MONGO code is to download binary packge to do rpm, but we want to start from soure, need to modify the Mongodb-org.spec file under rpm

The main changes are:

1. Added the build command, which is configured with the Aarch64 compiler method, Wiredtiger and MMAPV1 store engine are open,-j job number according to their own configuration adjustment

2. Modified the install path, and the results are strip (the default scons strip not found, do not know how to do)

3. Removed some tools that were not

Patches are as follows:

Diff--git A/rpm/mongodb-org.spec B/rpm/mongodb-org.specindex 66ff4ca.  C548e79 100644---a/rpm/mongodb-org.spec+++ b/rpm/mongodb-org.spec@@ -164,10 +164,18 @@ This package provides the MongoDB Static library and header files needed to Deve%setup%build+toolchain=toolchain path +scons--release--dbg=off Mongo_versio n=3.4.2 cc= $TOOLCHAIN/aarch64-linux-gnu-gcc cxx= $TOOLCHAIN/aarch64-linux-gnu-g++ target_arch=aarch64--mmapv1=on-- Wiredtiger=on--disable-warnings-as-errors-j6 cflags= "-march=armv8-a+crc-mtune=generic" core tools VERBOSE=on% Install-mkdir-p $RPM _build_root/usr-cp-rv bin $RPM _build_root/usr+toolchain=toolchain path +scons--release--dbg=off mongo_version=3.4.2 cc= $TOOLCHAIN/aarch64-linux-gnu-gcc cxx= $TOOLCHAIN/aarch64-linux-gnu-g++ target_arch=aarch64- -mmapv1=on--wiredtiger=on--disable-warnings-as-errors-j6 cflags= "-march=armv8-a+crc-mtune=generic" install+$ Toolchain/aarch64-linux-gnu-strip build/install/bin/mongod+ $TOOLCHAIN/aarch64-linux-gnu-strip build/install/bin/ Mongo+ $TOOLCHAIN/aarch64-linux-gnu-strip build/install/bin/mongos+ $TOOLCHAIN/aarch64-linux-gnu-strip build/install /bin/mongoperf+mkdir-p $RPM _build_root/usr/bin+cp-rv build/install/bin $RPM _build_root/usr/mkdir-p $RPM _build_root /usr/share/man/man1 cp debian/*.1 $RPM _build_root/usr/share/man/man1/# Fixme:remove This RM when Mongosniff was back in T He package@@ -222,10 +230,8 @@ fi%attr (0755,mongod,mongod)%dir/var/log/mongodb%attr (0755,mongod,mongod)%dir/var/run /mongodb%attr (0640,mongod,mongod)%config (noreplace)%verify (not MD5 size mtime)/var/log/mongodb/mongod.log-%doc Gnu-agpl-3.0+%doc gnu-agpl-3.0.txt%doc readme-%doc third-party-notices-%doc mpl-2@@ -243,16 +249,7 @@ fi%defattr (-, root,root,-) #%doc README gnu-agpl-3.0.txt-%{_bindir}/bsondump-%{_bindir}/mongodump-%{_bindir}/mongoexport-%{_ Bindir}/mongofiles-%{_bindir}/mongoimport-%{_bindir}/mongooplog%{_bindir}/mongoperf-%{_bindir}/mongorestore-%{ _bindir}/mongotop-%{_bindir}/mongostat%{_mandir}/man1/bsondump.1*%{_mandIr}/man1/mongodump.1* 

Then compile the code.

Rpmbuild  -ba--target=aarch64  -D "dynamic_version r3.4.2""dynamic _release r3.4.2"  "_arch aarch64" rpm/mongodb-org.spec

Ps.

Because MongoDB uses a lot of templates, compile time needs a considerable amount of memory, to have psychological preparation: P

Once the compilation is complete, the RPM package can be used directly to install the

[Raspberry Pi3] aarch64 MongoDB Compilation and Installation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.