This repository has been archived by the owner. It is now read-only.

brew doctor: add check for outdated compilers #11518

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
8 participants
Contributor

mistydemeo commented Apr 8, 2012

I've noticed a lot of users lately with Xcode 4.3 who are getting build failures because they haven't installed the CLT. We weren't detecting that since we were only looking for the absence of compilers - if the user installed overtop an old Xcode, they would have some outdated compilers and headers rather than none.

I've added a list of standard compiler versions to MacOS, and a check in brew doctor that ensures the user has the correct build for whatever version of Xcode they're using. The list of compilers is from the wiki, but wanted to check that there weren't any wrong build versions before pushing - I've only got a couple Xcode versions to check.

Any objections to placing the compiler list in MacOS? I thought about putting it straight in brew doctor, but it seemed like it might be useful elsewhere.

Contributor

staticfloat commented Apr 9, 2012

This would close #11404

Owner

MikeMcQuaid commented Apr 9, 2012

Wow, nice. I do think that perhaps the list of versions is perhaps a bit overkill; we can probably just check the latest versions of Xcode we support (e.g. the latest on 10.5, the latest 3.x and 4.x on 10.6 and the latest 4.x on 10.7).

Contributor

mistydemeo commented Apr 9, 2012

@MikeMcQuaid That's a good point. Maybe limit the Xcode versions to 3.1.4, 3.2.6, 4.2(?)/SL, and 4.3.x, and only run the test if #check_for_latest_xcode returns something - the user will already be getting nagged up upgrade Xcode.

Contributor

jacknagel commented Apr 9, 2012

Any objections to placing the compiler list in MacOS?

The only thing I can think of that might also utilize this is the fails_with code, but I wrote that to work without needing this mapping, so I dunno.

Maybe limit the Xcode versions to 3.1.4, 3.2.6, 4.2(?)/SL, and 4.3.x

Agree with this.

Contributor

mistydemeo commented Apr 9, 2012

@jacknagel What's the latest version of Xcode available for Snow Lep?

Contributor

mistydemeo commented Apr 9, 2012

Come to think of it, there are a few users with an earlier 4.x on Snow Lep because they paid the $5 to upgrade prior to Lion's release. 4.0 should probably be included for that reason.

Contributor

adamv commented Apr 9, 2012

@mistydemeo 3.2.6 is the last free version for Snow Leopard, and is what I use. 4.x is available for paying developers; Jack uses this version but I don't.

Contributor

adamv commented Apr 9, 2012

(Hence build errors for 4.x against Snow Leopard get little attention from me.)

Contributor

mistydemeo commented Apr 9, 2012

@adamv Right, I just wasn't sure if 4.x is up to date on 10.6 with the latest on 10.7 - I thought I remembered that support there went up to 4.2.something.

Contributor

jacknagel commented Apr 9, 2012

4.2 is end of life for Snow Leopard; 4.0.{0,1,2} are out there in the wild but it is no longer possible to download it.

brew doctor: add check for outdated compilers
A common source of build problems on Xcode 4.3+ is outdated compilers,
usually when a user has installed over top of an old version and hasn't
installed the CLT. Since the compilers from the previous Xcode are still
around, brew doctor wouldn't complain.

This adds a hash containing a list of the canonical compiler versions
for supported versions of Xcode, and adds a check against that to determine
whether a given installation has any compilers which are out of date.
Contributor

mistydemeo commented Apr 10, 2012

@jacknagel 4.2.0? Or is 4.2.1 available?

Updated - it's now down to 3.1.4, 3.2.6, 4.0.0, 4.0.1, 4.0.2, 4.2.0, and the 4.3.x variants. This should cover the supported versions in the wild for 10.5, 10.6 and 10.7. The check will now be skipped if the user's Xcode isn't up to date.

Contributor

jacknagel commented Apr 10, 2012

4.2.0? Or is 4.2.1 available?

No 4.2.1 for SL afaict. I seem to remember seeing it in a --config dump once, but it's not available from the developer site, so...

Contributor

mistydemeo commented Apr 10, 2012

OK, think the Xcode version list is good now.

The only thing I can think of that might also utilize this is the fails_with code, but I wrote that to work without needing this mapping, so I dunno.

Yeah, that's true. I'd still be tempted to leave it in MacOS in case, but if anyone objects I don't mind transferring straight into doctor.

Will push this unless there are any objections.

Owner

MikeMcQuaid commented Apr 10, 2012

Sounds good to me.

Contributor

Sharpie commented Apr 10, 2012

Looks good. Issue #10979 is another example of a place where this can really help people out.

Contributor

mistydemeo commented Apr 11, 2012

Pushed!

thepaul commented Apr 11, 2012

This is a little problematic, at least for users like me who only have the CLT installed (don't know if the problem extends to other places).

The xcode_version method being used here, at least in the xcode-gcc-installer/CLT-only case, only returns two-part version numbers for the 4.x series (like "4.0", "4.1", "4.2", and "4.3"). Those don't match the keys in StandardCompilers, so brew doctor complains loudly now.

It's not clear whether StandardCompilers should change or xcode_version should always return three-part version numbers. It seems like it would be appropriate to fix here, though, since this was quite recent and it introduced the bug. But if you all don't agree, I'll go ahead and do a new pull request.

Contributor

mistydemeo commented Apr 12, 2012

@thepaul Can you elaborate on what problem you're getting in the brew doctor? Is it the outdated version warning, or the compilers warning? Because the StandardCompilers check should be completely skipped if your Xcode version isn't in the hash.

Contributor

jacknagel commented Apr 12, 2012

Hmm, this warning prints for me but it shouldn't.

MacOS.xcode_version doesn't return "4.0.0", "4.2.0", "4.3.0", but rather "4.0", "4.2", and "4.3".

thepaul commented Apr 12, 2012

@mistydemeo I get the compilers warning:

Warning: Your compilers are different from the standard versions for your Xcode.
If you have Xcode 4.3 or newer, you should install the Command Line Tools for
Xcode from within Xcode's Download preferences.
Otherwise, you should reinstall Xcode.

..although I do have the latest version of the CLT.

/usr/local% clang --version
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.3.0
Thread model: posix
Contributor

mistydemeo commented Apr 12, 2012

Should be fixed by 802616b

Sorry about the bug.

Sharpie pushed a commit to Sharpie/homebrew that referenced this pull request Jun 18, 2012

brew doctor: add check for outdated compilers
A common source of build problems on Xcode 4.3+ is outdated compilers,
usually when a user has installed over top of an old version and hasn't
installed the CLT. Since the compilers from the previous Xcode are still
around, brew doctor wouldn't complain.

This adds a hash containing a list of the canonical compiler versions
for supported versions of Xcode, and adds a check against that to determine
whether a given installation has any compilers which are out of date.

Closes #11518.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
Contributor

dotnetCarpenter commented Nov 4, 2012

I get the same message as @thepaul although brew doctoris correct, I don't have CLT installed according to Xcode -> Preferences -> Downloads -> Components.
But I do however get the same output when I type `clang --version``

clang --version
Apple clang version 3.1 (tags/Apple/clang-318.0.61) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix

I've never had any build issues so I'm baffled to why I would need to install CLT.

Contributor

mistydemeo commented Nov 4, 2012

@dotnetCarpenter What version of Xcode are you using?

The reason we make that recommendation is because mismatched compiler versions typically come from not keeping your CLT installation up to date with your Xcode installation. It could also happen if you had a pre-Xcode 4.3 installation that was not properly uninstalled, though with a clang version 3.1 that's not likely the case.

(By the way, we typically prefer new issues for issues like this, not comments on months-old issues.)

Contributor

dotnetCarpenter commented Nov 4, 2012

Version 4.5.1 (4G1004)

ahh gotcha.

(I wasn't sure if this was an issue or not as I don't really understand the problem. But I'll gladly create an issue you can tick off, if this is a bug)

Contributor

mistydemeo commented Nov 4, 2012

It's not a bug; Xcode 4.5.1 includes clang 4.1. File a new issue and we'll figure out where the outdated compiler came from.

snakeyroc3 pushed a commit to snakeyroc3/homebrew that referenced this pull request Dec 17, 2012

brew doctor: add check for outdated compilers
A common source of build problems on Xcode 4.3+ is outdated compilers,
usually when a user has installed over top of an old version and hasn't
installed the CLT. Since the compilers from the previous Xcode are still
around, brew doctor wouldn't complain.

This adds a hash containing a list of the canonical compiler versions
for supported versions of Xcode, and adds a check against that to determine
whether a given installation has any compilers which are out of date.

Closes #11518.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>

@xu-cheng xu-cheng locked and limited conversation to collaborators Feb 16, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.