在现有的C++可执行项目CMAKE中构建Apache Arrow
Building Apache Arrow inside existing C++ Executable project CMAKE
我正在开发一个使用 Apache Arrow 作为依赖项的 C++ CMake 项目。我的目标是能够包含和使用arrow/api.h
。但是,我找不到任何文档或教程来解释我可以做些什么来实现这一目标,所以我的第一个想法是使用 CMake 的FetchContent
将其添加为第三个库,因此,我在CMakeLists.txt
中添加了以下代码:
include(FetchContent REQUIRED)
# INCLUDING APACHE ARROW ================================ #
message(STATUS "Searching for Apache Arrow")
FetchContent_Declare(
arrow
GIT_REPOSITORY https://github.com/apache/arrow.git
GIT_TAG apache-arrow-0.15.1
)
FetchContent_GetProperties(arrow)
if(NOT arrow_POPULATED)
message(STATUS "Populating Arrow")
FetchContent_Populate(arrow)
add_subdirectory(${arrow_SOURCE_DIR}/cpp ${arrow_BINARY_DIR})
endif()
我现在可以在我的项目中找到代码 - 虽然仍然无法使用包含箭头/api.h - 但是每当我尝试构建它时,我都会收到来自 Apache Arrow cpp src 目录CMakeLists.txt
的错误!下面是包含错误的 CMake 生成日志:
-- Searching for Apache Arrow
-- Populating Arrow
-- Building using CMake version: 3.15.3
-- Arrow version: 0.15.1 (full: '0.15.1')
-- Arrow SO version: 15 (full: 15.1.0)
-- clang-tidy not found
-- clang-format not found
-- infer not found
-- Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)
-- Found cpplint executable at CPPLINT_BIN-NOTFOUND
-- Compiler command: C:/MinGW/bin/g++.exe -v
-- Compiler version: Using built-in specs.
COLLECT_GCC=C:/MinGW/bin/g++.exe
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/8.2.0/lto-wrapper.exe
Target: mingw32
Configured with: ../src/gcc-8.2.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --target=mingw32 --prefix=/mingw --disable-win32-registry --with-arch=i586 --with-tune=generic --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-pkgversion='MinGW.org GCC-8.2.0-3' --with-gmp=/mingw --with-mpfr=/mingw --with-mpc=/mingw --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --with-isl=/mingw --enable-libgomp --disable-libvtv --enable-nls --disable-build-format-warnings
Thread model: win32
gcc version 8.2.0 (MinGW.org GCC-8.2.0-3)
-- Compiler id: GNU
Selected compiler gcc 8.2.0
-- Arrow build warning level: CHECKIN
Configured for DEBUG build (set with cmake -DCMAKE_BUILD_TYPE={release,debug,...})
-- Build Type: DEBUG
-- Using approach to find dependencies
-- AWSSDK_VERSION: 1.7.160
-- BOOST_VERSION: 1.67.0
-- BROTLI_VERSION: v1.0.7
-- BZIP2_VERSION: 1.0.8
-- CARES_VERSION: 1.15.0
-- DOUBLE_CONVERSION_VERSION: v3.1.5
-- FLATBUFFERS_VERSION: v1.11.0
-- GBENCHMARK_VERSION: v1.5.0
-- GFLAGS_VERSION: v2.2.0
-- GLOG_VERSION: v0.3.5
-- GRPC_VERSION: v1.20.0
-- GTEST_VERSION: 1.8.1
-- JEMALLOC_VERSION: 5.2.1
-- LZ4_VERSION: v1.8.3
-- MIMALLOC_VERSION: 270e765454f98e8bab9d42609b153425f749fff6
-- ORC_VERSION: 1.5.5
-- PROTOBUF_VERSION: v3.7.1
-- RAPIDJSON_VERSION: 2bbd33b33217ff4a73434ebf10cdac41e2ef5e34
-- RE2_VERSION: 2019-08-01
-- SNAPPY_VERSION: 1.1.7
-- THRIFT_VERSION: 0.12.0
-- THRIFT_MD5_CHECKSUM: 3deebbb4d1ca77dd9c9e009a1ea02183
-- URIPARSER_VERSION: 0.9.3
-- ZLIB_VERSION: 1.2.11
-- ZSTD_VERSION: v1.4.3
-- Boost include dir:
-- Boost libraries:
-- Performing Test DOUBLE_CONVERSION_HAS_CASE_INSENSIBILITY
-- Performing Test DOUBLE_CONVERSION_HAS_CASE_INSENSIBILITY - Failed
-- Building without OpenSSL support. Minimum OpenSSL version 1.0.2 required.
-- Found hdfs.h at: D:/School/Research Project/TestApacheArrow/cmake-build-debug/_deps/arrow-src/cpp/thirdparty/hadoop/include/hdfs.h
-- CMAKE_C_FLAGS: -g -O0 -Wall -Wno-conversion -Wno-sign-conversion -Wno-unused-variable -Werror
-- CMAKE_CXX_FLAGS: -Wno-noexcept-type -fdiagnostics-color=always -g -O0 -Wall -Wno-conversion -Wno-sign-conversion -Wno-unused-variable -Werror
CMake Error at cmake-build-debug/_deps/arrow-src/cpp/src/arrow/CMakeLists.txt:362 (add_dependencies):
add_dependencies called with incorrect number of arguments
CMake Error at cmake-build-debug/_deps/arrow-src/cpp/CMakeLists.txt:814 (export):
export Export set "arrow-targets" not found.
-- ---------------------------------------------------------------------
-- Arrow version: 0.15.1
--
-- Build configuration summary:
-- Generator: MinGW Makefiles
-- Build type: DEBUG
-- Source directory: D:/School/Research Project/TestApacheArrow/cmake-build-debug/_deps/arrow-src/cpp
-- Install prefix: C:/Program Files (x86)/TestApacheArrow
-- Configuring incomplete, errors occurred!
See also "/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/cmake-build-debug/CMakeFiles/CMakeError.log".
我在这里遗漏了什么吗? 这是将Apache Arrow包含在现有项目中的正确方法吗?知道如何解决此错误吗?
我使用的是Windows 10,但最终想在Linux上运行该项目!
我们目前不支持在使用add_subdirectory
的另一个 CMake 项目中包含 Apache Arrow。不过,您可以使用ExternalProject_Add,它应该可以工作。也应该可以使用CMake的内置find_package
工具来查找预构建的包。
我们希望为C++开发人员提供文档齐全且直接的解决方案,包括 Apache Arrow 在他们的 CMake 项目中。我们很乐意在我们的开发人员邮件列表中进一步讨论 dev@arrow.apache.org
相关文章:
- 用CMake构建C++协议
- 最小的CMake构建为Android
- 在Cmake构建CmakeList.txt中读取/解析XML文件
- 如何使用CPack打包多个cmake构建结果?
- Vcpkg Pango CMake 构建失败缺少头文件
- 使用纯 CMake 构建 SFML 时出现运行时错误
- 在 Linux 上使用 CMake 构建 gRPC C++
- 用cmake构建比特币
- 使用CMAKE构建和安装静态库
- OpenCV cmake构建总是在Windows中抛出错误
- 在Yocto中使用Cmake构建Qt5
- 在OSx:ld上使用CMake构建C++项目:找不到体系结构x86_64的符号
- 使用cmake构建google测试单元测试时出现链接器错误
- 尝试使用 MinGW/CMake 构建 GLFW 示例时未定义的引用
- 如何从 Linux 控制台使用 CMake 构建 Eclipse C++ 项目(没有可用的 GUI)
- cmake:构建依赖于非源文件.Qt帮助生成
- 使用 CMake 构建 {fmt} 时出现问题
- C++ CMake 构建错误:未定义对"boost::throw_exception(std::exception const&)"的引用
- 在Travis中为CMAKE构建指定编译器版本
- cmake:构建可执行文件并库并链接它们