如何为 Ubuntu 安装 MongoDB C++ 驱动程序?

2024-02-27

我已经下载了最新的 MongoDB C++ 驱动程序,http://downloads.mongodb.org/cxx-driver/mongodb-linux-x86_64-2.5.2.tgz http://downloads.mongodb.org/cxx-driver/mongodb-linux-x86_64-2.5.2.tgz。 当我做“scons”时,它构建得很好。建筑完工后,我得到以下信息:

ranlib build/libmongoclient.a
Install file: "build/libmongoclient.a" as "libmongoclient.a"
scons: done building targets.

它说它安装了 mongo,但我想将 lib 和标头安装在适当的位置,例如 /usr/local。无论我尝试什么(scons install,带或不带 --prefix),它只是不想将其安装在 /usr/local 中。事实上,它表示安装目标是最新的:

$sudo scons install --prefix=/usr/local
scons: Reading SConscript files ...
Checking for C++ library boost_thread-mt... (cached) yes
Checking for C++ library boost_filesystem-mt... (cached) yes
Checking for C++ library boost_system-mt... (cached) yes
Checking for sasl_version_info(0, 0, 0, 0, 0, 0) in C library sasl2... (cached) yes
Checking for C++ header file execinfo.h... (cached) yes
Checking whether backtrace is declared... (cached) yes
Checking whether backtrace_symbols is declared... (cached) yes
Checking whether backtrace_symbols_fd is declared... (cached) yes
scons: done reading SConscript files.
scons: Building targets ...
scons: `install' is up to date.
scons: done building targets.

我应该使用其他参数来安装它吗?对于库,我可以复制它,但手动安装标题会更繁琐。


目前安装MongoDB C++驱动最好的方法是去官方github 存储库 https://www.github.com/mongodb/mongo-cxx-driver并阅读“下载并编译”wiki 页面 https://github.com/mongodb/mongo-cxx-driver/wiki/Download-and-Compile-the-Legacy-Driver.

存储库共有三个分支(其中两个当前提供稳定的发布流)。第一个稳定版本系列被命名为26compat https://github.com/mongodb/mongo-cxx-driver/tree/26compat(MongoDB 2.6 兼容)它具有从 MongoDB 2.6 版本中提取的源代码(以及使其独立的少量修改)。它旨在替代围绕 C++ 驱动程序构建的现有代码。

另一个稳定版本系列名为legacy https://github.com/mongodb/mongo-cxx-driver/tree/legacy它与 26compat 分支类似,但包含一些向后突破的改进以及许多重要的改进和修复。它是新项目的正确起点 http://www.mongodb.com/blog/post/introducing-legacy-c-driver-10。使用旧的“服务器驱动程序”或 26compat 驱动程序的现有项目也应该致力于升级到稳定的旧版本系列。

如果您有兴趣,可以阅读有关更改的更多信息here http://blog.mongodb.org/post/78478565493/upcoming-changes-to-the-mongodb-cpp-driver但总的来说,您现在使用我们在 github 存储库中提供的内容会更开心。虽然 C++ 驱动程序在技术上以前可以通过服务器源获得,但它并不是真正打算在 MongoDB 外部使用。现在,我们在官方存储库中提供的代码is旨在供外部使用并由 C++ 驱动程序团队支持。

我们还正在研究一个全新的驱动程序 http://www.mongodb.com/blog/post/introducing-new-c-driver在 master 分支上为 C++11 构建,但尚未准备好投入生产。我们鼓励您尝试并提供反馈。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何为 Ubuntu 安装 MongoDB C++ 驱动程序? 的相关文章

随机推荐