・2017/10/27
Raspberry Piに MongoDB 2.4.10を apt-getで簡単にインストールとセットアップする方法
(ラズパイにドキュメント指向データベース MongoDBをサクッとインストールして Pythonのサンプルを動かす)
Tags: [Raspberry Pi], [電子工作]
● Raspberry Pi 3 Model Bを遂に購入
Raspberry Pi3 Model B RPI2 RPI3
大人気の CPUボードの Raspberry Piに WiFiと Bluetoothが搭載されたモデルが新発売となりました。
以前から Raspberry Pi 2を買おうかどうか迷っていましたが、Raspberry Pi 3 Model Bの発売を機に購入を決意してラズベリアンになる事にしました。
※ ラズパイの OS Raspbianはバージョンが上がる毎に過去の版と OSの内部の作りが変わり、過去に書かれた製作記事(例えば Raspbian Wheezyの時代の記事)がそのままではエラーが出たりして動かない事が有ります。
※ 当方のホームページのラズパイ記事は全て Raspberry Pi 3 Model Bと Raspbian Jessieの組み合わせで動作確認をしております。
(ただし、将来的に新しい Raspbian OSが出た場合に、当方の Raspbian Jessieを基にした内容がそのままでは動かない可能性が有ります。)
※ 2017/08/16から Raspbian OSは Raspbian Jessieから Raspbian Stretchに変わりました。
※ 2019/06/20から Raspbian OSは Raspbian Stretchから Raspbian Busterに変わりました。
Download Raspbian for Raspberry Pi
ちなみに、歴代のバージョンと名称は
Debian | コードネーム | 年月 | 備考 | (参考)Ubuntuでの該当名称 |
Debian 11 | Bullseye | 2021/08/14~ | 2021/11からラズパイにリリース | Focal Fossa 20.04 LTS ? |
Debian 10 | Buster | 2019/06/20~ | 2019/06からラズパイ4対応 | Bionic 18.04 LTS |
Debian 9 | Stretch | 2017/08/16~ | 2018/03からラズパイ3B+対応 | Xenial 16.04 LTS |
Debian 8 | Jessie | 2015~ | 2016/02からラズパイ3対応 | Trusty 14.04 LTS |
Debian 7 | Wheezy | 2013~2016 | | |
Debian 6.0 | Squeeze | 2011~2014 | | |
Debian GNU/Linux 5.0 | Lenny | 2009~2012 | | |
● MongoDB 2.4.10
MongoDBは、オープンソースソフトウェアのドキュメント指向データベースである。
MongoDB - Wikipedia
MongoDB Atlas Database as a Service
mongodb/mongo - The MongoDB Database https://www.mongodb.com/
● Raspberry Pi 3の Raspbian Stretch版で MongoDB
$ uname -a
Linux raspberrypi 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 9.1 (stretch)
Release: 9.1
Codename: stretch
● Raspberry Pi 3に MongoDBをインストールする方法
apt-getで v2.4.10の古いバージョンが簡単にインストールできます。
最新バージョン MongoDB v3.4 Updated Oct 10, 2017
apt-getバージョン MongoDB v2.4.10
Git履歴
・v2.4 Updated Apr 29, 2015
・v2.4.1 Updated Mar 22, 2013
・v2.6 Updated Feb 14, 2017
・v2.6.3 Updated Jun 19, 2014
# お決まりの手順
sudo apt-get update
# apt-get installで MongoDBをインストール
sudo apt-get install mongodb-server
# MongoDBのバージョンを確認する
mongo
# MongoDB shell version: 2.4.10
# Usage: /etc/init.d/mongodb {start|stop|force-stop|restart|force-reload|status}
MongoDBサービスを開始する
sudo service mongodb start
MongoDBサービスを停止する
sudo service mongodb stop
MongoDBの実行例
$ mongo
MongoDB shell version: 2.4.10
connecting to: test
Sat Oct 28 06:29:39.046 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145
exception: connect failed
pi@raspberrypi:~ $ sudo service mongodb start
pi@raspberrypi:~ $ mongo
MongoDB shell version: 2.4.10
connecting to: test
Sat Oct 28 06:29:59.279 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145
exception: connect failed
# mongodbサービスの開始直後は mongoコマンドが失敗する
# mongodbサービスの開始から暫くしてから(10秒程度)の実行は問題無い
pi@raspberrypi:~ $ mongo
MongoDB shell version: 2.4.10
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
Server has startup warnings:
Sat Oct 28 06:29:58.271 [initandlisten]
Sat Oct 28 06:29:58.271 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
Sat Oct 28 06:29:58.271 [initandlisten] ** 32 bit builds are limited to less than 2GB of data (or less with --journal).
Sat Oct 28 06:29:58.271 [initandlisten] ** See http://dochub.mongodb.org/core/32bit
Sat Oct 28 06:29:58.271 [initandlisten]
> help
db.help() help on db methods
db.mycoll.help() help on collection methods
sh.help() sharding helpers
rs.help() replica set helpers
help admin administrative help
help connect connecting to a db help
help keys key shortcuts
help misc misc things to know
help mr mapreduce
show dbs show database names
show collections show collections in current database
show users show users in current database
show profile show most recent system.profile entries with time >= 1ms
show logs show the accessible logger names
show log [name] prints out the last segment of log in memory, 'global' is default
use <db_name> set current database
db.foo.find() list objects in collection foo
db.foo.find( { a : 1 } ) list objects in foo where a == 1
it result of the last line evaluated; use to further iterate
DBQuery.shellBatchSize = x set default number of items to display on shell
exit quit the mongo shell
> show dbs
local 0.03125GB
test (empty)
> use test
switched to db test
> show collections
> show users
> exit
bye
pi@raspberrypi:~ $ sudo service mongodb stop
● Python言語用の MongoDB API PyMongoをインストールする
PyMongo is a Python distribution containing tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
sudo apt-get -y install python-pymongo
# Setting up python-bson (2.7.2-1) ...
# Setting up python-pymongo (2.7.2-1) ...
# Setting up python-gridfs (2.7.2-1) ...
PyMongoのサンプルプログラム
pymongo_sample.py
# MongoDB shell version: 2.4.10
import pymongo
from pymongo import MongoClient
client = MongoClient('localhost', 27017)
db = client.new_my_database0
co = db.new_my_collection
co.insert({"test1234": 1234})
co.insert({"hogehoge": 8585})
for data in co.find():
print data
print "-- end"
python pymongo_sample.py
{u'_id': ObjectId('59f45c0674fece1dd2451aa6'), u'test1234': 1234}
{u'_id': ObjectId('59f45c0674fece1dd2451aa7'), u'hogehoge': 8585}
-- end
※ insert_one関数は 3.0b以降
● Raspberry Pi 3で MongoDBをソースコードからビルドする方法?
Building MongoDB
# Debian/Ubuntu
# To install dependencies on Debian or Ubuntu systems:
sudo apt-get -y install build-essential git
sudo apt-get -y install libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-thread-dev
# To run tests as well, you will need PyMongo:
sudo apt-get -y install python-pymongo
mongodb/mongo-tools - MongoDB command line tools
MongoDB Tools
bsondump - display BSON files in a human-readable format
mongoimport - Convert data from JSON, TSV or CSV and insert them into a collection
mongoexport - Write an existing collection to CSV or JSON format
mongodump/mongorestore - Dump MongoDB backups to disk in .BSON format, or restore them to a live database
mongostat - Monitor live MongoDB servers, replica sets, or sharded clusters
mongofiles - Read, write, delete, or update files in GridFS
mongotop - Monitor read/write activity on a mongo server
mongoreplay - Capture, observe, and replay traffic for MongoDB
# Building Tools
# To build the tools, you need to have Go version 1.3 and up.
# An additional flag, -tags, can be passed to the go build command in order to build the tools with support for SSL and/or SASL. For example:
mkdir bin
go build -o bin/mongoimport mongoimport/main/mongoimport.go # build mongoimport
go build -o bin/mongoimport -tags ssl mongoimport/main/mongoimport.go # build mongoimport with SSL support enabled
go build -o bin/mongoimport -tags "ssl sasl" mongoimport/main/mongoimport.go # build mongoimport with SSL and
● Raspberry Pi 3で MongoDBをソースコードからビルドする方法
Building MongoDB
MongoDB Download Center
Building MongoDB
sudo apt-get update
sudo apt-get -y install build-essential wget git
sudo apt-get -y install libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-thread-dev
sudo apt-get -y install python-pymongo
sudo apt-get -y install scons
# sudo apt-get -y install autoconf automake libtool
gcc --version
python --version
scons --version
pi@raspberrypi:~ $ gcc --version
gcc (Raspbian 6.3.0-18+rpi1) 6.3.0 20170516
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
pi@raspberrypi:~ $ python --version
Python 2.7.13
pi@raspberrypi:~ $ scons --version
SCons by Steven Knight et al.:
script: v2.5.1.rel_2.5.1:3735:9dc6cee5c168[MODIFIED], 2016/11/03 14:02:02, by bdbaddog on mongodog
engine: v2.5.1.rel_2.5.1:3735:9dc6cee5c168[MODIFIED], 2016/11/03 14:02:02, by bdbaddog on mongodog
engine path: ['/usr/lib/scons/SCons']
Copyright (c) 2001 - 2016 The SCons Foundation
# cd
# wget https://fastdl.mongodb.org/src/mongodb-src-r3.4.10.tar.gz
# tar xvf mongodb-src-r3.4.10.tar.gz
# cd mongodb-src-r3.4.10
cd
git clone https://github.com/mongodb/mongo
cd mongo
cd src/third_party/mozjs-45/
chmod +x *.sh
./get-sources.sh
./gen-config.sh arm linux
cd -
scons core --wiredtiger=off --mmapv1=on
●エラー発生
ImportError: No module named typing
Compiling build/opt/third_party/icu4c-57.1/source/common/rbbidata.o
Traceback (most recent call last):
File "buildscripts/idl/idlc.py", line 24, in <module>
import idl.compiler
File "/home/pi/mongo/buildscripts/idl/idl/compiler.py", line 26, in <module>
from typing import Any, List
ImportError: No module named typing
scons: *** [build/opt/mongo/db/commands/parallel_collection_scan.o] CalledProcessError : Command '['/usr/bin/python', 'buildscripts/idl/idlc.py', '--include', 'src', 'src/mongo/db/logical_session_id.idl', '--write-dependencies']' returned non-zero exit status 1
scons: building terminated because of errors.
build/opt/mongo/db/commands/parallel_collection_scan.o failed: CalledProcessError : Command '['/usr/bin/python', 'buildscripts/idl/idlc.py', '--include', 'src', 'src/mongo/db/logical_session_id.idl', '--write-dependencies']' returned non-zero exit status 1
MongoDB failed to build due to ImportError: No module named typing
Build Mongodb From Source May 31 2017
# Installing pip requirements
# macOS / Linux
pip install -r buildscripts/requirements.txt
$ cat buildscripts/requirements.txt
jira == 1.0.10
pyyaml == 3.11
unittest-xml-reporting == 2.1.0
# Linters
yapf == 0.16.0
mypy == 0.501 ; python_version > "3"
# typing in Python 2 for mypy
typing == 3.6.1; python_version < "3"
pylint == 1.6.5
pydocstyle == 1.1.1
# resmoke.py
-r resmokelib/requirements.txt
pip install -r buildscripts/requirements.txt
# Ignoring mypy: markers 'python_version > "3"' don't match your environment
# Ignoring pypiwin32: markers 'sys_platform == "win32"' don't match your environment
scons core --wiredtiger=off --mmapv1=on
●エラー発生
fatal error: config.h: No such file or directory
In file included from src/third_party/gperftools-2.5/src/base/spinlock_internal.cc:44:0:
src/third_party/gperftools-2.5/src/base/spinlock_internal.h:39:20: fatal error: config.h: No such file or directory
#include <config.h>
^
compilation terminated.
scons: *** [build/opt/third_party/gperftools-2.5/src/base/spinlock_internal.o] Error 1
scons: building terminated because of errors.
build/opt/third_party/gperftools-2.5/src/base/spinlock_internal.o failed: Error 1
$ ls -l src/third_party/gperftools-2.5/*/config.h*
-rw-r--r-- 1 pi pi 8954 Oct 28 11:07 src/third_party/gperftools-2.5/build_linux_aarch64/config.h
-rw-r--r-- 1 pi pi 8964 Oct 28 11:07 src/third_party/gperftools-2.5/build_linux_ppc64le/config.h
-rw-r--r-- 1 pi pi 8957 Oct 28 11:07 src/third_party/gperftools-2.5/build_linux_s390x/config.h
-rw-r--r-- 1 pi pi 8972 Oct 28 11:07 src/third_party/gperftools-2.5/build_linux_x86_64/config.h
-rw-r--r-- 1 pi pi 8993 Oct 28 11:07 src/third_party/gperftools-2.5/build_osx_x86_64/config.h
-rw-r--r-- 1 pi pi 8980 Oct 28 11:07 src/third_party/gperftools-2.5/build_solaris_x86_64/config.h
-rw-r--r-- 1 pi pi 9939 Oct 28 11:07 src/third_party/gperftools-2.5/build_windows_x86_64/config.h
-rw-r--r-- 1 pi pi 8440 Oct 28 11:07 src/third_party/gperftools-2.5/src/config.h.in
sudo apt-get -y install autoconf automake libtool
scons core --wiredtiger=off --mmapv1=on
●エラー発生
error: call of overloaded 'appendNumber(mo ngo::StringData&, uint64_t&)' is ambiguous
Compiling build/opt/mongo/util/procparser.o
src/mongo/util/procparser.cpp: In function 'mongo::Status mongo::procparser::par seProcStat(const std::vector<mongo::StringData>&, mongo::StringData, int64_t, mo ngo::BSONObjBuilder*)':
src/mongo/util/procparser.cpp:281:49: error: call of overloaded 'appendNumber(mo ngo::StringData&, uint64_t&)' is ambiguous
builder->appendNumber(key, value);
^
In file included from src/mongo/util/procparser.cpp:51:0:
src/mongo/util/procparser.cpp: In function 'mongo::Status mongo::procparser::par seProcMemInfo(const std::vector<mongo::StringData>&, mongo::StringData, mongo::B SONObjBuilder*)':
src/mongo/util/procparser.cpp:386:59: error: call of overloaded 'appendNumber(st d::__cxx11::basic_string<char>&, uint64_t&)' is ambiguous
builder->appendNumber(keyWithSuffix, value);
^
In file included from src/mongo/util/procparser.cpp:51:0:
src/mongo/bson/bsonobjbuilder.h:336:21: note: candidate: mongo::BSONObjBuilder& mongo::BSONObjBuilder::appendNumber(mongo::StringData, int)
BSONObjBuilder& appendNumber(StringData fieldName, int n) {
^~~~~~~~~~~~
scons: *** [build/opt/mongo/util/procparser.o] Error 1
scons: building terminated because of errors.
build/opt/mongo/util/procparser.o failed: Error 1
Valgrind Home
Valgrind - Wikipedia
Valgrind は、メモリデバッグや、メモリリークの検出、スレッドエラーの検出、プロファイリングなどを行うための仮想機械を利用したソフトウェア開発ツールである。
sudo apt-get -y install valgrind
# valgrind armhf 1:3.7.0-6+rpi5
# --dbg=[on|off] Enable runtime debugging checks
# --spider-monkey-dbg=[on|off]
# Enable SpiderMonkey debug mode
# --opt=[on|off] Enable compile-time optimization
scons core --wiredtiger=off --mmapv1=on --dbg=off --spider-monkey-dbg=off --opt=on
●これでビルドできるかな?
Compiling build/opt/mongo/db/pipeline/parsed_inclusion_projection.o
/tmp/ccd6L4fi.s: Assembler messages:
/tmp/ccd6L4fi.s: Fatal error: can't close build/opt/mongo/db/pipeline/parsed_inclusion_projection.o: No space left on device
scons: *** [build/opt/mongo/db/pipeline/parsed_inclusion_projection.o] Error 1
scons: building terminated because of errors.
IOError: [Errno 28] No space left on device:
File "/usr/lib/scons/SCons/Script/Main.py", line 1361:
_exec_main(parser, values)
File "/usr/lib/scons/SCons/Script/Main.py", line 1324:
_main(parser)
File "/usr/lib/scons/SCons/Script/Main.py", line 1091:
nodes = _build_targets(fs, options, targets, target_top)
File "/usr/lib/scons/SCons/Script/Main.py", line 1298:
jobs.run(postfunc = jobs_postfunc)
File "/usr/lib/scons/SCons/Job.py", line 113:
postfunc()
File "/usr/lib/scons/SCons/Script/Main.py", line 1295:
SCons.SConsign.write()
File "/usr/lib/scons/SCons/SConsign.py", line 109:
syncmethod()
File "/usr/lib/scons/SCons/dblite.py", line 119:
self._pickle_dump(self._dict, f, 1)
build/opt/mongo/db/pipeline/parsed_inclusion_projection.o failed: Error 1
Exception IOError: (28, 'No space left on device') in <bound method dblite.__del__ of <SCons.dblite.dblite object at 0x760fdbb0>> ignored
ディスクフル出ますた! 8GBの microSDカード使用
● 32GBの東芝製の SDカードでリベンジ
仕切りなおしついでにコンパイル時間も計測
free -h
sudo sed -i -e "s/^CONF_SWAPSIZE=.*/CONF_SWAPSIZE=2048/g" /etc/dphys-swapfile
sudo bash -c "echo gpu_mem=16>> /boot/config.txt"
sudo sed -i -e "s/^gpu_mem=.*/gpu_mem=16/g" /boot/config.txt
free -h
# コピペで実行できる全部入り版
sudo apt-get update
# apt-get installも全部入り版
sudo apt-get -y install wget git build-essential libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-thread-dev python-pymongo scons autoconf automake libtool valgrind
# ソース取得
date >~/SOURCE_START
# cd
# wget https://fastdl.mongodb.org/src/mongodb-src-r3.4.10.tar.gz
# tar xvf mongodb-src-r3.4.10.tar.gz
# cd mongodb-src-r3.4.10
cd
git clone https://github.com/mongodb/mongo
cd mongo
date >~/SOURCE_END
# 第三者ライブラリ取得
date >~/3RD_START
cd src/third_party/mozjs-45/
chmod +x *.sh
./get-sources.sh
./gen-config.sh arm linux
cd -
date >~/3RD_END
# gperftoolsで必要? dot形式のグラフデータを esp形式のベクタデータの画像に変換するツール
# sudo apt-get -y install graphviz
# Installing pip requirements
date >~/PIP_START
pip install -r buildscripts/requirements.txt
# *** Run 'pip2 install --user regex' to speed up error code checking
pip2 install --user regex
date >~/PIP_END
# dateコマンドで日時を保存する
date >~/BUILD_START
# timeコマンドでコマンドの実行時間を計測する
time scons core -j 1 --wiredtiger=off --mmapv1=on
# time scons core -j 1 --wiredtiger=off --mmapv1=on --dbg=off --spider-monkey-dbg=off --opt=on --disable-warnings-as-errors
date >~/BUILD_END
# dateコマンドの日時を表示する
cat ~/SOURCE_START
cat ~/3RD_START
cat ~/PIP_START
cat ~/BUILD_START
cat ~/BUILD_END
Compiling build/opt/mongo/db/storage/mmap_v1/logfile.o
/usr/bin/python buildscripts/idl/idlc.py --include src --base_dir build/opt --header build/opt/mongo/db/generic_cursor_gen.h --output build/opt/mongo/db/generic_cursor_gen.cpp src/mongo/db/generic_cursor.idl
/usr/bin/python buildscripts/idl/idlc.py --include src --base_dir build/opt --header build/opt/mongo/db/kill_sessions_gen.h --output build/opt/mongo/db/kill_sessions_gen.cpp src/mongo/db/kill_sessions.idl
Compiling build/opt/mongo/db/stats/storage_stats.o
Compiling build/opt/mongo/db/stats/lock_server_status_section.o
超固まる
scons core -j 1 --wiredtiger=off --mmapv1=on
実行時に出てくるメッセージ、pip2 install --user regexで速くなる。だと?
Checking for extended alignment 64 for concurrency types... (cached) yes
Checking for mongoc_get_major_version() in C library mongoc-1.0... (cached) no
*** Run 'pip2 install --user regex' to speed up error code checking
Checking if __malloc_hook is declared volatile... (cached) yes
scons: done reading SConscript files.
scons: Building targets ...
● 1回目実行時、下記の config.h: No such file or directoryエラーで止まりました。
Compiling build/opt/third_party/gperftools-2.5/src/span.o
src/third_party/gperftools-2.5/src/span.cc:34:20: fatal error: config.h: No such file or directory
#include <config.h>
^
compilation terminated.
scons: *** [build/opt/third_party/gperftools-2.5/src/span.o] Error 1
scons: building terminated because of errors.
build/opt/third_party/gperftools-2.5/src/span.o failed: Error 1
real 76m40.409s
user 70m37.690s
sys 1m42.890s
SOURCE_START = Sat 28 Oct 15:20:13 UTC 2017
3RD_START = Sat 28 Oct 15:44:23 UTC 2017
PIP_START = Sat 28 Oct 15:56:44 UTC 2017
BUILD_START = Sat 28 Oct 15:59:53 UTC 2017
BUILD_END = Sat 28 Oct 17:16:33 UTC 2017
● 2回目実行時、下記の config.h: No such file or directoryエラーで止まりました。
time scons core --wiredtiger=off --mmapv1=on --dbg=off --spider-monkey-dbg=off --opt=on
Compiling build/opt/third_party/gperftools-2.5/src/malloc_extension.o
src/third_party/gperftools-2.5/src/malloc_extension.cc:34:20: fatal error: config.h: No such file or directory
#include <config.h>
^
compilation terminated.
scons: *** [build/opt/third_party/gperftools-2.5/src/malloc_extension.o] Error 1
scons: building terminated because of errors.
build/opt/third_party/gperftools-2.5/src/malloc_extension.o failed: Error 1
● 3回目実行
pip install -r buildscripts/requirements.txt
time scons core --wiredtiger=off --mmapv1=on
# --dbg=off --spider-monkey-dbg=off --opt=onを削除
Compiling build/opt/third_party/gperftools-2.5/src/sampler.o
In file included from src/third_party/gperftools-2.5/src/sampler.cc:36:0:
src/third_party/gperftools-2.5/src/sampler.h:39:20: fatal error: config.h: No such file or directory
#include "config.h"
^
compilation terminated.
scons: *** [build/opt/third_party/gperftools-2.5/src/sampler.o] Error 1
scons: building terminated because of errors.
build/opt/third_party/gperftools-2.5/src/sampler.o failed: Error 1
駄目ですね。。。
● MongoDB scons --help
Build Mongodb From Source May 31 2017
$ scons --help
scons: Reading SConscript files ...
scons: done reading SConscript files.
usage: scons [OPTION] [TARGET] ...
SCons Options:
-b, -d, -e, -m, -S, -t, -w, --environment-overrides, --no-keep-going,
--no-print-directory, --print-directory, --stop, --touch
Ignored for compatibility.
-c, --clean, --remove Remove specified targets and dependencies.
-C DIR, --directory=DIR Change to DIR before doing anything.
--cache-debug=FILE Print CacheDir debug info to FILE.
--cache-disable, --no-cache
Do not retrieve built targets from CacheDir.
--cache-force, --cache-populate
Copy already-built targets into the CacheDir.
--cache-readonly Do not update CacheDir with built targets.
--cache-show Print build actions for files from CacheDir.
--config=MODE Controls Configure subsystem: auto, force,
cache.
-D Search up directory tree for SConstruct,
build all Default() targets.
--debug=TYPE Print various types of debugging information:
count, duplicate, explain, findlibs, includes,
memoizer, memory, objects, pdb, prepare,
presub, stacktrace, time.
--diskcheck=TYPE Enable specific on-disk checks.
--duplicate=DUPLICATE Set the preferred duplication methods. Must be
one of hard-soft-copy, soft-hard-copy,
hard-copy, soft-copy, copy
-f FILE, --file=FILE, --makefile=FILE, --sconstruct=FILE
Read FILE as the top-level SConstruct file.
-h, --help Print defined help message, or this one.
-H, --help-options Print this message and exit.
-i, --ignore-errors Ignore errors from build actions.
-I DIR, --include-dir=DIR Search DIR for imported Python modules.
--implicit-cache Cache implicit dependencies
--implicit-deps-changed Ignore cached implicit dependencies.
--implicit-deps-unchanged Ignore changes in implicit dependencies.
--interact, --interactive Run in interactive mode.
-j N, --jobs=N Allow N jobs at once.
-k, --keep-going Keep going when a target can't be made.
--max-drift=N Set maximum system clock drift to N seconds.
--md5-chunksize=N Set chunk-size for MD5 signature computation to
N kilobytes.
-n, --no-exec, --just-print, --dry-run, --recon
Don't build; just print commands.
--no-site-dir Don't search or use the usual site_scons dir.
--profile=FILE Profile SCons and put results in FILE.
-q, --question Don't build; exit status says if up to date.
-Q Suppress "Reading/Building" progress messages.
--random Build dependencies in random order.
-s, --silent, --quiet Don't print commands.
--site-dir=DIR Use DIR instead of the usual site_scons dir.
--stack-size=N Set the stack size of the threads used to run
jobs to N kilobytes.
--taskmastertrace=FILE Trace Node evaluation to FILE.
--tree=OPTIONS Print a dependency tree in various formats: all,
derived, prune, status.
-u, --up, --search-up Search up directory tree for SConstruct,
build targets at or below current directory.
-U Search up directory tree for SConstruct,
build Default() targets from local SConscript.
-v, --version Print the SCons version number and exit.
--warn=WARNING-SPEC, --warning=WARNING-SPEC
Enable or disable warnings.
-Y REPOSITORY, --repository=REPOSITORY, --srcdir=REPOSITORY
Search REPOSITORY for source and target files.
Local Options:
--prefix=PREFIX installation prefix
--nostrip=NOSTRIP do not strip installed binaries
--build-dir=BUILD-DIR build output directory
--release=RELEASE release build
--lto=LTO enable link time optimizations (experimental,
except with MSVC)
--dynamic-windows=DYNAMIC-WINDOWS
dynamically link on Windows
--endian=[big|little|auto] endianness of target platform
--disable-minimum-compiler-version-enforcement=DISABLE-MINIMUM-COMPILER-VERS
ION-ENFORCEMENT
allow use of unsupported older compilers (NEVER
for production builds)
--ssl=SSL Enable SSL
--mmapv1=[auto|on|off] Enable MMapV1
--wiredtiger=[on|off] Enable wiredtiger
--js-engine=[mozjs|none] JavaScript scripting engine implementation
--server-js=[on|off] Build mongod without JavaScript support
--libc++=LIBC++ use libc++ (experimental, requires clang)
--use-glibcxx-debug=USE-GLIBCXX-DEBUG
Enable the glibc++ debug implementations of the
C++ standard libary
--noshell=NOSHELL don't build shell
--safeshell=SAFESHELL don't let shell scripts run programs (still,
don't run untrusted scripts)
--dbg=[on|off] Enable runtime debugging checks
--spider-monkey-dbg=[on|off]
Enable SpiderMonkey debug mode
--opt=[on|off] Enable compile-time optimization
--sanitize=san1,san2,...sanN
enable selected sanitizers
--llvm-symbolizer=LLVM-SYMBOLIZER
name of (or path to) the LLVM symbolizer
--durableDefaultOn=DURABLEDEFAULTON
have durable default to on
--allocator=[auto|system|tcmalloc]
allocator to use (use "auto" for best choice for
current platform)
--gdbserver=GDBSERVER build in gdb server support
--gcov=GCOV compile with flags for gcov
--smokedbprefix=SMOKEDBPREFIX
prefix to dbpath et al. for smoke tests
--smokeauth=SMOKEAUTH run smoke tests with --auth
--use-sasl-client=USE-SASL-CLIENT
Support SASL authentication in the client
library
--use-system-tcmalloc=USE-SYSTEM-TCMALLOC
use system version of tcmalloc library
--use-system-pcre=USE-SYSTEM-PCRE
use system version of pcre library
--use-system-wiredtiger=USE-SYSTEM-WIREDTIGER
use system version of wiredtiger library
--system-boost-lib-search-suffixes=SYSTEM-BOOST-LIB-SEARCH-SUFFIXES
Comma delimited sequence of boost library
suffixes to search
--use-system-boost=USE-SYSTEM-BOOST
use system version of boost libraries
--use-system-snappy=USE-SYSTEM-SNAPPY
use system version of snappy library
--use-system-valgrind=USE-SYSTEM-VALGRIND
use system version of valgrind library
--use-system-zlib=USE-SYSTEM-ZLIB
use system version of zlib library
--use-system-stemmer=USE-SYSTEM-STEMMER
use system version of stemmer
--use-system-yaml=USE-SYSTEM-YAML
use system version of yaml
--use-system-asio=USE-SYSTEM-ASIO
use system version of ASIO
--use-system-icu=USE-SYSTEM-ICU
use system version of ICU
--use-system-intel_decimal128=USE-SYSTEM-INTEL_DECIMAL128
use system version of intel decimal128
--use-system-all=USE-SYSTEM-ALL
use all system libraries
--use-new-tools=USE-NEW-TOOLS
put new tools in the tarball
--build-mongoreplay=BUILD-MONGOREPLAY
when building with --use-new-tools, build
mongoreplay ( requires pcap dev )
--use-cpu-profiler=USE-CPU-PROFILER
Link against the google-perftools profiler
library
--build-fast-and-loose=[on|off|auto]
looser dependency checking
--disable-warnings-as-errors=DISABLE-WARNINGS-AS-ERRORS
Don't add -Werror to compiler command line
--variables-help=VARIABLES-HELP
Print the help text for SCons variables
--osx-version-min=OSX-VERSION-MIN
minimum OS X version to support
--win-version-min=[win8|ws08r2|win7|win81]
minimum Windows version to support
--cache=CACHE Use an object cache rather than a per-build
variant directory (experimental)
--cache-dir=CACHE-DIR Specify the directory to use for caching objects
if --cache is in use
--cxx-std=CXX-STD Select the C++ langauge standard to build with
--variables-files=VARIABLES-FILES
Specify variables files to load
--link-model=[auto|object|static|dynamic|dynamic-strict]
Select the linking model for the project
--variable-parse-mode=[auto|posix|other]
Select which parsing mode is used to interpret
command line variables
--modules=MODULES Comma-separated list of modules to build. Empty
means none. Default is all.
--runtime-hardening=[on|off]
Enable runtime hardening features (e.g. stack
smash protection)
--use-s390x-crc32=[on|off] Enable CRC32 hardware accelaration on s390x
--git-decider=[on|off] Use git metadata for out-of-date detection for
source files
The following variables may also be set like scons VARIABLE=value
ABIDW: Configures the path to the 'abidw' (a libabigail) utility
default: None
actual: None
ARFLAGS: Sets flags for the archiver
default: None
actual: None
CACHE_SIZE: Maximum size of the cache (in gigabytes)
default: 32
actual: 32
CACHE_PRUNE_TARGET: Maximum percent in-use in cache after pruning
default: 66
actual: 66
CC: Select the C compiler to use
default: None
actual: None
CCFLAGS: Sets flags for the C and C++ compiler
default: None
actual: None
CFLAGS: Sets flags for the C compiler
default: None
actual: None
CPPDEFINES: Sets pre-processor definitions for C and C++
default: []
actual:
CPPPATH: Adds paths to the preprocessor search path
default: None
actual: None
CXX: Select the C++ compiler to use
default: None
actual: None
CXXFLAGS: Sets flags for the C++ compiler
default: None
actual: None
ENV: Sets the environment for subprocesses
default: None
actual: {}
HOST_ARCH: Sets the native architecture of the compiler
default: None
actual:
ICECC: Tell SCons where icecream icecc tool is
default: None
actual: None
ICERUN: Tell SCons where icecream icerun tool is
default: None
actual: None
ICECC_CREATE_ENV: Tell SCons where icecc-create-env tool is
default: buildscripts/icecc_create_env
actual: buildscripts/icecc_create_env
ICECC_SCHEDULER: Tell ICECC where the sceduler daemon is running
default: None
actual: None
LIBPATH: Adds paths to the linker search path
default: None
actual: None
LIBS: Adds extra libraries to link against
default: None
actual: None
LINKFLAGS: Sets flags for the linker
default: None
actual: None
MAXLINELENGTH: Maximum line length before using temp files
default: 4095
actual: 4095
MONGO_BUILDINFO_ENVIRONMENT_DATA: Sets the info returned from the buildInfo command and --version command-line flag
default: (('distmod', '$MONGO_DISTMOD', True, True), ('distarch', '$MONGO_DISTARCH', True, True), ('cc', '$CC_VERSION', True, False), ('ccflags', '$CCFLAGS', True, False), ('cxx', '$CXX_VERSION', True, False), ('cxxflags', '$CXXFLAGS', True, False), ('linkflags', '$LINKFLAGS', True, False), ('target_arch', '$TARGET_ARCH', True, True), ('target_os', '$TARGET_OS', True, False))
actual: distmod True True distarch True True cc True False ccflags True False cxx True False cxxflags True False linkflags True False target_arch True True target_os linux True False
MONGO_DIST_SRC_PREFIX: Sets the prefix for files in the source distribution archive
default: mongodb-src-r${MONGO_VERSION}
actual: mongodb-src-r3.6.0-rc1-45-gdb64381873/
MONGO_DISTARCH: Adds a string representing the target processor architecture to the dist archive
default: $TARGET_ARCH
actual:
MONGO_DISTMOD: Adds a string that will be embedded in the dist archive naming
default:
actual:
MONGO_DISTNAME: Sets the version string to be used in dist archive naming
default: $MONGO_VERSION
actual: 3.6.0-rc1-45-gdb64381873
MONGO_VERSION: Sets the version string for MongoDB
default: 3.6.0-rc1-45-gdb64381873
actual: 3.6.0-rc1-45-gdb64381873
MONGO_GIT_HASH: Sets the githash to store in the MongoDB version information
default: db64381873afebf1532a0fd576499f72da00b703
actual: db64381873afebf1532a0fd576499f72da00b703
MSVC_USE_SCRIPT: Sets the script used to setup Visual Studio.
default: None
actual: None
MSVC_VERSION: Sets the version of Visual Studio to use (e.g. 12.0, 11.0, 10.0)
default: None
actual: None
OBJCOPY: Sets the path to objcopy
default: /usr/bin/objcopy
actual: /usr/bin/objcopy
RPATH: Set the RPATH for dynamic libraries and executables
default: None
actual: None
SHCCFLAGS: Sets flags for the C and C++ compiler when building shared libraries
default: None
actual: None
SHCFLAGS: Sets flags for the C compiler when building shared libraries
default: None
actual: None
SHCXXFLAGS: Sets flags for the C++ compiler when building shared libraries
default: None
actual: None
SHELL: Pick the shell to use when spawning commands
default: None
actual: None
SHLINKFLAGS: Sets flags for the linker when building shared libraries
default: None
actual: None
TARGET_ARCH: Sets the architecture to build for
default: None
actual:
TARGET_OS: Sets the target OS to build for
default: linux
actual: linux
TOOLS: Sets the list of SCons tools to add to the environment
default: ['gcc', 'g++', 'gnulink', 'ar', 'gas']
actual: gcc g++ gnulink ar gas distsrc gziptool idl_tool jsheader mergelib mongo_integrationtest mongo_unittest textfile
VARIANT_DIR: Sets the name (or generator function) for the variant directory
default: <function default_variant_dir_generator at 0x76033df0>
actual: opt
VERBOSE: Control build verbosity (auto, on/off true/false 1/0)
default: auto
actual: auto
WINDOWS_OPENSSL_BIN: Sets the path to the openssl binaries for packaging
default: c:/openssl/bin
actual: c:/openssl/bin
Use scons -H for help about command-line options.
● OrangePiには pipコマンドが無い。
user@orangepipc2:~$ pip
-bash: pip: command not found
# wget https://bootstrap.pypa.io/ez_setup.py -O - | python
wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python
sudo easy_install pip
pip -V
# pip 9.0.1 from /usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg (python 2.7)
pip2 -V
# pip 9.0.1 from /usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg (python 2.7)
sudo pip install -U pip setuptools
# OSError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/setuptools-33.1.1-py2.7.egg'
sudo pip install ansible
# c/_cffi_backend.c:2:20: fatal error: Python.h: No such file or directory
# compilation terminated.
# Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-E1JsOq/pynacl/
sudo apt-get -y install python2.7-dev
sudo pip install --upgrade setuptools
# Requirement already up-to-date: setuptools in /usr/local/lib/python2.7/dist-packages
sudo pip install ansible
# Complete output from command python setup.py egg_info:
# c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
# compilation terminated.
# Traceback (most recent call last):
# File "<string>", line 1, in <module>
# File "/tmp/pip-build-GcYlRu/pynacl/setup.py", line 232, in <module>
# "Programming Language :: Python :: 3.6",
# Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-GcYlRu/pynacl/
sudo apt-get -y install libffi-dev libssl-dev
sudo pip install ansible
build/temp.linux-aarch64-2.7/_openssl.c:30490:1: internal compiler error: Segmentation fault
}
^
aarch64-linux-gnu-gcc: internal compiler error: Segmentation fault (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
error: command 'aarch64-linux-gnu-gcc' failed with exit status 4
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-20ISva/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-d4_PM0-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-20ISva/cryptography/
構成管理ツール Ansible
● OrangePiは sudo pip
date >~/PIP_START
sudo pip install -r buildscripts/requirements.txt
date >~/PIP_END
user@orangepipc2:~/mongo$ scons core -j 1 --wiredtiger=off --mmapv1=on
scons: Reading SConscript files ...
SCons 2.5 or greater required, but you have SCons 2.4.1
トホホ、、、
そう言えば最初に --versionしてたね。
user@orangepipc2:~$ gcc --version
gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
user@orangepipc2:~$ python --version
.Python 2.7.12
user@orangepipc2:~$ scons --version
SCons by Steven Knight et al.:
script: v2.4.1.rel_2.4.1:3453:73fefd3ea0b0, 2015/11/09 03:25:05, by bdbaddog on ubuntu1404-32bit
engine: v2.4.1.rel_2.4.1:3453:73fefd3ea0b0, 2015/11/09 03:25:05, by bdbaddog on ubuntu1404-32bit
engine path: ['/usr/lib/scons/SCons']
Copyright (c) 2001 - 2015 The SCons Foundation
Tags: [Raspberry Pi], [電子工作]
●関連するコンテンツ(この記事を読んだ人は、次の記事も読んでいます)
FWinSdCardImager SDカード イメージ書き込みアプリ、ラズパイの Raspbian OS、Jetson Nanoの Ubuntuの書き込みに便利
ラズパイや Jetson Nano等のワンボードマイコン等への OSイメージの書き込みが簡単にできる
FWinPiFinder ラズベリーパイ IPアドレス発見アプリ。ARPコマンドでラズパイの IPアドレスを探索発見する
Raspberry Piや NVIDIA Jetson Nano等の IPアドレスを MACアドレスの OUI部分を使用して発見する
Raspberry Pi 3系のトラブルであるある第一位の電源トラブル、低電圧警報に関する情報のまとめ
ラズパイ3B系での低電圧警報に関する情報まとめ、コマンドラインやログファイルから低電圧を検知する方法
Raspberry Piで CPUの脆弱性 Spectreと Meltdownの脆弱性をチェックする方法
ラズパイで 2018年初頭に大騒ぎになったスペクターとメルトダウンの CPUの脆弱性をチェックする方法
Raspberry Pi Zero Wを海外通販の Pimoroni等での購入方法、購入できる通販ショップ一覧まとめ
ラズパイゼロW ワイヤレスモデルを海外通販でサクッと簡単に個人輸入で入手。技適通過でも国内販売は常に品切れ
Raspberry Pi 3で安定して使える相性の無い最適な microSDカードの種類のまとめ
ラズパイ3で安定して使える microSDカードを購入する Teamと SanDiskは絶対に買わない
Raspberry Pi 3 Model Bに専用カメラモジュール RaspiCamを接続する方法
ラズパイに専用カメラモジュールを接続して Raspbianで写真の静止画撮影や動画を録画する方法
Raspberry Pi 3の Linuxコンソール上で使用する各種コマンドまとめ
ラズパイの Raspbian OSのコマンドラインで使用する便利コマンド、負荷試験や CPUシリアル番号の確認方法等も
Raspberry Pi 3公式フォーラムの FAQの内容の日本語訳
ラズパイ公式フォーラムの「The Raspberry Pi 3 Model B Q&A thread」の日本語訳
Raspberry Pi 3で GPIO端子の I2C機能を有効化する方法
ラズパイ3の GPIO端子の I2C機能を有効にして各種センサーを繋げる方法まとめ
大人気の CPUボード、Raspberry Pi 3 Model Bで作ってみよう
Raspberry Piの開発環境の構築やタッチパネル付き液晶ディスプレイや各種センサーの使い方まとめ
Raspberry Pi関連はこちらへまとめました
下記以外にも多数のラズパイ関係の記事が有ります。
(I2C制御、GPIO制御、1-Wire制御、シリアル通信、日本語音声合成、日本語音声認識、中国語音声合成、MeCab 形態素解析エンジン、赤外線リモコン制御、秋月 I2C液晶モジュール、KeDei 3.5インチ液晶、HDMI 5インチ液晶、NFCカードリーダ、コマンドライン操作方法等)
Espressif ESP8266 Arduino互換でスケッチが使える ESP-12Eモジュール基板
Espressif ESP8266 ESP-12-E NodeMCU V1 ESP12 CP2102
BangGood通販はドローン以外にも面白い商品がまだまだ有った(電子工作編)
レーザー彫刻機、カラー液晶の DIYオシロ、Arduinoや Raspberry Pi用の小型カラー液晶
[HOME]
|
[BACK]
リンクフリー(連絡不要、ただしトップページ以外は Web構成の変更で移動する場合があります)
Copyright (c)
2017 FREE WING,Y.Sakamoto
Powered by 猫屋敷工房 & HTML Generator
http://www.neko.ne.jp/~freewing/raspberry_pi/raspberry_pi_mongodb/