当前位置: 首页 > 知识库问答 >
问题:

Mongocxx静态驱动程序示例失败

濮阳原
2023-03-14

我按照中的说明为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/after static mongo c驱动程序安装

>

  • Git克隆https://github.com/mongodb/mongo-cxx-driver.git\--branch release/stable--depth 1 cd mongo-cxx-driver/build

    cmake-dbuild_shared_libs=off-dcmake_build_type=release-dcmake_install_prefix=/usr/local。

    sudo使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
    
  • 共有1个答案

    寿高阳
    2023-03-14

    我不确定为什么要这样做,但是该文档已经更新,以反映当前Release/Stable分支中尚不存在的master上的更改。添加mongocxx包的静态版本的工作发生在V3.1分支(release/stable当前指向该分支)拉出之后的主分支上。

    当你签出r3.2.0-rc1标签时,你能看看上面的过程对你是否有效吗?希望我们很快就会发布R3.2.0,所以确认它对您是有效的将是很好的。

     类似资料:
    • 我正在尝试使用Python Splinter Selenium PhantomJS进行基本测试,但我无法启动phantomjs浏览器。(Chrome 我得到一个错误: 此外,当我跑步时: 我基本上得到了同样的错误。 看起来PhantomJS正在使用远程驱动程序连接到远程服务器,但splinter没有启动selenium(?)PhantomJS要连接到的服务器。我不介意进入splinter(?)的源

    • 我有一个Spring应用程序,在IDE和本地mariadb中运行良好,在POM中使用mariadb 2.7.4,如下所示,但我在Ubuntu上运行它时出现了第二个错误。我已经删除了mysql连接器,但仍然存在问题。为什么会出现差异和问题? 原因:组织。springframework。豆。BeanInstationException:未能实例化[com.zaxxer.hikari.HikariDat

    • 我想用mongo-cxx-driver上传文件但找不到办法。尝试使用mongodb的gridfs特性,但无法集成。使用当前稳定版本mongodb-cxx-driver(3.1.1)。 错误:store_file:/usr/include/boost/smart_ptr/scoped_ptr。hpp:99:T*boost::scoped_ptr::operator->()const[with T=m

    • 我在通过springboot应用程序连接到oracle db时出现异常。但是我可以使用sql Developer连接到这个数据库。 我使用HikariCP连接数据库

    • 目前是否已知 Google 云端硬盘 API 示例命令行应用(云端硬盘命令行)可以正常工作?我已经下载了 Java 客户机库,并编译了示例应用程序(插入通过指定“已安装的应用程序”和“其他”创建的应用程序的客户机标识和密钥)。它运行并通知我在浏览器中访问以下链接: https://accounts.google.com/o/oauth2/auth?access_type=online (显然我的实

    • 我正在使用appium来自动化android应用程序。在这种情况下,无法对文本字段执行sendkeys():单击Add Customer选项。翻开了新的一页。我正在尝试在文本字段中输入值。我能够使用XPath找到页面上的文本字段。我可以点击文本字段。但是当我执行sendkeys()时,它失败了。参考下面的截图。 链接:2-添加客户-打开新页面(第2页)并尝试输入详细信息