It appears Xcode 10.2.1 has broken my gcc
installation. For example, if I try to compile a simple file:
int main() {
printf("Hello, world!\n");
return 0;
}
And run it I get:
dyld: mach-o, but built for simulator (not macOS)
Abort trap: 6
gcc -v
is reporting back with:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
The option that jumps out there being:
--with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/c++/4.2.1
I've recently installed the iOS simulator and I'm assuming doing so has lead to this. Is this expected behaviour? If not, is there any way I can get my gcc
to compile for macOS again rather than iOS.
I've have tried deleting and reinstalling the Xcode Command Line Tools, to no avail. I imagine the solution is to completely uninstall and reinstall Xcode, which I'm a bit hesitant to do.