llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.17k stars 12.04k forks source link

Apple's Xcode 10 changes to autodetect /usr/include in SDK needs to be ported to llvm.org clang #38193

Open llvmbot opened 6 years ago

llvmbot commented 6 years ago
Bugzilla Link 38845
Version 7.0
OS MacOS X
Reporter LLVM Bugzilla Contributor
llvmbot commented 6 years ago
I've gotten a clarification on how Apple has handled the removal of the SDK from / in Xcode 10 on 10.14. They actually haven't patched the compiler itself in any way. Rather the compiler stub executables in /usr/bin have been modified to call the compilers through the xcrun program which sets the SDKROOT so they can find the system headers through the SDK.
MacPorts currently implements this in their llvm packaging by using compiler wrappers of the form...

!/bin/bash

if [ -x /usr/bin/xcrun ] ; then exec /usr/bin/xcrun EXEC_PATH "${@}" else exec EXEC_PATH "${@}"

So llvm.org needs to find a way to mimic the Apple Xcode 10 changes by introducing compiler wrappers for the installed compilers on 10.14 and later in order to address the deprecation of system headers in /.

Note that the actual compiler executables in Xcode 10 can't find the buried system headers in the SDK on their own without being called through xcrun.

llvmbot commented 6 years ago

The current llvm 7.0 clang compiler code appears to be missing the changes from clang in Xcode 10 that allows the /usr/include in the SDK to be automatically detected in the absence of the root level /usr/include. These changes need to be ported to llvm.org's clang so that the headers in the SDK's /usr/include can be used in the absence of the installation of the fall back header package.

This issue becomes apparent when trying to do a 3-stage bootstrap of llvm 7.0.0 using Xcode 10 on macOS 10.14 as the stage1 compiler fails to configure for the stage2 bootstrap due to the absence of /usr/include and its inability to automatically find that directory in the SDK.

llvmbot commented 4 months ago

@llvm/issue-subscribers-clang-driver

Author: None (llvmbot)

| | | | --- | --- | | Bugzilla Link | [38845](https://llvm.org/bz38845) | | Version | 7.0 | | OS | MacOS X | | Reporter | LLVM Bugzilla Contributor |