gcc/g++ failures after xcode11 update

Ken Cunningham ken.cunningham.webuse at gmail.com
Tue Sep 24 13:30:56 UTC 2019


> The issue is both macports clang and gcc rely (by default) on /usr/include being present, and this is no longer present by default with Xcode 11

Not exactly. The full logic was outlined by Jeremy here:

https://trac.macports.org/ticket/57612#comment:18 <https://trac.macports.org/ticket/57612#comment:18>


TBH, I’m not sure we should ever be baking an -isysroot into any build files. It’s too fragile.


Jeremy’s suggestion was to either let xcrun decide how to find the correct SDK, or if we wanted to set it ourselves, set the SDKROOT.

<https://github.com/macports/macports-base/pull/109 <https://github.com/macports/macports-base/pull/109>>




The clang front end (cfe) then uses that env var like this:

https://clang.llvm.org/doxygen/Darwin_8cpp_source.html <https://clang.llvm.org/doxygen/Darwin_8cpp_source.html>

void Darwin::AddDeploymentTarget(DerivedArgList &Args) const {
 <> 1655   const OptTable &Opts = getDriver <https://clang.llvm.org/doxygen/classclang_1_1driver_1_1ToolChain.html#a07dab26687a39da186aa21f14abb49f3>().getOpts <https://clang.llvm.org/doxygen/classclang_1_1driver_1_1Driver.html#ab5df585a9901dccb1eb6de21b1f311cd>();
 <> 1656 
 <> 1657   // Support allowing the SDKROOT environment variable used by xcrun and other
 <> 1658   // Xcode tools to define the default sysroot, by making it the default for
 <> 1659   // isysroot.
 <> 1660   if (const Arg *A = Args.getLastArg(options::OPT_isysroot)) {
 <> 1661     // Warn if the path does not exist.
 <> 1662     if (!getVFS <https://clang.llvm.org/doxygen/classclang_1_1driver_1_1ToolChain.html#a470fad84b09ec2876119aff3966d507a>().exists(A->getValue()))
 <> 1663       getDriver <https://clang.llvm.org/doxygen/classclang_1_1driver_1_1ToolChain.html#a07dab26687a39da186aa21f14abb49f3>().Diag <https://clang.llvm.org/doxygen/classclang_1_1driver_1_1Driver.html#a61db7c2f0eb35004127f49fec7a4a121>(clang::diag::warn_missing_sysroot) << A->getValue();
 <> 1664   } else {
 <> 1665     if (char *env = ::getenv("SDKROOT")) {
 <> 1666       // We only use this value as the default if it is an absolute path,
 <> 1667       // exists, and it is not the root path.
 <> 1668       if (llvm::sys::path::is_absolute(env) && getVFS <https://clang.llvm.org/doxygen/classclang_1_1driver_1_1ToolChain.html#a470fad84b09ec2876119aff3966d507a>().exists(env) &&
 <> 1669           StringRef(env) != "/") {
 <> 1670         Args.append(Args.MakeSeparateArg(
 <> 1671             nullptr, Opts.getOption(options::OPT_isysroot), env));
 <> 1672       }
 <> 1673     }
 <> 1674   }
 <> 1675 



I have tried the route of setting SDKROOT, with some success.

<https://github.com/macports/macports-base/pull/147 <https://github.com/macports/macports-base/pull/147>>


Best,

Ken


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20190924/75a12db1/attachment-0001.html>


More information about the macports-dev mailing list