Compilation error with Mojave: error: ‘_Atomic’ does not name a type
Solution 1:
I encountered the same problem myself. The error is actually reported by g++, a C++ compiler. On MacOS 10.14.4, the header file <sys/ucred.h>
uses the _Atomic
keyword for C++, although it is only defined in the C standard. (I assume that Apple's compiler clang++
defines this keyword as extension to the C++ standard.)
The proper fix is to tell gcc to "fixinclude" the header file <sys/ucred.h>
. This patch does this. This is a patch that needs to be applied to the source code of GCC 8.3.0 before building it.
Solution 2:
You need to use a C11 compatible compiler in order to have support for the _Atomic keyword.
Ensure that you are compiling with a recent, modern compiler, and that STDC_NO_ATOMICS is not defined.
It might be easier for you to use HomeBrew in order to compile it without having to configure anything yourself. After installing HomeBrew, you can install gcc with:
brew install gcc