【问题标题】:CMake compiler identification is unknown for MacOS 10.13.3MacOS 10.13.3 的 CMake 编译器标识未知
【发布时间】:2018-04-20 07:59:04
【问题描述】:

我想通过cmake构建llvm,

我使用cmake -G Xcode ../llvm -DCMAKE_BUILD_TYPE:STRING=MinSizeRel。

但我有麻烦了。

错误日志是:

CMake Deprecation Warning at CMakeLists.txt:14 (cmake_policy):
  The OLD behavior for policy CMP0051 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- The ASM compiler identification is unknown
-- Found assembler: /Library/Developer/CommandLineTools/usr/bin/cc
CMake Error at CMakeLists.txt:45 (project):
  No CMAKE_C_COMPILER could be found.

CMake Error at CMakeLists.txt:45 (project):
  No CMAKE_CXX_COMPILER could be found.

-- Warning: Did not find file Compiler/-ASM
-- Configuring incomplete, errors occurred!

另外,我也用xcrun -find cc,结果是/Library/Developer/CommandLineTools/usr/bin/cc

我能做什么?请帮忙

【问题讨论】:

    标签: macos compiler-errors cmake


    【解决方案1】:

    如果你已经安装了 Xcode,试试这个:

    sudo xcode-select --reset

    【讨论】:

    • 救了我的命!
    • 在 macOS 10.14.5 + XCode 10.1 上像魅力一样工作
    【解决方案2】:

    请尝试一下:

    • 使用什么版本的 CMake/Xcode?最新的?
    • 请。检查源代码中是否没有旧的/以前的 cmake 构建文件夹
    • 如果你升级 Xcode,别忘了再次安装命令行工具

      sudo xcode-select --install

    • 附注:CMake 选项“CMAKE_BUILD_TYPE”对 Xcode 生成器没有用;此变量仅适用于 Makefile 构建 - 从命令行中删除它,当配置生效时,通过以下方式触发构建:

      cmake --build 。 --config MinSizeRel

    【讨论】:

      【解决方案3】:

      试试这个

      sudo xcodebuild -license

      【讨论】:

        猜你喜欢
        • 2023-03-16
        • 2016-12-15
        • 2022-11-03
        • 2014-01-05
        • 1970-01-01
        • 2016-03-04
        • 1970-01-01
        • 2022-07-12
        • 1970-01-01
        相关资源
        最近更新 更多