Rakesh Vidyadharan Help

Build

Check out the sources and use cmake to build and install the project locally.

UNIX

Build boost from sources.

BOOST_VERSION=1.87.0 INSTALL_DIR=/opt/local cd /tmp ver=`echo "${BOOST_VERSION}" | awk -F'.' '{printf("%d_%d_%d",$1,$2,$3)}'` curl -OL https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${ver}.tar.bz2 tar xfj boost_${ver}.tar.bz2 sudo rm -rf $INSTALL_DIR cd boost_${ver} \ && ./bootstrap.sh \ && sudo ./b2 -j8 cxxflags=-std=c++20 install link=static threading=multi runtime-link=static --prefix=$INSTALL_DIR --without-python --without-mpi

Install mongocxx driver.

export PREFIX=/opt/local
MONGOC_VERSION=1.29.0 MONGOCXX_VERSION=4.0.0 sudo rm -rf $PREFIX cd /tmp sudo rm -rf mongo-c-driver* curl -L -O https://github.com/mongodb/mongo-c-driver/releases/download/${MONGOC_VERSION}/mongo-c-driver-${MONGOC_VERSION}.tar.gz tar xzf mongo-c-driver-${MONGOC_VERSION}.tar.gz cd /tmp/mongo-c-driver-${MONGOC_VERSION} mkdir cmake-build && cd cmake-build cmake \ -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_INSTALL_LIBDIR=lib \ -DBUILD_SHARED_LIBS=OFF \ -DENABLE_SASL=OFF \ -DENABLE_TESTS=OFF \ -DENABLE_EXAMPLES=OFF \ .. make -j8 sudo make install cd /tmp sudo rm -rf mongo-cxx-driver curl -OL https://github.com/mongodb/mongo-cxx-driver/releases/download/r${MONGOCXX_VERSION}/mongo-cxx-driver-r${MONGOCXX_VERSION}.tar.gz tar -xzf mongo-cxx-driver-r${MONGOCXX_VERSION}.tar.gz cd mongo-cxx-driver-r${MONGOCXX_VERSION}/build cmake \ -DCMAKE_CXX_STANDARD=20 \ -DCMAKE_CXX_STANDARD_REQUIRED=ON \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_PREFIX_PATH=$PREFIX \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_INSTALL_LIBDIR=lib \ -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_TESTING_ENABLED=OFF \ -DENABLE_TESTS=OFF \ -DBSONCXX_POLY_USE_STD=ON \ .. make -j8 sudo make install

Check out, build and install the project.

cd /tmp git clone https://github.com/sptrakesh/mongo-service.git cd mongo-service cmake -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_PREFIX_PATH=/opt/local \ -DCMAKE_INSTALL_PREFIX=/opt/spt \ -DBUILD_TESTING=OFF -S . -B build cmake --build build -j12 sudo cmake --install build

Mac OS X

Build boost from sources.

BOOST_VERSION=1.87.0 INSTALL_DIR=/usr/local/boost cd /tmp ver=`echo "${BOOST_VERSION}" | awk -F'.' '{printf("%d_%d_%d",$1,$2,$3)}'` curl -OL https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${ver}.tar.bz2 tar xfj boost_${ver}.tar.bz2 sudo rm -rf $INSTALL_DIR cd boost_${ver} \ && ./bootstrap.sh \ && sudo ./b2 -j8 cxxflags=-std=c++20 install link=static threading=multi runtime-link=static --prefix=$INSTALL_DIR --without-python --without-mpi

Install mongocxx driver.

export PREFIX=/usr/local/mongo
MONGOC_VERSION=1.29.0 MONGOCXX_VERSION=4.0.0 sudo rm -rf $PREFIX cd /tmp sudo rm -rf mongo-c-driver* curl -L -O https://github.com/mongodb/mongo-c-driver/releases/download/${MONGOC_VERSION}/mongo-c-driver-${MONGOC_VERSION}.tar.gz tar xzf mongo-c-driver-${MONGOC_VERSION}.tar.gz cd /tmp/mongo-c-driver-${MONGOC_VERSION} mkdir cmake-build && cd cmake-build cmake \ -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_INSTALL_LIBDIR=lib \ -DBUILD_SHARED_LIBS=OFF \ -DENABLE_SASL=OFF \ -DENABLE_TESTS=OFF \ -DENABLE_EXAMPLES=OFF \ .. make -j8 sudo make install cd /tmp sudo rm -rf mongo-cxx-driver curl -OL https://github.com/mongodb/mongo-cxx-driver/releases/download/r${MONGOCXX_VERSION}/mongo-cxx-driver-r${MONGOCXX_VERSION}.tar.gz tar -xzf mongo-cxx-driver-r${MONGOCXX_VERSION}.tar.gz cd mongo-cxx-driver-r${MONGOCXX_VERSION}/build cmake \ -DCMAKE_CXX_STANDARD=20 \ -DCMAKE_CXX_STANDARD_REQUIRED=ON \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_PREFIX_PATH=$PREFIX \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_INSTALL_LIBDIR=lib \ -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_TESTING_ENABLED=OFF \ -DENABLE_TESTS=OFF \ -DBSONCXX_POLY_USE_STD=ON \ .. make -j8 sudo make install

Check out, build and install the project.

cd /tmp git clone https://github.com/sptrakesh/mongo-service.git cd mongo-service cmake -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_PREFIX_PATH=/usr/local/boost \ -DCMAKE_PREFIX_PATH=/usr/local/mongo \ -DCMAKE_INSTALL_PREFIX=/opt/spt \ -DBUILD_TESTING=OFF -S . -B build cmake --build build -j12 sudo cmake --install build

Windows

Install dependencies to build the project. The following instructions at times reference arm or arm64 architecture. Modify those values as appropriate for your hardware. These instructions are based on steps I followed to set up the project on a Windows 11 virtual machine running via Parallels Desktop on a M2 Mac.

Build boost from sources. Download and extract Boost 1.87 (or above) to a temporary location (eg. `\opt\src`). Launch the Visual Studio Command utility and cd to the temporary location.

cd \opt\src curl -OL https://boostorg.jfrog.io/artifactory/main/release/1.87.0/source/boost_1_87_0.tar.gz tar -xfz boost_1_87_0.tar.gz cd boost_1_87_0 .\bootstrap.bat .\b2 -j8 install threading=multi address-model=64 architecture=arm asynch-exceptions=on --prefix=\opt\local --without-python --without-mpi cd .. del /s /q boost_1_87_0 rmdir /s /q boost_1_87_0

Install mongocxx driver.

cd \opt\src curl -OL https://github.com/mongodb/mongo-c-driver/releases/download/1.29.0/mongo-c-driver-1.29.0.tar.gz tar -xfz mongo-c-driver-1.29.0.tar.gz cd mongo-c-driver-1.29.0 cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=c:\opt\local -DBUILD_SHARED_LIBS=OFF -DENABLE_SASL=OFF -DENABLE_TESTS=OFF -DENABLE_EXAMPLES=OFF -S . -B cmake-build cmake --build cmake-build --target install --parallel 8 cd .. del /s /q mongo-c-driver-1.29.0 rmdir /s /q mongo-c-driver-1.29.0 curl -OL https://github.com/mongodb/mongo-cxx-driver/releases/download/r4.0.0/mongo-cxx-driver-r4.0.0.tar.gz tar -xvf mongo-cxx-driver-r4.0.0.tar.gz cd mongo-cxx-driver-r4.0.0 cmake -DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=c:\opt\local -DCMAKE_INSTALL_PREFIX=c:\opt\local -DCMAKE_INSTALL_LIBDIR=lib -DBUILD_SHARED_LIBS=OFF -DCMAKE_TESTING_ENABLED=OFF -DENABLE_TESTS=OFF -DBSONCXX_POLY_USE_STD=ON -S . -B build cmake --build build --target install --parallel 8 cd .. del /s /q mongo-cxx-driver-r4.0.0 rmdir /s /q mongo-cxx-driver-r4.0.0

Install fmt library.

cd \opt\src git clone https://github.com/fmtlib/fmt.git --branch 9.1.0 cd fmt cmake -DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\opt\local -DCMAKE_INSTALL_LIBDIR=lib -DFMT_TEST=OFF -DFMT_MODULE=ON -S . -B build cmake --build build --target install -j8

Install range-v3 library.

git clone https://github.com/ericniebler/range-v3.git --branch 0.12.0 cd range-v3 cmake -DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\opt\local -DCMAKE_INSTALL_LIBDIR=lib -DRANGE_V3_DOCS=OFF -DRANGE_V3_EXAMPLES=OFF -DRANGE_V3_PERF=OFF -DRANGE_V3_TESTS=OFF -DRANGE_V3_INSTALL=ON -B build -S . cmake --build build --target install -j8

Install vcpkg manager. Launch the Visual Studio Command utility.

cd \opt\src git clone https://github.com/Microsoft/vcpkg.git cd vcpkg .\bootstrap-vcpkg.bat -disableMetrics .\vcpkg integrate install --vcpkg-root \opt\src\vcpkg .\vcpkg install curl:arm64-windows .\vcpkg install cpr:arm64-windows

Check out, build and install the project.

cd %homepath%\source\repos git clone https://github.com/sptrakesh/mongo-service.git cd mongo-service cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=\opt\local -DCMAKE_INSTALL_PREFIX=\opt\spt -DBUILD_TESTING=ON -DCMAKE_TOOLCHAIN_FILE="C:/opt/src/vcpkg/scripts/buildsystems/vcpkg.cmake" -S . -B build cmake --build build -j8 cmake --build build --target install
Last modified: 21 January 2025