Created
August 27, 2020 15:45
-
-
Save blongho/caaddd4704450e40a644a0f0d33d4d2a to your computer and use it in GitHub Desktop.
This script describes the steps that are needed to install mongocxx version 3.6 in a linux computer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Mongocxx depends on Mongoc. We first install that dependency | |
# 1. Install libmongoc with a Package Manager | |
sudo apt-get install libmongoc-1.0-0 | |
# 2. Install libbson with a Package Manager | |
sudo apt-get install libbson-1.0-0 | |
# 3. Build environment on Unix | |
sudo apt-get install cmake libssl-dev libsasl2-dev | |
# 4. Prepare a build from source | |
## http://mongoc.org/libmongoc/current/installing.html#preparing-a-build-from-a-git-repository-clone | |
git clone https://github.com/mongodb/mongo-c-driver.git | |
cd mongo-c-driver | |
git fetch --tags # fetch all the tags | |
# get the latest tag or the tag that denotes the version you are interested in. | |
latestTag=$(git describe --tags `git rev-list --tags --max-count=1`) | |
echo "Latest tag is ${latestTag}" | |
git checkout $latestTag | |
python3 build/calc_release_version.py > VERSION_CURRENT | |
mkdir cmake-build | |
cd cmake-build | |
cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF .. | |
cmake --build . | |
sudo cmake --build . --target install | |
# Generating the documentation | |
## Intall Phinix | |
sudo apt install python-pip | |
sudo -H pip install -U Sphinx | |
cmake -DENABLE_MAN_PAGES=ON -DENABLE_HTML_DOCS=ON .. | |
cmake --build . --target mongoc-doc | |
cmake --build . --target bson-doc | |
## Uninstall mongoc | |
# sudo /usr/local/share/mongo-c-driver/uninstall.sh | |
## Uninstall mongoc | |
# sudo /usr/local/share/mongo-c-driver/uninstall.sh | |
#### Installing mongcxx | |
# Download the latest version of the mongocxx driver. | |
# Get version 3.6.0 [Latest release as of 27th Aug 2020] | |
sudo curl -OL https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.6.0/mongo-cxx-driver-r3.6.0.tar.gz | |
tar -xzf mongo-cxx-driver-r3.6.0.tar.gz | |
cd mongo-cxx-driver-r3.6.0/build | |
# Configure the driver. For more options, see http://mongocxx.org/mongocxx-v3/installation/#step-4-configure-the-driver | |
sudo cmake .. \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_INSTALL_PREFIX=/usr/local \ | |
-DBUILD_SHARED_AND_STATIC_LIBS=ON \ | |
-DCMAKE_INSTALL_PREFIX=/usr/local/mongo-cxx-driver | |
# Run the cmake and build | |
sudo cmake --build . --target EP_mnmlstc_core | |
sudo cmake --build . --target install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment