【发布时间】:2020-11-19 01:49:07
【问题描述】:
我最近使用 Xcode 11.6 和命令行工具安装了 MacOS Catalina (10.15.6)。我正在尝试使用以下 cmakelists.txt 构建一个使用 Boost::Python 的 C++ 库:
cmake_minimum_required(VERSION 3.5)
project(pyLib_sdk)
# Find default python libraries and interpreter
find_package (Python3 COMPONENTS Interpreter Development)
find_package(Boost 1.72.0 REQUIRED COMPONENTS python)
include_directories(${Boost_INCLUDE_DIR} ${Python3_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
# Build and link the pylib_auto module
add_library(pylib_auto SHARED pylib_auto.cpp)
target_link_libraries(pylib_auto ${Boost_LIBRARIES} ${Python3_LIBRARIES})
add_dependencies(pylib_auto Boost)
# Tweaks the name of the library to match what Python expects
set_target_properties(pylib_auto PROPERTIES SUFFIX .so)
set_target_properties(pylib_auto PROPERTIES PREFIX "")
cmake 可以很好地构建 make 文件,但是当我运行 make 时,它会产生以下错误:
In file included from /usr/local/include/boost/config/no_tr1/cmath.hpp:21:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:317:9: error: no
member named 'signbit' in the global namespace
using ::signbit;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:318:9: error: no
member named 'fpclassify' in the global namespace
using ::fpclassify;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:319:9: error: no
member named 'isfinite' in the global namespace; did you mean 'finite'?
using ::isfinite;
~~^
/usr/local/include/math.h:752:12: note: 'finite' declared here
extern int finite(double)
^
这只是错误的 sn-p,但我相信日志的其余部分只是从第一个错误与 cmath 级联而来。有没有其他人遇到过这个问题?
【问题讨论】:
-
很遗憾没有。我昨天尝试了该解决方案,但没有成功。
标签: c++ boost macos-catalina boost-python cmath