Using Macports' gcc8 to build C programs and libraries

Chris Jones jonesc at
Mon Apr 1 12:35:32 UTC 2019


I suspect the issue is Apple is seemingly phasing out the standard 
includes as part of /usr/include. Can you test to see if you have the file



I suspect you don't, even if you have the commandline tools package 

In Xcode 10, Apple is shipping a hidden dmg that installs these. See for 


As the above article states, going forward you should not assume that 
/usr/include will be present. My bet is that dmg will disappear one day.

This is why I still maintain if you want to support macOS, you should be 
looking to support clang. The command line package installed versions of 
these are just wrappers around Xcode

Titan ~ > which clang
Titan ~ > clang -v
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix

and as such by default know to look in the Xcode area for the various 

cheers Chris

On 01/04/2019 12:13 pm, Mojca Miklavec wrote:
> On Mon, 1 Apr 2019 at 12:18, Sean Lake wrote:
>> As far as I know I have command line tools installed - I'm not even
>> sure how I could get MacPorts installed without them. Adding
>> "-I/Applications/"
>> to CFLAGS appears to have fixed the problem
> Does that mean that clang automatically searches the relevant path and gcc not?
> Does that mean that we would need to somehow find a fix for our gcc ports?
> It's true that gcc is a second-class citizen on macs nowadays. It
> makes perfect sense to make sure that the project is buildable with
> gcc, in particular if you spend a lot of time optimizing flags, but it
> would also be nice to test compilations with clang, just in case.
> (You probably know this, but note that if you plan to distribute
> binaries for your software and you compile it with gcc, the users
> might need to have macports installed as well, since the binaries will
> depend on libstdc++ which is not present on stock macOS. Unless you
> statically link with libstdc++ which is slightly less trivial than on
> Linux.)
> Mojca

More information about the macports-users mailing list