升级到 Catalina 10.15 后无法在 Mac 上编译 C 程序 [英] Can't compile a C program on a Mac after upgrading to Catalina 10.15

查看:23
本文介绍了升级到 Catalina 10.15 后无法在 Mac 上编译 C 程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个以前的问题 不能升级到 Mojave 后在 Mac 上编译 C 程序,答案已经涵盖了大部分问题的变化.

现在——截至 2019 年 10 月 7 日星期一——您可以升级到 macOS Catalina 10.15.再一次,在升级过程中,/usr/include 目录被更新吹走了,即使在升级(从 Mojave 10.14.6)到 Catalina 之前安装了 XCode 11.0.因此,编译器构建为期望有一个 /usr/include 目录不再工作.

针对 Mojave 问题的主要推荐步骤 - 使用命令:

<块引用>

打开/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

不能正常工作,因为目录 /Library/Developer/CommandLineTools/Packages/ 不存在(所以还没有要打开的 .pkg 文件).

是否有一种好的(官方)方法来创建和填充目录 /usr/include?

解决方案

对于我来说,将以下路径添加到 CPATH 解决了这个问题:

export CPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include

There's a previous question Can't compile C program on a Mac after upgrade to Mojave, and the answers to that have covered most of the variations on what goes wrong.

Now — as of Monday 2019-10-07 — you can upgrade to macOS Catalina 10.15. Once again, during the upgrade, the /usr/include directory has been blown away by the update, even though XCode 11.0 was installed before upgrading (from Mojave 10.14.6) to Catalina. Consequently, compilers built to expect that there is a /usr/include directory do not work any longer.

The main recommended step for the Mojave issues — using the command:

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

does not work out of the gate because the directory /Library/Developer/CommandLineTools/Packages/ does not exist (so there's not yet a .pkg file to open).

Is there a good (official) way to create and populate the directory /usr/include?

解决方案

For me adding the following path to CPATH solved the issue:

export CPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include

这篇关于升级到 Catalina 10.15 后无法在 Mac 上编译 C 程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆