Mongocxx 静态驱动程序示例失败
Mongocxx static driver example fails
我按照说明为 MongoDB C 驱动程序(版本 1.9.2)构建了静态库 http://mongoc.org/libmongoc/current/installing.html。它安装正确并且可以将示例构建为
gcc -o hello_mongoc hello_mongoc.c $(pkg-config --libs --cflags libmongoc-static-1.0)
接下来我想要一个 mongcxx 静态库。我在 Ubuntu 16.04 上执行了这些步骤
如此处指定:https://mongodb.github.io/mongo-cxx-driver/mongocxx-v3/installation/ 静态 mongo c 驱动程序安装后
git克隆https://github.com/mongodb/mongo-cxx-driver.git\
--分支 releases/stable --深度 1
cd mongo-cxx-driver/build
cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=释放 -DCMAKE_INSTALL_PREFIX=/usr/local ..
sudo make EP_mnmlstc_core
make && sudo make install
现在当我尝试 运行 示例程序时
roshan@bolt:~$ c++ --std=c++11 test.cpp $(pkg-config --cflags --libs libmongocxx-static)
Package libmongocxx-static was not found in the pkg-config search path.
Perhaps you should add the directory containing `libmongocxx-static.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libmongocxx-static' found
test.cpp:3:47: fatal error: bsoncxx/builder/stream/document.hpp: No such file or directory
compilation terminated.
和
roshan@bolt:~$ pkg-config --cflags libmongocxx-static
Package libmongocxx-static was not found in the pkg-config search path.
Perhaps you should add the directory containing `libmongocxx-static.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libmongocxx-static' found
此外,我注意到:
/usr/local/lib/libmongocxx.a 是在 sudo make install 之后创建的,而不是 libmongocxx-static.
完成所有这些步骤后:
roshan@bolt:/usr/local/lib$ ls
cmake libbson-1.0.so.0.0.0 libmongoc-1.0.so ocaml
libbson-1.0.a libbsoncxx.a libmongoc-1.0.so.0 pkgconfig
libbson-1.0.la libbson-static-1.0.a libmongoc-1.0.so.0.0.0 python2.7
libbson-1.0.so libmongoc-1.0.a libmongoc-static-1.0.a python3.5
libbson-1.0.so.0 libmongoc-1.0.la libmongocxx.a
我不确定为什么要这样做,但是该文档已更新以反映当前 releases/stable 分支中尚不存在的 master 上的更改。添加 mongocxx 包的静态版本的工作发生在 v3.1 分支(releases/stable 当前指向的分支)被拉出后的 master 分支上。
当您查看 r3.2.0-rc1 标签时,您能看出上述过程是否适合您吗?希望我们很快发布 r3.2.0,所以最好确认它是否适合您。
我按照说明为 MongoDB C 驱动程序(版本 1.9.2)构建了静态库 http://mongoc.org/libmongoc/current/installing.html。它安装正确并且可以将示例构建为
gcc -o hello_mongoc hello_mongoc.c $(pkg-config --libs --cflags libmongoc-static-1.0)
接下来我想要一个 mongcxx 静态库。我在 Ubuntu 16.04 上执行了这些步骤 如此处指定:https://mongodb.github.io/mongo-cxx-driver/mongocxx-v3/installation/ 静态 mongo c 驱动程序安装后
git克隆https://github.com/mongodb/mongo-cxx-driver.git\ --分支 releases/stable --深度 1 cd mongo-cxx-driver/build
cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=释放 -DCMAKE_INSTALL_PREFIX=/usr/local ..
sudo make EP_mnmlstc_core
make && sudo make install
现在当我尝试 运行 示例程序时
roshan@bolt:~$ c++ --std=c++11 test.cpp $(pkg-config --cflags --libs libmongocxx-static)
Package libmongocxx-static was not found in the pkg-config search path.
Perhaps you should add the directory containing `libmongocxx-static.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libmongocxx-static' found
test.cpp:3:47: fatal error: bsoncxx/builder/stream/document.hpp: No such file or directory
compilation terminated.
和
roshan@bolt:~$ pkg-config --cflags libmongocxx-static
Package libmongocxx-static was not found in the pkg-config search path.
Perhaps you should add the directory containing `libmongocxx-static.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libmongocxx-static' found
此外,我注意到:
/usr/local/lib/libmongocxx.a 是在 sudo make install 之后创建的,而不是 libmongocxx-static.
完成所有这些步骤后:
roshan@bolt:/usr/local/lib$ ls
cmake libbson-1.0.so.0.0.0 libmongoc-1.0.so ocaml
libbson-1.0.a libbsoncxx.a libmongoc-1.0.so.0 pkgconfig
libbson-1.0.la libbson-static-1.0.a libmongoc-1.0.so.0.0.0 python2.7
libbson-1.0.so libmongoc-1.0.a libmongoc-static-1.0.a python3.5
libbson-1.0.so.0 libmongoc-1.0.la libmongocxx.a
我不确定为什么要这样做,但是该文档已更新以反映当前 releases/stable 分支中尚不存在的 master 上的更改。添加 mongocxx 包的静态版本的工作发生在 v3.1 分支(releases/stable 当前指向的分支)被拉出后的 master 分支上。
当您查看 r3.2.0-rc1 标签时,您能看出上述过程是否适合您吗?希望我们很快发布 r3.2.0,所以最好确认它是否适合您。