【问题标题】:cmath won't build with cmake on MacOS Catalinacmath 不会在 MacOS Catalina 上使用 cmake 构建
【发布时间】: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


【解决方案1】:

尝试重新安装命令行工具。我遇到了同样的问题,通过重新安装命令行工具解决了。

我在终端中运行了这些命令:

  1. sudo rm -rf /Library/Developer/CommandLineTools
  2. xcode-select --install

【讨论】:

    猜你喜欢
    • 2020-02-06
    • 2020-07-28
    • 1970-01-01
    • 2020-02-21
    • 2020-02-14
    • 2020-07-04
    • 1970-01-01
    • 2022-07-12
    • 2021-08-13
    相关资源
    最近更新 更多