Why did installing Xcode command line tools change what 'gcc --version' reports

后端 未结 1 918
伪装坚强ぢ
伪装坚强ぢ 2021-02-13 12:41

Recently I updated Xcode on OS 10.9 to version 5.0.1 through the AppStore. It appeared to me that this update also updated command line tools, for example running gcc --ve

相关标签:
1条回答
  • 2021-02-13 13:23

    I'll structure my answer with a list so that you get the full picture, the answer to your main question being concluded in the last list item:

    • Since Mavericks, the default compiler suite has been Clang/LLVM instead of GNU GCC. Synonyms for gcc and g++ that point to Clang and Clang++ respectively have been kept in order to preserve backwards compatibility and since Clang is very much backwards compatible with GCC, there's no reason not to do so.
    • Since XCode 6 I think, XCode automatically bundles the command line developer tools in the main install and .app bundle for XCode. Same goes for default frameworks and toolkits. Full command line development is still not fully operational at this point, just enabled XCode development.
    • However, in order to successfully do development at the command line one has to execute xcode-select --install in the Terminal app and follow the instructions.
    • Given that the SDK's are now bundled and organized in a directory structure inside XCode.app bundle, the change in gxx-include-dir you noticed is due to the fact that now, /usr/include is merely a soft link now to the proper place for the specific includes:

      $ls -l /usr/include

      lrwxr-xr-x 1 root wheel 112 Feb 2 19:08 /usr/include -> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/

    The last point, is not necessarily a bad thing and xcode-select(1) command can now be used to manage the active SDK. I hope this clarifies things a bit for those confused, since all these (quite big) changes were rolled out in classic Apple fashion, in complete and utter silence.

    0 讨论(0)
提交回复
热议问题