GCC with-gxx-include-dir is set to iOS 11.4 simulator
I was seeing a similar issue.
$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/c++/4.2.1
In my case, that configuration resulted in includes like #include <stdlib.h>
referencing the iOS/iPhone simulator platform libraries rather than the macOS libraries. This resulted in my getting errors about the wrong architecture being used when compiling.
The only viable solution I found was to uninstall Xcode (deleting the app from /Applications
) and uninstall the command line tools. That and a reboot seemed to resolve this issue in my case.