Improve '-stdlib=libc++' error message when a too old SDK is used (closes #52)

This just required to move some code around.
The appropriate error message was already there.

Before:

osxcross: error: targeted OS X version must be <= 10.6.0 (SDK)

After:

osxcross: error: libc++ requires Mac OS X SDK 10.7 (or later)
This commit is contained in:
Thomas Pöchtrager 2015-10-28 20:32:10 +01:00
parent 68cca0de16
commit 989c7f3b5f
2 changed files with 20 additions and 12 deletions

View File

@ -516,15 +516,6 @@ bool Target::setup() {
}
}
if (OSNum > SDKOSNum) {
err << "targeted OS X version must be <= " << SDKOSNum.Str() << " (SDK)"
<< err.endl();
return false;
} else if (OSNum < OSVersion(10, 4)) {
err << "targeted OS X version must be >= 10.4" << err.endl();
return false;
}
if (haveArch(Arch::x86_64h) && OSNum < OSVersion(10, 8)) {
// -mmacosx-version-min= < 10.8 in combination with '-arch x86_64h'
// may cause linker errors.
@ -556,6 +547,15 @@ bool Target::setup() {
}
}
if (OSNum > SDKOSNum) {
err << "targeted OS X version must be <= " << SDKOSNum.Str() << " (SDK)"
<< err.endl();
return false;
} else if (OSNum < OSVersion(10, 4)) {
err << "targeted OS X version must be >= 10.4" << err.endl();
return false;
}
std::string CXXHeaderPath = SDKPath;
string_vector AdditionalCXXHeaderPaths;

View File

@ -339,6 +339,12 @@ eval $(osxcross-conf)
run o64-clang++ -stdlib=foo
[ "$status" -eq 1 ]
[[ "${lines[0]}" == *error:\ value\ of\ \'-stdlib=\'\ must\ be\ \'default\',\ \'libc++\'\ or\ \'libstdc++\' ]]
if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION "<" 10.7) -eq 1 ]; then
run o64-clang++ -stdlib=libc++
[ "$status" -ne 0 ]
[[ "${lines[0]}" == *error:\ libc++\ requires\ Mac\ OS\ X\ SDK\ 10.7\ \(or\ later\) ]]
fi
}
@test "precompiled headers" {
@ -411,9 +417,11 @@ eval $(osxcross-conf)
[[ "${lines[0]}" != *\ -m64\ * ]]
[[ "${lines[0]}" != *\ -arch\ * ]]
run o64-g++ -arch x86_64h
[ "$status" -eq 1 ]
[[ "${lines[0]}" == *error:\ gcc\ does\ not\ support\ architecture\ \'x86_64h\' ]]
if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION ">=" 10.8) -eq 1 ]; then
run o64-g++ -arch x86_64h
[ "$status" -eq 1 ]
[[ "${lines[0]}" == *error:\ gcc\ does\ not\ support\ architecture\ \'x86_64h\' ]]
fi
fi
}