- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我一直在尝试在 OSX 10.10 上为 C++11 编译 mongo-cxx-driver,但遇到了一些麻烦。libbson 和 mongo-c-driver 都已成功构建和安装,库到/usr/local/lib,头文件到/usr/local/include/libbson-1.0 和/usr/local/include/libmongoc-1.0分别。我从 mongo-cxx-driver/build 目录成功运行了 cmake,这是 shell 的完整输出:
~/code/cpp/mongo-cxx-driver/build ((r3.0.1)) $> cmake -DLIBBSON_DIR=/usr/local/include/libbson-1.0 -DLIBMONGOC_DIR=/usr/local/include/libmongoc-1.0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/user/code/cpp/mongo-cxx-driver
当我从 mongo-cxx-driver 目录运行 make 时,出现以下错误:
...
[ 4%] Building CXX object src/bsoncxx/CMakeFiles/bsoncxx.dir/array/view.cpp.o
/Users/user/code/cpp/mongo-cxx-driver/src/bsoncxx/array/view.cpp:21:10: fatal error: 'bson.h' file not
found
#include <bson.h>
^
1 error generated.
显然编译器找不到那些包含...但是为什么呢?这不是在 cmake 命令行中设置的 LIBBSON_DIR 和 LIBMONGOC_DIR 吗?
编辑:我使用 cmake 从他们的 git 源构建了 C 驱动程序和 libbson;制作;须藤安装。今天我从头开始了 mongo-cxx-driver,记录了一路上的所有问题。mongo-cxx-driver/build 中的 cmake 生成以下输出:
~/code/cpp/mongo-cxx-driver/build (master) $> cmake ..
-- The CXX compiler identification is AppleClang 7.3.0.7030031
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- No build type selected, default is Release
-- The C compiler identification is AppleClang 7.3.0.7030031
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at cmake/FindLibBSON.cmake:38 (message):
Don't know how to find libbson; please set LIBBSON_DIR to the prefix
directory with which libbson was configured.
Call Stack (most recent call first):
src/bsoncxx/CMakeLists.txt:67 (find_package)
-- Configuring incomplete, errors occurred!
See also "/Users/user/code/cpp/mongo-cxx-driver/build/CMakeFiles/CMakeOutput.log".
/mongo-cxx-driver/build/CMakeFiles/CMakeOutput.log 中的 cmake 日志包含(为简洁起见,仅显示 C++11 相关行):
The system is: Darwin - 15.6.0 - x86_64
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: /Library/Developer/CommandLineTools/usr/bin/c++
Build flags:
Id flags:
The output was:
0
Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out"
The CXX compiler identification is AppleClang, found in "/Users/user/code/cpp/mongo-cxx-driver/build/CMakeFiles/3.6.2/CompilerIdCXX/a.out"
Determining if the CXX compiler works passed with the following output:
Change Dir: /Users/user/code/cpp/mongo-cxx-driver/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_1ae1a/fast"
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_1ae1a.dir/build.make CMakeFiles/cmTC_1ae1a.dir/build
Building CXX object CMakeFiles/cmTC_1ae1a.dir/testCXXCompiler.cxx.o
/Library/Developer/CommandLineTools/usr/bin/c++ -o CMakeFiles/cmTC_1ae1a.dir/testCXXCompiler.cxx.o -c /Users/user/code/cpp/mongo-cxx-driver/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
Linking CXX executable cmTC_1ae1a
/usr/local/Cellar/cmake/3.6.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_1ae1a.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/c++ -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_1ae1a.dir/testCXXCompiler.cxx.o -o cmTC_1ae1a
Detecting CXX compiler ABI info compiled with the following output:
Change Dir: /Users/user/code/cpp/mongo-cxx-driver/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_34702/fast"
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_34702.dir/build.make CMakeFiles/cmTC_34702.dir/build
Building CXX object CMakeFiles/cmTC_34702.dir/CMakeCXXCompilerABI.cpp.o
/Library/Developer/CommandLineTools/usr/bin/c++ -o CMakeFiles/cmTC_34702.dir/CMakeCXXCompilerABI.cpp.o -c /usr/local/Cellar/cmake/3.6.2/share/cmake/Modules/CMakeCXXCompilerABI.cpp
Linking CXX executable cmTC_34702
/usr/local/Cellar/cmake/3.6.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_34702.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/c++ -Wl,-search_paths_first -Wl,-headerpad_max_install_names -v -Wl,-v CMakeFiles/cmTC_34702.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_34702
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
"/Library/Developer/CommandLineTools/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.11.0 -o cmTC_34702 -search_paths_first -headerpad_max_install_names -v CMakeFiles/cmTC_34702.dir/CMakeCXXCompilerABI.cpp.o -lc++ -lSystem /Library/Developer/CommandLineTools/usr/bin/../lib/clang/7.3.0/lib/darwin/libclang_rt.osx.a
@(#)PROGRAM:ld PROJECT:ld64-264.3.102
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em (tvOS)
Library search paths:
/usr/lib
/usr/local/lib
Framework search paths:
/Library/Frameworks/
/System/Library/Frameworks/
Parsed CXX implicit link information from above output:
link line regex: [^( *|.*[/\])(ld|([^/\]+-)?ld|collect2)[^/\]*( |$)]
ignore line: [Change Dir: /Users/user/code/cpp/mongo-cxx-driver/build/CMakeFiles/CMakeTmp]
ignore line: []
ignore line: [Run Build Command:"/usr/bin/make" "cmTC_34702/fast"]
ignore line: [/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_34702.dir/build.make CMakeFiles/cmTC_34702.dir/build]
ignore line: [Building CXX object CMakeFiles/cmTC_34702.dir/CMakeCXXCompilerABI.cpp.o]
ignore line: [/Library/Developer/CommandLineTools/usr/bin/c++ -o CMakeFiles/cmTC_34702.dir/CMakeCXXCompilerABI.cpp.o -c /usr/local/Cellar/cmake/3.6.2/share/cmake/Modules/CMakeCXXCompilerABI.cpp]
ignore line: [Linking CXX executable cmTC_34702]
ignore line: [/usr/local/Cellar/cmake/3.6.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_34702.dir/link.txt --verbose=1]
ignore line: [/Library/Developer/CommandLineTools/usr/bin/c++ -Wl,-search_paths_first -Wl,-headerpad_max_install_names -v -Wl,-v CMakeFiles/cmTC_34702.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_34702 ]
ignore line: [Apple LLVM version 7.3.0 (clang-703.0.31)]
ignore line: [Target: x86_64-apple-darwin15.6.0]
ignore line: [Thread model: posix]
ignore line: [InstalledDir: /Library/Developer/CommandLineTools/usr/bin]
link line: [ "/Library/Developer/CommandLineTools/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.11.0 -o cmTC_34702 -search_paths_first -headerpad_max_install_names -v CMakeFiles/cmTC_34702.dir/CMakeCXXCompilerABI.cpp.o -lc++ -lSystem /Library/Developer/CommandLineTools/usr/bin/../lib/clang/7.3.0/lib/darwin/libclang_rt.osx.a]
arg [/Library/Developer/CommandLineTools/usr/bin/ld] ==> ignore
arg [-demangle] ==> ignore
arg [-dynamic] ==> ignore
arg [-arch] ==> ignore
arg [x86_64] ==> ignore
arg [-macosx_version_min] ==> ignore
arg [10.11.0] ==> ignore
arg [-o] ==> ignore
arg [cmTC_34702] ==> ignore
arg [-search_paths_first] ==> ignore
arg [-headerpad_max_install_names] ==> ignore
arg [-v] ==> ignore
arg [CMakeFiles/cmTC_34702.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore
arg [-lc++] ==> lib [c++]
arg [-lSystem] ==> lib [System]
arg [/Library/Developer/CommandLineTools/usr/bin/../lib/clang/7.3.0/lib/darwin/libclang_rt.osx.a] ==> lib [/Library/Developer/CommandLineTools/usr/bin/../lib/clang/7.3.0/lib/darwin/libclang_rt.osx.a]
Library search paths: [;/usr/lib;/usr/local/lib]
Framework search paths: [;/Library/Frameworks/;/System/Library/Frameworks/]
remove lib [System]
collapse lib [/Library/Developer/CommandLineTools/usr/bin/../lib/clang/7.3.0/lib/darwin/libclang_rt.osx.a] ==> [/Library/Developer/CommandLineTools/usr/lib/clang/7.3.0/lib/darwin/libclang_rt.osx.a]
collapse library dir [/usr/lib] ==> [/usr/lib]
collapse library dir [/usr/local/lib] ==> [/usr/local/lib]
collapse framework dir [/Library/Frameworks/] ==> [/Library/Frameworks]
collapse framework dir [/System/Library/Frameworks/] ==> [/System/Library/Frameworks]
implicit libs: [c++;/Library/Developer/CommandLineTools/usr/lib/clang/7.3.0/lib/darwin/libclang_rt.osx.a]
implicit dirs: [/usr/lib;/usr/local/lib]
implicit fwks: [/Library/Frameworks;/System/Library/Frameworks]
Detecting CXX [-std=c++11] compiler features compiled with the following output:
Change Dir: /Users/user/code/cpp/mongo-cxx-driver/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_a8d63/fast"
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_a8d63.dir/build.make CMakeFiles/cmTC_a8d63.dir/build
Building CXX object CMakeFiles/cmTC_a8d63.dir/feature_tests.cxx.o
/Library/Developer/CommandLineTools/usr/bin/c++ -std=c++11 -o CMakeFiles/cmTC_a8d63.dir/feature_tests.cxx.o -c /Users/user/code/cpp/mongo-cxx-driver/build/CMakeFiles/feature_tests.cxx
Linking CXX executable cmTC_a8d63
/usr/local/Cellar/cmake/3.6.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_a8d63.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/c++ -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_a8d63.dir/feature_tests.cxx.o -o cmTC_a8d63
Feature record: CXX_FEATURE:0cxx_aggregate_default_initializers
...
Feature record: CXX_FEATURE:1cxx_variadic_templates
Detecting C [-std=c11] compiler features compiled with the following output:
Change Dir: /Users/user/code/cpp/mongo-cxx-driver/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_9a269/fast"
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_9a269.dir/build.make CMakeFiles/cmTC_9a269.dir/build
Building C object CMakeFiles/cmTC_9a269.dir/feature_tests.c.o
/Library/Developer/CommandLineTools/usr/bin/cc -std=c11 -o CMakeFiles/cmTC_9a269.dir/feature_tests.c.o -c /Users/user/code/cpp/mongo-cxx-driver/build/CMakeFiles/feature_tests.c
Linking C executable cmTC_9a269
/usr/local/Cellar/cmake/3.6.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_9a269.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/cc -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_9a269.dir/feature_tests.c.o -o cmTC_9a269
Feature record: C_FEATURE:1c_function_prototypes
Feature record: C_FEATURE:1c_restrict
Feature record: C_FEATURE:1c_static_assert
Feature record: C_FEATURE:1c_variadic_macros
(如果需要其他线路,我很乐意发送)。ls/usr/local/lib/pkgconfig 显示如下:
lcms2.pc libbson-1.0.pc libmongoc-1.0.pc libmongoc-ssl-1.0.pc libtiff-4.pc mysqlclient.pc
最佳答案
发现问题。 @acm 要求显示 pkg-config --cflags --libs libmongoc-1.0 libbson-1.0
的输出,我尝试这样做:
~/code/cpp/mongo-cxx-driver/build (master) $> pkg-config --cflags --libs libmongoc-1.0 libbson-1.0
-bash: pkg-config: command not found
显然没有安装 pkg-config。稍后通过自制软件快速安装,我运行相同的行并得到:
~/code/cpp/mongo-cxx-driver/build (master) $> pkg-config --cflags --libs libmongoc-1.0 libbson-1.0
-I/usr/local/include/libmongoc-1.0 -I/usr/local/include/libbson-1.0 -L/usr/local/lib -lmongoc-1.0 -lbson-1.0
在那之后 cmake 运行得很好,make 也运行得很好。
感谢您的帮助:-)
关于c++ - 使 mongo-cxx-driver 找不到包括,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39490432/
127.0.0.1:8000/api/仅包含来自第二个应用程序的 url,但我将两个 url 模块链接到相同的模式。甚至有可能做到这一点吗? 第一个应用程序: from django.urls imp
我目前正在学习 ColdFusion。我有 PHP 背景,对此我有点困惑。 我有一个选择菜单,我希望将选项保存在不同的文件中。 (例如 options.cfm)当我调用文件时,我想在选择菜单中包含选项
字符串: "75,000", "is", "95%", "or", "95/100" "of", "monthly", "income" o/p: "is","%, "or", "/", "of",
我有 4 个 javascript 文件(每个文件对应一个 HTML 文件),所有 4 个文件中的 3 个函数都是相同的。我想找到一个顺利的解决方案,我可以以某种方式分别包含这 3 个函数...是否可
我在 PHP 中有这种情况,其中 include在一台服务器上被遗漏,但在另一台服务器上没有(我没有设置服务器,所以我不能告诉你更多;我不是真正的 devops 人,所以这就是我在这里问的原因)。两台
这是一个模式文件,midi.xsd定义类型,note ,用于存储 MIDI 音符值: 这是另一个模式文件,octaves.xsd使用
我想备份以下文件夹 /home /etc /usr/local /root /var /boot 并排除 /var/tmp /var/run /var/lock /home/*/.thumbnails
如何重新编码具有许多值(包括缺失值)的数值变量,以获得数字 0:n-1哪里n是唯一值的数量,包括 NA ,整齐? 例子: df 1 1000 0 2 1000 0 3 N
选择元素的 html(包括在内)的最佳方法是什么?例如: This is just a test. 而$('#testDiv').html()返回"This is just a test."
我正在尝试设置Varnish来处理本地环境中的ESI包含。 我在虚拟机中运行 Varnish ,内容在主机上运行。 我有两个文件“index.html”和“test.html”。它们都存储在apach
我有以下内容,并且想要检索“ FromEmail”不为空的数据 Simple email@gma
欧海,我正在编写一个小型 PHP 应用程序,使用一个单独的 config.php 文件和一个functions.php,其中包含我将在应用程序中使用的所有自定义函数。现在,我真的必须在每个函数中包含
我知道可以将 JavaScript 放在一个特定的 .js 文件中,然后通过执行以下操作将其包含在任何页面中...... 我注意到,对于包含的这些 .js 文件: 它们实际上不必以 .js 结尾 其
我使用 gwt UIBinder 添加了一些项目到我的 ComboBox。 --select one-- Dispute Referral Form Dispute Settlement Clause
我可以将一个 first.c 文件包含到另一个 second.c 中吗? (我正在做一些套接字编程,以将服务器收到的消息存储在链接列表中,因此在第一个程序中,我尝试保留链接列表和第二个程序套接字编程文
我有一个简单的 Spring MVC 数据项目设置,我试图选择 Admin 中尚不存在的用户列表。 table 。这是我的存储库方法 SELECT u FROM User u WHERE u.id N
在 bash 脚本中,使用什么实用程序以及如何删除两个字符串之间的文本,包括字符串。 原文: (ABC blah1)blah 2(def blah 5)blah 7)(DEF blah 8)blah
我有这个 BST 问题,我试图用 Java 解决,但我不知道为什么它不起作用。问题是: 二叉搜索树 (BST) 是一种二叉树,其中每个值节点大于或等于该节点的所有节点中的值左子树并且小于该树中所有节点
我有一个字符串,其中包含“Dollars”和“Cents”符号。我想删除它们。我试过了 string.replaceAll("[\"\\u00A2\" $]", "") 但它不起作用。正确的做法是什么
我在 stories 和 tags 之间有一个多对多的关系,为保存关系而创建的表是 taxonomies。我想搜索所有具有所有给定标签的故事。 到目前为止我使用的查询是这个,当然它对我不起作用,它返回
我是一名优秀的程序员,十分优秀!