6

i have been trying for 2 days to get MongoDB installed on my raspberry pi but i am unable to get it to work.

i know that the official mongo isn't for for ARM, but there is a fork i found at:

https://github.com/skrabban/mongo-nonx86

but it fails top build. i have seen this repose referenced in several sites, but it doesn't seem to be working for me and i can figure out why it doesn't compile.

i followed the instructions on: http://c-mobberley.com/wordpress/2013/10/14/raspberry-pi-mongodb-installation-the-working-guide/

but i get a compilation error when running scons. the error i get is:

sudo scons .
scons: Reading SConscript files ...
scons version: 2.3.1
python version: 2 7 9 'final' 0
Checking whether the C++ compiler works... (cached) yes
Checking for C header file unistd.h... (cached) yes
Checking whether clock_gettime is declared... (cached) yes
Checking for C library rt... (cached) yes
Checking for C++ header file execinfo.h... (cached) yes
Checking whether backtrace is declared... (cached) yes
Checking whether backtrace_symbols is declared... (cached) yes
Checking for C library pcap... (cached) no
Checking for C library wpcap... (cached) no
Checking for __sync_fetch_and_add ...(cached) yes
Checking if alignment is important ...(cached) yes
Checking for inline __builtin_bswap32 ...(cached) yes
Checking for inline __builtin_bswap64 ...(cached) yes
Checking if system is big endian (for snappy) ...(cached) no
Checking if -fstack-protector works ...(cached) yes
scons: done reading SConscript files.
scons: Building targets ...
g++ -o build/linux2/normal/client_build/mongo/client/examples/authTest.o -c -Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -Wstrict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Wcast-align -Winvalid-pch -O3 -DBOOST_ALL_NO_LIB -D_SCONS -DSUPPORT_UTF8 -D_FILE_OFFSET_BITS=64 -DJS_C_STRINGS_ARE_UTF8 -DMONGO_HAVE_HEADER_UNISTD_H -DMONGO_HAVE_EXECINFO_BACKTRACE -DHAVE_SYNC_FETCH_AND_ADD -DALIGNMENT_IMPORTANT -DHAVE_BSWAP32 -DHAVE_BSWAP64 -Ibuild/linux2/normal/third_party/boost -Isrc/third_party/boost -Ibuild/linux2/normal/third_party/pcre-8.30 -Isrc/third_party/pcre-8.30 -Ibuild/linux2/normal -Isrc -Ibuild/linux2/normal/mongo -Isrc/mongo src/mongo/client/examples/authTest.cpp
In file included from src/third_party/boost/boost/bind/bind.hpp:29:0,
                 from src/third_party/boost/boost/bind.hpp:22,
                 from src/mongo/pch.h:51,
                 from src/mongo/client/dbclient.h:30,
                 from src/mongo/client/examples/authTest.cpp:21:
src/third_party/boost/boost/bind/arg.hpp: In constructor 'boost::arg<I>::arg(const T&)':
src/third_party/boost/boost/bind/arg.hpp:37:22: warning: typedef 'T_must_be_placeholder' locally defined but not used [-Wunused-local-typedefs]
         typedef char T_must_be_placeholder[ I == is_placeholder<T>::value? 1: -1 ];
                      ^
In file included from /usr/include/pthread.h:24:0,
                 from /usr/include/arm-linux-gnueabihf/c++/4.9/bits/gthr-default.h:35,
                 from /usr/include/arm-linux-gnueabihf/c++/4.9/bits/gthr.h:148,
                 from /usr/include/c++/4.9/ext/atomicity.h:35,
                 from /usr/include/c++/4.9/bits/ios_base.h:39,
                 from /usr/include/c++/4.9/ios:42,
                 from /usr/include/c++/4.9/ostream:38,
                 from /usr/include/c++/4.9/iostream:39,
                 from src/mongo/client/examples/authTest.cpp:18:
src/third_party/boost/boost/thread/xtime.hpp: At global scope:
src/third_party/boost/boost/thread/xtime.hpp:23:5: error: expected identifier before numeric constant
     TIME_UTC=1
     ^
src/third_party/boost/boost/thread/xtime.hpp:23:5: error: expected '}' before numeric constant
src/third_party/boost/boost/thread/xtime.hpp:23:5: error: expected unqualified-id before numeric constant
In file included from src/third_party/boost/boost/thread/pthread/mutex.hpp:14:0,
                 from src/third_party/boost/boost/thread/mutex.hpp:16,
                 from src/third_party/boost/boost/thread/pthread/thread_data.hpp:12,
                 from src/third_party/boost/boost/thread/pthread/condition_variable.hpp:10,
                 from src/third_party/boost/boost/thread/condition_variable.hpp:16,
                 from src/mongo/util/goodies.h:22,
                 from src/mongo/pch.h:78,
                 from src/mongo/client/dbclient.h:30,
                 from src/mongo/client/examples/authTest.cpp:21:
src/third_party/boost/boost/thread/xtime.hpp:38:13: error: 'int_fast64_t' does not name a type
     typedef int_fast64_t xtime_sec_t; //INT_FAST64_MIN <= sec <= INT_FAST64_MAX
             ^
src/third_party/boost/boost/thread/xtime.hpp:41:13: error: 'int_fast32_t' does not name a type
     typedef int_fast32_t xtime_nsec_t; //0 <= xtime.nsec < NANOSECONDS_PER_SECOND
             ^
src/third_party/boost/boost/thread/xtime.hpp:43:5: error: 'xtime_sec_t' does not name a type
     xtime_sec_t sec;
     ^
src/third_party/boost/boost/thread/xtime.hpp:44:5: error: 'xtime_nsec_t' does not name a type
     xtime_nsec_t nsec;
     ^
src/third_party/boost/boost/thread/xtime.hpp:46:14: error: expected type-specifier before 'system_time'
     operator system_time() const
              ^
src/third_party/boost/boost/thread/xtime.hpp: In function 'xtime get_xtime(const system_time&)':
src/third_party/boost/boost/thread/xtime.hpp:64:9: error: 'struct xtime' has no member named 'sec'
     res.sec=static_cast<xtime::xtime_sec_t>(time_since_epoch.total_seconds());
         ^
src/third_party/boost/boost/thread/xtime.hpp:64:32: error: 'xtime_sec_t' in 'struct xtime' does not name a type
     res.sec=static_cast<xtime::xtime_sec_t>(time_since_epoch.total_seconds());
                                ^
src/third_party/boost/boost/thread/xtime.hpp:65:9: error: 'struct xtime' has no member named 'nsec'
     res.nsec=static_cast<xtime::xtime_nsec_t>(time_since_epoch.fractional_seconds()*(1000000000/time_since_epoch.ticks_per_second()));
         ^
src/third_party/boost/boost/thread/xtime.hpp:65:33: error: 'xtime_nsec_t' in 'struct xtime' does not name a type
     res.nsec=static_cast<xtime::xtime_nsec_t>(time_since_epoch.fractional_seconds()*(1000000000/time_since_epoch.ticks_per_second()));
                                 ^
In file included from src/third_party/boost/boost/thread/pthread/mutex.hpp:14:0,
                 from src/third_party/boost/boost/thread/mutex.hpp:16,
                 from src/third_party/boost/boost/thread/pthread/thread_data.hpp:12,
                 from src/third_party/boost/boost/thread/pthread/condition_variable.hpp:10,
                 from src/third_party/boost/boost/thread/condition_variable.hpp:16,
                 from src/mongo/util/goodies.h:22,
                 from src/mongo/pch.h:78,
                 from src/mongo/client/dbclient.h:30,
                 from src/mongo/client/examples/authTest.cpp:21:
src/third_party/boost/boost/thread/xtime.hpp: In function 'int xtime_get(xtime*, int)':
src/third_party/boost/boost/thread/xtime.hpp:73:40: error: 'get_system_time' was not declared in this scope
         *xtp=get_xtime(get_system_time());
                                        ^
src/third_party/boost/boost/thread/xtime.hpp:73:40: note: suggested alternative:
In file included from src/third_party/boost/boost/thread/pthread/timespec.hpp:9:0,
                 from src/third_party/boost/boost/thread/pthread/condition_variable.hpp:8,
                 from src/third_party/boost/boost/thread/condition_variable.hpp:16,
                 from src/mongo/util/goodies.h:22,
                 from src/mongo/pch.h:78,
                 from src/mongo/client/dbclient.h:30,
                 from src/mongo/client/examples/authTest.cpp:21:
src/third_party/boost/boost/thread/thread_time.hpp:19:24: note:   'boost::get_system_time'
     inline system_time get_system_time()
                        ^
In file included from src/third_party/boost/boost/thread/pthread/mutex.hpp:14:0,
                 from src/third_party/boost/boost/thread/mutex.hpp:16,
                 from src/third_party/boost/boost/thread/pthread/thread_data.hpp:12,
                 from src/third_party/boost/boost/thread/pthread/condition_variable.hpp:10,
                 from src/third_party/boost/boost/thread/condition_variable.hpp:16,
                 from src/mongo/util/goodies.h:22,
                 from src/mongo/pch.h:78,
                 from src/mongo/client/dbclient.h:30,
                 from src/mongo/client/examples/authTest.cpp:21:
src/third_party/boost/boost/thread/xtime.hpp: In function 'int xtime_cmp(const xtime&, const xtime&)':
src/third_party/boost/boost/thread/xtime.hpp:82:13: error: 'const struct xtime' has no member named 'sec'
     if (xt1.sec == xt2.sec)
             ^
src/third_party/boost/boost/thread/xtime.hpp:82:24: error: 'const struct xtime' has no member named 'sec'
     if (xt1.sec == xt2.sec)
                        ^
src/third_party/boost/boost/thread/xtime.hpp:83:26: error: 'const struct xtime' has no member named 'nsec'
         return (int)(xt1.nsec - xt2.nsec);
                          ^
src/third_party/boost/boost/thread/xtime.hpp:83:37: error: 'const struct xtime' has no member named 'nsec'
         return (int)(xt1.nsec - xt2.nsec);
                                     ^
src/third_party/boost/boost/thread/xtime.hpp:85:21: error: 'const struct xtime' has no member named 'sec'
         return (xt1.sec > xt2.sec) ? 1 : -1;
                     ^
src/third_party/boost/boost/thread/xtime.hpp:85:31: error: 'const struct xtime' has no member named 'sec'
         return (xt1.sec > xt2.sec) ? 1 : -1;
                               ^
src/third_party/boost/boost/thread/xtime.hpp: At global scope:
src/third_party/boost/boost/thread/xtime.hpp:88:1: error: expected declaration before '}' token
 } // namespace boost
 ^
scons: *** [build/linux2/normal/client_build/mongo/client/examples/authTest.o] Error 1
scons: building terminated because of errors.

i have tried googling this error but i cannot find anything about it, so either i am making the wrong google search, or nobody else is having this issue.

does anyone have any ideas why i might be getting this error? is there another way to get mongo installed onto the RPi?

any help is appriciated.

7
  • It would probably be a pretty obscure error. This is probably a tough one to solve if you can't read C++, unfortunately.
    – goldilocks
    Dec 18, 2015 at 13:07
  • Did you check raspberrypi.stackexchange.com/questions/34484/… and github.com/RickP/mongopi ? Sounds promising. Dec 18, 2015 at 13:23
  • 1
    What was wrong with sudo apt-get install mongodb?
    – joan
    Dec 18, 2015 at 13:54
  • 1
    apt-get install mongoldb seems to be working... thanks. i though it wasn't in the repo, especially because the official mongo site didn't seem to supply any version compatible with the RPi on their site.
    – X0r0N
    Dec 18, 2015 at 14:14
  • 1
    @X0r0N If you do an apt-cache search mongodb you'll see threre are a lot of packages which support mongo.
    – joan
    Dec 18, 2015 at 14:19

3 Answers 3

2

MongoDB Is In The Repositories

You just need to install MongoDB, right?
It is already compiled and available in the Raspbian repositories:

pi@raspberrypi:~ $ apt-cache search mongodb
...
mongodb - object/document-oriented database (metapackage)
mongodb-clients - object/document-oriented database (client apps)
mongodb-dev - object/document-oriented database (development)
mongodb-server - object/document-oriented database (server package)
...

Is this the version you need?

pi@raspberrypi:~ $ apt-cache show mongodb-server
Package: mongodb-server
Source: mongodb
Version: 1:2.4.10-5
Architecture: armhf
Maintainer: Laszlo Boszormenyi (GCS) <[email protected]>
Installed-Size: 13195
Depends: adduser, mongodb-clients, init-system-helpers (>= 1.18~), libboost-filesystem1.55.0, libboost-program-options1.55.0, libboost-system1.55.0, libboost-thread1.55.0, libc6 (>= 2.4), libgcc1 (>= 1:4.4.0), libpcre3 (>= 1:8.35), libpcrecpp0 (>= 7.7), libsnappy1, libssl1.0.0 (>= 1.0.0), libstdc++6 (>= 4.9), libv8-3.14.5
Replaces: mongodb (<= 1:1.4.2-2)
Homepage: http://www.mongodb.org
Priority: optional
Section: database
Filename: pool/main/m/mongodb/mongodb-server_2.4.10-5_armhf.deb
Size: 3249874
SHA256: 9e8eb3c5efc5300f78e311d7a14fe7d18ae278bf369907840f8c79f554165e22
SHA1: af8957899c73c270a9355074c25c9f4732b243ce
MD5sum: 506a5cb5e033d127ff526bfec138d4e2
Description: object/document-oriented database (server package)
 MongoDB is a high-performance, open source, schema-free
 document-oriented data store that's easy to deploy, manage
 and use. It's network accessible, written in C++ and offers
 the following features:
 .
    * Collection oriented storage - easy storage of object-style data
    * Full index support, including on inner objects
    * Query profiling
    * Replication and fail-over support
    * Efficient storage of binary data including large objects (e.g. videos)
    * Auto-sharding for cloud-level scalability
 .
 High performance, scalability, and reasonable depth of
 functionality are the goals for the project.
 .
 This package contains the server itself  (mongod) and the sharding
 server/load-balancer (mongos).
Description-md5: 98d13f2d6bef8dfdd52809bf47c48138

All you gotta do is install it:

pi@raspberrypi:~ $ sudo apt-get install mongodb
1

Try using this guide - http://andyfelong.com/2015/02/mongodb-on-the-raspberry-pi-2/ Worked for me flawlessly.

0

The problem you're having is with the Boost Libraries. The error is specifying that struct members don't exist, which is usually an indicator that something is using the wrong version.

I would suggest making sure you're using the correct version of gcc, and that whatever configuration you've done matches the RPi.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.