I've got GCC 9 installed via homebrew on macOS Catalina 10.15.1. I'm setting -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
. When compiling a file that includes stdio.h
, I get compile errors:
/usr/local/Cellar/gcc/9.2.0_1/lib/gcc/9/gcc/x86_64-apple-darwin19/9.2.0/include-fixed/stdio.h: In function 'perror':
/usr/local/Cellar/gcc/9.2.0_1/lib/gcc/9/gcc/x86_64-apple-darwin19/9.2.0/include-fixed/stdio.h:183:28: error: expected declaration specifiers before '__cold'
183 | void perror(const char *) __cold;
| ^~~~~~
/usr/local/Cellar/gcc/9.2.0_1/lib/gcc/9/gcc/x86_64-apple-darwin19/9.2.0/include-fixed/stdio.h:200:1: error: expected declaration specifiers before '__attribute__'
200 | __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of tmpnam(3), it is highly recommended that you use mkstemp(3) instead.")
| ^~~~~~~~~~~~~~~~
/usr/local/Cellar/gcc/9.2.0_1/lib/gcc/9/gcc/x86_64-apple-darwin19/9.2.0/include-fixed/stdio.h:219:10: fatal error: _ctermid.h: No such file or directory
219 | #include <_ctermid.h>
| ^~~~~~~~~~~~
Is there any solution to this? Is this a GCC bug or homebrew?