|
To set up your OS X computer for MongoDB development: PrerequisitesXcodeAvailable in the App Store. You only need to get the command line tools, if you don't want to install the whole IDE. SConsSCons is the build tool used to compile mongo binaries. It is available from http://www.scons.org. If you have easy_install or pip already installed, you can use them to install scons. easy_install scons pip install scons gitAn installer package is available from http://git-scm.com/ Building
Older Versions of MongoUpgrading to Snow LeopardIf you have installed Snow Leopard, the builds will be 64-bit -- so if moving from a previous OS release, a bit more setup may be required than one might first expect. SetupSourcesThe mongodb source is on github. To get sources first download the git client and install it.
Prerequisites
Package Manager Setup
Manual SetupInstall Apple developer toolsInstall libraries (32-bit option)
Install libraries (64-bit option)(The 64-bit libraries will be installed in /usr/64/{include,lib}.)
Apply the following patch: diff -u -r js/src/config/Darwin.mk js-1.7.0/src/config/Darwin.mk --- js/src/config/Darwin.mk 2007-02-05 11:24:49.000000000 -0500 +++ js-1.7.0/src/config/Darwin.mk 2009-05-11 10:18:37.000000000 -0400 @@ -43,7 +43,7 @@ # Just ripped from Linux config # -CC = cc +CC = cc -m64 CCC = g++ CFLAGS += -Wall -Wno-format OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DDARWIN @@ -56,9 +56,9 @@ #.c.o: # $(CC) -c -MD $*.d $(CFLAGS) $< -CPU_ARCH = $(shell uname -m) +CPU_ARCH = "X86_64" ifeq (86,$(findstring 86,$(CPU_ARCH))) -CPU_ARCH = x86 +CPU_ARCH = x86_64 OS_CFLAGS+= -DX86_LINUX endif GFX_ARCH = x @@ -81,3 +81,14 @@ # Don't allow Makefile.ref to use libmath NO_LIBM = 1 +ifeq ($(CPU_ARCH),x86_64) +# Use VA_COPY() standard macro on x86-64 +# FIXME: better use it everywhere +OS_CFLAGS += -DHAVE_VA_COPY -DVA_COPY=va_copy +endif + +ifeq ($(CPU_ARCH),x86_64) +# We need PIC code for shared libraries +# FIXME: better patch rules.mk & fdlibm/Makefile* +OS_CFLAGS += -DPIC -fPIC +endif compile and install cd src make -f Makefile.ref sudo JS_DIST=/usr/64 make -f Makefile.ref export remove the dynamic library sudo rm /usr/64/lib64/libjs.dylib # Download boost 1.37.0 Apply the following patch: diff -u -r a/configure b/configure --- a/configure 2009-01-26 14:10:42.000000000 -0500 +++ b/configure 2009-01-26 10:21:29.000000000 -0500 @@ -9,9 +9,9 @@ BJAM="" TOOLSET="" -BJAM_CONFIG="" +BJAM_CONFIG="architecture=x86 address-model=64 --layout=system" BUILD="" -PREFIX=/usr/local +PREFIX=/usr/64 EPREFIX= LIBDIR= INCLUDEDIR= diff -u -r a/tools/build/v2/tools/darwin.jam b/tools/build/v2/tools/darwin.jam --- a/tools/build/v2/tools/darwin.jam 2009-01-26 14:22:08.000000000 -0500 +++ b/tools/build/v2/tools/darwin.jam 2009-01-26 10:22:08.000000000 -0500 @@ -367,5 +367,5 @@ actions link.dll bind LIBRARIES { - "$(CONFIG_COMMAND)" -dynamiclib -Wl,-single_module -install_name "$(<:B)$(<:S)" -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(FRAMEWORK_PATH) -framework$(_)$(FRAMEWORK:D=:S=) $(OPTIONS) $(USER_OPTIONS) + "$(CONFIG_COMMAND)" -dynamiclib -Wl,-single_module -install_name "/usr/64/lib/$(<:B)$(<:S)" -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(FRAMEWORK_PATH) -framework$(_)$(FRAMEWORK:D=:S=) $(OPTIONS) $(USER_OPTIONS) } then, ./configure; make; sudo make install # Install pcre (must enable UTF8) CFLAGS="-m64" CXXFLAGS="-m64" LDFLAGS="-m64" ./configure --enable-utf8 --with-match-limit=200000 --with-match-limit-recursion=4000 --enable-unicode-properties --prefix /usr/64; make; sudo make install # Install unit test framework http://unittest.red-bean.com/ (optional) CFLAGS="-m64" CXXFLAGS="-m64" LDFLAGS="-m64" ./configure --prefix /usr/64; make; sudo make install CompilingTo compile 32-bit, just run: scons To compile 64-bit on 10.5 (64 is default on 10.6), run: scons --64 See the, MongoDB scons page for more details/compile options. Troubleshooting
|

PLEASE POST QUESTIONS IN THE USER GROUPS FORUM. Post non-question comments and helpful hints here.
blog comments powered by Disqus