我正在使用 make 工具进行构建,对于 gdal 库,我可以使用以下命令进行配置。
cmake .. -G Xcode \
-DCMAKE_TOOLCHAIN_FILE=../ios-cmake/ios.toolchain.cmake \
-DPLATFORM=OS64COMBINED \
-DENABLE_BITCODE=1 \
-DCMAKE_INSTALL_PREFIX=../install \
-DPROJ_LIBRARY=/opt/homebrew/opt/proj/lib/libproj.a \
-DPROJ_INCLUDE_DIR=/opt/homebrew/opt/proj/include \
-DCRYPTOPP_LIBRARY=/opt/homebrew/opt/cryptopp/lib/libcryptopp.a \
-DCRYPTOPP_INCLUDE_DIR=/opt/homebrew/opt/cryptopp/include \
-DXercesC_LIBRARY=/opt/homebrew/opt/xerces-c/lib/libxerces-c.a \
-DXercesC_INCLUDE_DIR=/opt/homebrew/opt/xerces-c/include \
-DBUILD_APPS=OFF \
-DBUILD_PYTHON_BINDINGS=OFF \
-DWITH_GDAL_TOOLS=OFF \
-DLIBKML_INCLUDE_DIR=/opt/homebrew/Cellar/libkml/1.3.0_1/include \
-DLIBKML_LIBRARY_DIR=/opt/homebrew/Cellar/libkml/1.3.0_1/lib/libkml.a \
-DBOOST_INCLUDE_DIR=/opt/homebrew/Cellar/boost/1.86.0_2/include \
-DBOOST_LIBRARY_DIR=/opt/homebrew/Cellar/boost/1.86.0_2/lib
它成功配置了项目,但在使用“cmake --build . --config Release”进行构建时总是失败。
ERROR :
** BUILD FAILED **
The following build commands failed:
CompileC /Users/santoshsingh/GDAL\ SETUP/gdal/build-ios/build/ogr_LIBKML.build/Release-iphoneos/Objects-normal/arm64/ogrlibkmlgeometry.o /Users/santoshsingh/GDAL\ SETUP/gdal/ogr/ogrsf_frmts/libkml/ogrlibkmlgeometry.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'ogr_LIBKML' from project 'gdal')
In file included from /opt/homebrew/Cellar/libkml/1.3.0_1/include/kml/dom/kml_cast.h:31:
/opt/homebrew/Cellar/libkml/1.3.0_1/include/kml/base/xml_element.h:31:10: fatal error: 'boost/intrusive_ptr.hpp' file not found
31 | #include "boost/intrusive_ptr.hpp"
| ^~~~~~~~~~~~~~~~~~~~~~~~~
查看gdal文档,似乎没有提供
BOOST_INCLUDE_DIR
CMake通用配置选项。因此,将其添加到 cmake 命令可能不会执行任何包含头文件的操作。相反,文档说:
Similarly, recent versions of Homebrew no longer bundle Boost with libkml,
causing a failure to find Boost headers. You should either install Boost
manually or disable libkml when building on MacOS:
cmake -DGDAL_USE_LIBKML=OFF ..
那么在cmake过程的cmake配置步骤中是否有任何警告或提及boost,是否找到了手动安装的版本?
手动安装 boost 后(或找到现有的
BoostConfig.cmake
文件),您可以使用 cmake 选项 -Boost_DIR
指向它。