make mongo-cxx-драйвер не может найти включает

Я пытался скомпилировать драйвер mongo-cxx для C ++ 11 на OSX 10.10, но у меня возникли некоторые проблемы с ним.
Оба libbson и mongo-c-driver были собраны и установлены успешно, библиотеки в / usr / local / lib и заголовки в /usr/local/include/libbson-1.0 и /usr/local/include/libmongoc-1.0 соответственно.
Я успешно запустил cmake из каталога mongo-cxx-driver / build, и это был весь вывод в оболочку:

~/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

когда я запускаю make form из каталога mongo-cxx-driver, я получаю следующую ошибку:

...
[  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.

Видимо компилятор не может найти те, которые включают в себя … но почему? Разве это не то, для чего LIBBSON_DIR и LIBMONGOC_DIR были установлены в командной строке cmake?

Отредактировано:
Я создал драйвер C и libbson из их исходников git, используя cmake; делать; sudo сделать установку.
Сегодня я запустил драйвер mongo-cxx с нуля, чтобы задокументировать все проблемы на этом пути.
cmake в mongo-cxx-driver / build сгенерировал следующий вывод:

~/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".

Журнал из cmake в /mongo-cxx-driver/build/CMakeFiles/CMakeOutput.log содержит (показывает только соответствующие строки 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:
0Compilation 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_1ae1aDetecting 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_a8d63Feature 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_9a269Feature 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

3

Решение

Нашел проблему. @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 не был установлен. Быстрая установка через homebrew позже, я запустил ту же строку и получил:

~/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 тоже.

Спасибо за вашу помощь 🙂

1

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]