mongo-cxx-driver安装确实安装了库

时间:2017-06-23 13:58:53

标签: c++ mongodb mongo-cxx-driver

我正在尝试在Ubuntu14.4上编译mongo-cxx-driver-r3.1.1。我按照说明从源代码安装了mongo-c-driver-1.6.3。

pkg-config --cflags --libs libmongoc-1.0 libbson-1.0 returns 
-I/usr/local/include/libmongoc-1.0 -I/usr/local/include/libbson-1.0  -L/usr/local/lib -lmongoc-1.0 -lsasl2 -lssl -lcrypto -lrt -lbson-1.0

我的升级版本为1.57。当我尝试按照https://mongodb.github.io/mongo-cxx-driver/mongocxx-v3/installation/中使用cmake提供的说明编译mongo-cxx-driver-r3.1.1时。

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local  ..

我得到以下日志:

  

- Boost版本:1.57.0

     

- 配置完成

     

- 生成完成

     

- 构建文件已写入:/user/home/mongo-c-driver-1.6.3/mongo-cxx-driver-r3.1.1/build

我尝试了其他选项,例如:

cmake  -DBSONCXX_POLY_USE_MNMLSTC:Bool=OFF -DBSONCXX_POLY_USE_BOOST:Bool=ON -

DCMAKE_VERBOSE_MAKEFILE=ON  -DCMAKE_C_COMPILER="/usr/bin/gcc" -
DCMAKE_CXX_COMPILER="/usr/bin/g++-4.8"  -DCMAKE_BUILD_TYPE=Release -
DCMAKE_INSTALL_PREFIX=/usr/local -DLIBMONGOC_DIR=/usr/local/lib -
DLIBBSON_DIR=/usr/local/lib .. 

但是,我没有看到mongocxx相关的库或头文件。以下是CMakeFiles / CMakeOutput.log输出:

  

系统是:Linux - 3.13.0-32-generic - x86_64编译CXX

     

编译器识别源文件“CMakeCXXCompilerId.cpp”

     

成功。编译器:/usr/bin/g++-4.8构建标志:Id标志:

输出结果为:

  

0

编译CXX编译器识别源“CMakeCXXCompilerId.cpp”生成“a.out”

CXX编译器标识是GNU,可在“/home/cvaidyan/mongo-c-driver-1.6.3/mongo-cxx-driver-r3.1.1/build/CMakeFiles/3.2.2/CompilerIdCXX/a中找到。出“

确定CXX编译器是否通过以下输出传递: 改变目录:/home/cvaidyan/mongo-c-driver-1.6.3/mongo-cxx-driver-r3.1.1/build/CMakeFiles/CMakeTmp

运行Build命令:“/ usr / bin / make”“cmTryCompileExec1480695504 / fast”

ake [1]:进入目录/home/cvaidyan/mongo-c-driver-1.6.3/mongo-cxx-driver-r3.1.1/build/CMakeFiles/CMakeTmp' /usr/bin/cmake -E cmake_progress_report /home/cvaidyan/mongo-c-driver-1.6.3/mongo-cxx-driver-r3.1.1/build/CMakeFiles/CMakeTmp/CMakeFiles 1 Building CXX object CMakeFiles/cmTryCompileExec1480695504.dir/testCXXCompiler.cxx.o /usr/bin/g++-4.8 -o CMakeFiles/cmTryCompileExec1480695504.dir/testCXXCompiler.cxx.o -c /home/cvaidyan/mongo-c-driver-1.6.3/mongo-cxx-driver-r3.1.1/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx Linking CXX executable cmTryCompileExec1480695504 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec1480695504.dir/link.txt --verbose=1 /usr/bin/g++-4.8 CMakeFiles/cmTryCompileExec1480695504.dir/testCXXCompiler.cxx.o -o cmTryCompileExec1480695504 -rdynamic make[1]: Leaving directory / home / cvaidyan / mongo-c-driver-1.6.3 / mongo-cxx-driver-r3.1.1 / build / CMakeFiles / CMakeTmp'

检测使用以下输出编译的CXX编译器ABI信息: 改变目录:/home/cvaidyan/mongo-c-driver-1.6.3/mongo-cxx-driver-r3.1.1/build/CMakeFiles/CMakeTmp

运行Build命令:“/ usr / bin / make”“cmTryCompileExec4079379117 / fast” .............

...................

/home/cvaidyan/mongo-c-driver-1.6.3/mongo-cxx-driver-r3.1.1/build/CMakeFiles/CMakeTmp/src.cxx:2:25:警告:\ u2018int somefunc()\ u2019已弃用(在/home/cvaidyan/mongo-c-driver-1.6.3/mongo-cxx-driver-r3.1.1/build/CMakeFiles/CMakeTmp/src.cxx:1中声明)[-Wdeprecated-declarations]      int main(){return somefunc();}                          ^ /home/cvaidyan/mongo-c-driver-1.6.3/mongo-cxx-driver-r3.1.1/build/CMakeFiles/CMakeTmp/src.cxx:2:34:警告:\ u2018int somefunc()\ u2019已弃用(在/home/cvaidyan/mongo-c-driver-1.6.3/mongo-cxx-driver-r3.1.1/build/CMakeFiles/CMakeTmp/src.cxx:1中声明)[-Wdeprecated-declarations]      int main(){return somefunc();}                                   ^ 链接CXX可执行文件cmTryCompileExec1892014975 / usr / bin / cmake -E cmake_link_script CMakeFiles / cmTryCompileExec1892014975.dir / link.txt --verbose = 1 /usr/bin/g++-4.8 -DCOMPILER_HAS_DEPRECATED_ATTR CMakeFiles / cmTryCompileExec1892014975.dir / src.cxx.o -o cmTryCompileExec1892014975 -rdynamic make [1]:离开目录`/home/cvaidyan/mongo-c-driver-1.6.3/mongo-cxx-driver-r3.1.1/build/CMakeFiles/CMakeTmp'

源文件是: 属性((已弃用))int somefunc(){return 0; }     int main(){return somefunc();}

如果有意义,我可以发布整个cmake输出。我在文件中写了“错误”或“失败”,但无法找到任何一个字符串。

如果有人可以指出,我在这里缺少什么会很​​棒?

1 个答案:

答案 0 :(得分:1)

这个bash文件适用于ubuntu 16.04

#!/bin/bash
apt-get update >> /dev/null
apt-get install openssh-server -y 
apt-get install g++ -y
apt-get install cmake -y
apt-get install git -y
#installing the mongoc dependencies and driver
apt-get install pkg-config libssl-dev libsasl2-dev -y
cd ~
wget https://github.com/mongodb/mongo-c-driver/releases/download/1.6.2/mongo-c-driver-1.6.2.tar.gz
tar xzf mongo-c-driver-1.6.2.tar.gz
cd mongo-c-driver-1.6.2
./configure --disable-automatic-init-and-cleanup
make
make install
cd ~ 
rm mongo-c-driver-1.6.2.tar.gz
rm -rf mongo-c-driver-1.6.2


#installing mongocxx driver - connects c++ to mongo
wget https://github.com/mongodb/mongo-cxx-driver/archive/r3.1.1.tar.gz
tar -xzf r3.1.1.tar.gz
cd mongo-cxx-driver-r3.1.1/build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
make EP_mnmlstc_core
make
make install
cd ~
rm r3.1.1.tar.gz
rm -rf mongo-cxx-driver-r3.1.1