Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

FreshFalcon

macrumors newbie
Original poster
Jan 4, 2015
1
0
Hi,

As title says, I want mongoDB on my phone. Jailbroken only. The mongoDB site explains the compilation here:
http://www.mongodb.org/about/contributors/tutorial/build-mongodb-from-source/


===============STATUS===============
I have managed to get quite far, DETERMINEDLY; but still hit a roadblock. This is my output from running scons to compile:
scons: done reading SConscript files.
scons: Building targets ...
g++ -o build/darwin/dbg_on/mongo/db/db.o -c -Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -pipe -O0 -fstack-protector -Wno-unused-function -Wno-deprecated-declarations -Wno-missing-braces -mmacosx-version-min=10.7 -DBOOST_ALL_NO_LIB -D_SCONS -DMONGO_EXPOSE_MACROS -DSUPPORT_UTF8 -DMONGO_BYTE_ORDER=1234 -D_FILE_OFFSET_BITS=64 -D_DEBUG -DMONGO_HAVE_HEADER_UNISTD_H -DMONGO_HAVE_EXECINFO_BACKTRACE -Isrc/third_party/s2 -Isrc/third_party/pcre-8.30 -Isrc/third_party/boost -Ibuild/darwin/dbg_on -Isrc src/mongo/db/db.cpp
{standard input}:5812:bad instruction `lock xadd r3,[r1,#0]'
scons: *** [build/darwin/dbg_on/mongo/db/db.o] Error 1
scons: building terminated because of errors.

What does this "bad instruction" mean and how can it be replaced? Is there a way to step through gdb or get extra logging information? ANY HELP GREATLY APPRECIATED


===============STEPS=================
I'll post the steps I've gone through. This will basically serve as a guide to those who want to get as far as I have:

Part 1:
- Download MongoDB source
- Download scons
- Download "bigbosshackertools" from Cydia and install
- Download gcc from Cydia
- Download pico from Cydia
- Download Mterminal from Cydia
- Run "installsdk3" from Mterminal

Part 2:
- Running "gcc" will give you an error: "Illegal Instruction: 4"
- Fix by running
sed -i'' ' s/\x00\x30\x93\xe4/\x00\x30\x93\xe5/g;s/\x00\x30\xd3\xe4/\x00\x30\xd3\xe5/g;' `which gcc`
- Also run this sed command on all files in this folder: /private/var/stash/_.582oOU/gcc/arm-apple-darwin9/4.2.1

Part 3 (Attempt compilation):
- Need to trick a file into compiling for us:
- pico ./src/mongo/platform/atomic_intrinsics.h
- Near the bottom, change
#elif defined(__i386__) || defined(__x86_64__)
- to
#elif defined(__i386__) || defined(__x86_64__) || 1

- Set include/library paths:
export CPATH=/private/var/sdk/usr/include/c++/4.2.1/armv7-apple-darwin9:/private/var/sdk/usr/include/c++/4.2.1:/private/var/sdk/usr/include:.
export LIBRARY_PATH=/private/var/sdk/usr/include/c++/4.2.1:/usr/lib:/private/var/sdk/usr/lib:/private/var/sdk/usr/lib/gcc/arm-apple-darwin9/4.2.1


** TRY COMPILATION **:
scons mongod --disable-warnings-as-errors --propagate-shell-environment --disable-minimum-compiler-version-enforcement --dbg #--libc++
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.