Mac更新完系统出现两步报错及解决方法

Mac更新完系统,通过命令行准备编译C++文件时,报错:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)

解决方法:更新xcode,在命令行运行

xcode-select --install

安装完,重新编译,报错:

CMake Error at /opt/homebrew/Cellar/cmake/3.25.0/share/cmake/Modules/CMakeTestCCompiler.cmake:70 (message):
  The C compiler

    "/Library/Developer/CommandLineTools/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/caishuxian/GCNO/build/CMakeFiles/CMakeScratch/TryCompile-76ti7x
    
    Run Build Command(s):/usr/bin/make -f Makefile cmTC_39711/fast && /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/cmTC_39711.dir/build.make CMakeFiles/cmTC_39711.dir/build
    Building C object CMakeFiles/cmTC_39711.dir/testCCompiler.c.o
    /Library/Developer/CommandLineTools/usr/bin/cc   -arch arm64 -MD -MT CMakeFiles/cmTC_39711.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_39711.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_39711.dir/testCCompiler.c.o -c /Users/caishuxian/GCNO/build/CMakeFiles/CMakeScratch/TryCompile-76ti7x/testCCompiler.c
    Linking C executable cmTC_39711
    /opt/homebrew/Cellar/cmake/3.25.0/bin/cmake -E cmake_link_script CMakeFiles/cmTC_39711.dir/link.txt --verbose=1
    /Library/Developer/CommandLineTools/usr/bin/cc  -arch arm64 -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_39711.dir/testCCompiler.c.o -o cmTC_39711 
    ld: library 'System' not found
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[1]: *** [cmTC_39711] Error 1
    make: *** [cmTC_39711/fast] Error 2
    
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)

解决方法:删除原有 build 文件夹,重新创建新 build 文件夹。

相关推荐

  1. Mac更新系统出现解决方法

    2024-07-18 09:00:02       22 阅读
  2. 解决子组件没有渲染出现

    2024-07-18 09:00:02       51 阅读
  3. 常见日志解决方法

    2024-07-18 09:00:02       18 阅读
  4. ubuntu 修改系统时间,解决更新软件问题

    2024-07-18 09:00:02       68 阅读
  5. PaddleHub解决方法示例代码

    2024-07-18 09:00:02       49 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-18 09:00:02       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-18 09:00:02       72 阅读
  3. 在Django里面运行非项目文件

    2024-07-18 09:00:02       58 阅读
  4. Python语言-面向对象

    2024-07-18 09:00:02       69 阅读

热门阅读

  1. UNIX中sigaction和sigevent有啥区别

    2024-07-18 09:00:02       20 阅读
  2. MySQL第七次作业

    2024-07-18 09:00:02       19 阅读
  3. C语言 二叉树,一个猜动物的小游戏

    2024-07-18 09:00:02       16 阅读
  4. RabbitMQ 和 RocketMQ 的区别

    2024-07-18 09:00:02       22 阅读
  5. conda 使用

    2024-07-18 09:00:02       18 阅读
  6. 为什么MySQL会选择B+树作为索引

    2024-07-18 09:00:02       24 阅读
  7. 计算机视觉篇2 图像分类

    2024-07-18 09:00:02       19 阅读
  8. B树(B-Tree)数据结构

    2024-07-18 09:00:02       22 阅读
  9. 547. 省份数量

    2024-07-18 09:00:02       23 阅读
  10. 学习小记-Kafka相较于其他MQ有啥优势?

    2024-07-18 09:00:02       19 阅读
  11. 达梦数据库生成guid字符串

    2024-07-18 09:00:02       22 阅读