MacOS Mojave中的C标头在哪里?

时间:2018-11-06 10:24:57

标签: c xcode macos header-files macos-mojave

Apple似乎一直在移动其工具,并且使用xcode-select --install来安装命令行工具的旧解决方案不起作用。

在Mojave中,xcode-select不再安装任何东西(GUI始终找不到软件包),命令行工具也不会自行安装在/usr//usr/local中。

3 个答案:

答案 0 :(得分:5)

根据以下文章: https://silvae86.github.io/sysadmin/mac/osx/mojave/beta/libxml2/2018/07/05/fixing-missing-headers-for-homebrew-in-mac-osx-mojave/

这将安装标题:

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

答案 1 :(得分:4)

lb=None con=None mo=None try: lb=books.objects.get(id=l) con=contacts.objects.get(id=n) mo=movies.objects.get(id=o) except (books.DoesNotExist, contacts.DoesNotExist, movies.DoesNotExist): pass 在莫哈韦沙漠为我工作。也许您可以尝试从Mac App Store安装XCode,然后安装开发人员工具?

关于标题位置,我在xcode-select --install中有Apples标题:

/Library/Developer/CommandLineTools/

如果通过brew安装gcc,它将在$ sudo find /Library -name stdio.h /Library/Developer/CommandLineTools/usr/include/c++/v1/stdio.h /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/stdio.h /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/stdio.h 中添加标题:

/usr/local/

(不是Apple的标头,而是GCC / GLIBC)。

使用truss,我可以看到Apple clang使用$ sudo find /usr -name stdio.h /usr/local/Cellar/gcc/8.2.0/include/c++/8.2.0/tr1/stdio.h /usr/local/Cellar/gcc/8.2.0/lib/gcc/8/gcc/x86_64-apple-darwin17.7.0/8.2.0/include/ssp/stdio.h /usr/local/Cellar/gcc/8.2.0/lib/gcc/8/gcc/x86_64-apple-darwin17.7.0/8.2.0/include-fixed/stdio.h /usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/tr1/stdio.h /usr/local/Cellar/gcc/8.1.0/lib/gcc/8/gcc/x86_64-apple-darwin17.5.0/8.1.0/include/ssp/stdio.h /usr/local/Cellar/gcc/8.1.0/lib/gcc/8/gcc/x86_64-apple-darwin17.5.0/8.1.0/include-fixed/stdio.h /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tr1/stdio.h /usr/local/Cellar/gcc/7.3.0_1/lib/gcc/7/gcc/x86_64-apple-darwin17.3.0/7.3.0/include/ssp/stdio.h /usr/local/Cellar/gcc@7/7.3.0/include/c++/7.3.0/tr1/stdio.h /usr/local/Cellar/gcc@7/7.3.0/lib/gcc/7/gcc/x86_64-apple-darwin17.5.0/7.3.0/include/ssp/stdio.h /usr/local/Cellar/gcc@7/7.3.0/lib/gcc/7/gcc/x86_64-apple-darwin17.5.0/7.3.0/include-fixed/stdio.h /usr/local/include/c++/8.2.0/tr1/stdio.h /usr/local/lib/gcc/8/gcc/x86_64-apple-darwin17.7.0/8.2.0/include/ssp/stdio.h /usr/local/lib/gcc/8/gcc/x86_64-apple-darwin17.7.0/8.2.0/include-fixed/stdio.h 中的那个:

CommandLineTools/SDKs

答案 2 :(得分:1)

Xcode现在支持多个SDK和Xcode的多个安装。这些SDK位于Xcode.app内部,默认情况下,Xcode.app已安装在“应用程序”中,但可能位于其他地方。

xcrun --show-sdk-path将显示默认的SDK路径,但可能还有其他路径。例如,一个可能的路径是/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk。从那里usr/include拥有通用的公共头文件,例如标准C头文件,各种Apple头文件在System下的框架中。

/Applications/Xcode.app/Contents/Developer/Platforms中,您可能会找到其他平台的文件夹,例如iPhoneOS.platformAppleTVOS.platform。在这些框架中,Developer/SDKs会为这些平台提供SDK。