Using Macports' gcc8 to build C programs and libraries

Mojca Miklavec mojca at
Mon Apr 1 11:13:28 UTC 2019

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


More information about the macports-users mailing list