[MacPorts] #59113: gcc: cannot find systems headers with Xcode 11

MacPorts noreply at macports.org
Sat Sep 28 22:11:28 UTC 2019


#59113: gcc: cannot find systems headers with Xcode 11
-----------------------------+--------------------
  Reporter:  abyrvalk        |      Owner:  (none)
      Type:  defect          |     Status:  new
  Priority:  Normal          |  Milestone:
 Component:  ports           |    Version:
Resolution:                  |   Keywords:
      Port:  gcc7 gcc8 gcc9  |
-----------------------------+--------------------

Comment (by kencu):

 How to use Xcode 11 with MacPorts for now:

 1. While you still have Xcode 10, and before you upgrade to Xcode 11,
 create the following directory if needed, to store your SDKs.
 {{{
 /Library/Developer/SDKs
 }}}
 1. check to make sure you have a logical path to the curren 10.14 SDK
 {{{
 xcrun --show-sdk-path
 }}}
 1. copy the SDK over, but NOTE!! You are copying MacOSX.sdk to
 MacOSX10.14.sdk, NOT MacOSX10.14.sdk to MacOSX10.14.sdk. Otherwise you
 just get a useless symlink.
 {{{
 sudo cp -R
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
 /Library/Developer/SDKs/MacOSX10.14.sdk
 }}}
 1. Now upgrade to Xcode 11, and then when you're done with the upgrade,
 symlink the MacOSX10.14.sdk back:
 {{{
 sudo ln -s /Library/Developer/SDKs/MacOSX10.14.sdk
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
 }}}
 1. and you're good to go with Xcode 11, with everything working in
 MacPorts until we sort out a more comprehensive plan for SDKROOT handling.
 1. You can also symlink it into this directory, which is on the search
 path for SDKs, but could be volatile if the CommandLineTools are changed
 or reinstalled.
 {{{
 sudo ln -s /Library/Developer/SDKs/MacOSX10.14.sdk
 /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
 }}}

 using the example in the original post:

 {{{
 macOS 10.14.6 18G103
 Xcode 11.0 11A420a
 }}}

 {{{
 $ cat test.cc
 #include <iostream>

 int main(void)
 {
   std::cout << "Hello world\n";

   return 0;
 }

 $ g++-mp-9 test.cc
 $ ./a.out
 Hello world
 }}}

 What pitfalls may be found on extensive testing are as yet unknown.
 Rebuilding gcc will fail until the 101.5 headers issue is sorted out,
 although you most probably build against the 10.14 headers if you
 `-isysroot` it to there.

-- 
Ticket URL: <https://trac.macports.org/ticket/59113#comment:14>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list