按照官网(https://github.com/mongodb/mongo-cxx-driver/wiki/Quickstart-Guide-(New-Driver))上说的,C++ driver内部使用了libbson和 MongoDB C driver。所以要安装C++ driver,需要先安装C driver。我的系统gcc版本4.8.5,cmake版本3.5.2,达到官网要求的安装版本。
1.安装automake, autoconf and libtool,这里全部yum安装即可
yum -y install automake autoconf libtool
2.安装C driver,按照官网(https://github.com/mongodb/mongo-c-driver)给的安装方法安装。这里我装的是1.3.5版本。
wget https://github.com/mongodb/mongo-c-driver/releases/download/1.3.5/mongo-c-driver-1.3.5.tar.gz tar xzf mongo-c-driver-1.3.5.tar.gz cd mongo-c-driver-1.3.5 ./configure make make install
3.安装C++ driver,按照官网(https://github.com/mongodb/mongo-cxx-driver/wiki/Quickstart-Guide-(New-Driver))给的安装方法安装。这里我装的是3.0.1版本。
wget https://github.com/mongodb/mongo-cxx-driver/archive/r3.0.1.tar.gz tar xzf r3.0.1.tar.gz cd mongo-cxx-driver-r3.0.1/build PKG_CONFIG_PATH=/usr/local/lib/pkgconfig cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/ .. make make install
时间: 2024-10-28 11:05:21