- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The version_info_macos.sh script which extracts version information from the compiler on Mac OS X is using the wrong switch, introducing the possibility of retrieving a result the script can't use.
The script reads version information by using `gcc -v`, but this is actually the switch for verbose output; it only incidentally produces a version string. Because it produces verbose output, under some circumstances it will introduce extraneous information and may produce a string with an extra quotation mark, breaking parsing. See https://github.com/mxcl/homebrew/pull/22837 for an example of where this occurs.
The attached patch fixes this by using the first line of `gcc --version` instead. Presumably similar issues will occur on other platforms, but I haven't tested or altered their scripts.
This was tested on Mac OS X 10.7.5 using GCC and clang as provided by Xcode 4.6.3.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This "fix" becomes irrelevant but also selects the wrong information in an up-to-date environment (BTW, note the "Deprecation and Removal Notice" in that document):
[plain]
$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
$ gcc -v </dev/null 2>&1 | grep 'version'
Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
$ gcc --version </dev/null 2>&1 | head -1
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
$
[/plain]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the report and provided logs. Fixed (not '-v' however, since '--version' does not provide information in desired form as Raf showed).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, Anton! Can you provide the fix you used? I'd like to provide a patch for my users. I had been using the --version patch earlier because it works with all compilers distributed by Apple in earlier Xcodes.
Raf, I am intimitely aware of the situation in Xcode 5. I work on a Mac OS X package manager, and I've been preparing for Apple's removal of the final GCC-based compiler in Xcode 5 for months.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would have understood if you hadn't looked at Xcode 5 yet, but...

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page