Help with UsingTheRightCompiler

Ryan Schmidt ryandesign at macports.org
Thu Jul 23 17:31:21 UTC 2020



On Jul 23, 2020, at 11:53, Christopher Jones wrote:

>> Mojave 10.14 and later doesn't provide /usr/include anymore. System headers like <algorithm> are only in the SDK now. Note the -isystem flag with the path to the SDK isn't in that compile line. MacPorts put that flag into CFLAGS, CXXFLAGS, CPPFLAGS, and a comparable one into LDFLAGS for you, so this shows you that your build system isn't respecting those variables yet. Read the makefile portgroup to see if any of the options it provides can help you. Read your project's Makefile to see how it expects those values to be supplied. The Makefile may not provide a way. If not, you'll have to patch it to make it possible.
> 
> clang (and gcc) both respect the SDKROOT env. var. This is an easy way to by  the right SDK root.
> 
> Add this to your login profile
> 
> export SDKROOT=`xcrun --show-sdk-path`
> 
> Note. you can also use xcrun directly with clang/gcc to do the same
> 
>  > xcrun clang …..
> 
> but that requires the build commands to be patched, whereas setting SDKROOT, assuming the build system does not actively remove it, should work.

Oh, well I don't know anything about that, except that MacPorts does already set the SDKROOT variable during all phases, so evidently that isn't working for this build system either.



More information about the macports-dev mailing list