小编alw*_*gie的帖子

M1 MacBook Pro 和 cmake 的编译错误

我刚刚拿到了新的 M1 MacBook Pro,正在尝试编译大学工作所需的代码库。以下是我已采取的步骤:

  1. 我使用 Rosetta 将终端设置为始终打开。
  2. 安装的自制软件using /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  3. 使用安装的cmakebrew install cmake
  4. 运行cmake <path to source>(这很好用)
  5. 运行make(失败)

这是我得到的错误:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stdlib.h:97:15: fatal error: 
      'stdlib.h' file not found
#include_next <stdlib.h>
Run Code Online (Sandbox Code Playgroud)

我尝试卸载并重新安装 Xcode 和 CommandLineTools,但无济于事。

使用 cmake gui 应用程序时,我收到不同的错误。我将其设置为使用 CommandLineTools/SDKs/MacOsX11.0.sdk。

使用此 cmake gui 设置生成和配置构建文件后运行时make,出现以下错误:

    -- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info …
Run Code Online (Sandbox Code Playgroud)

c c++ macos xcode cmake

7
推荐指数
1
解决办法
9579
查看次数

标签 统计

c ×1

c++ ×1

cmake ×1

macos ×1

xcode ×1