Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Xamarin.Android.Build.Tasks/Tasks/Aot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ bool DoExecute () {
throw new Exception ("Unsupported Android target architecture ABI: " + abi);
}

if (!NdkUtil.ValidateNdkPlatform (Log, AndroidNdkDirectory, arch, requireLibm:EnableLLVM)) {
if (!NdkUtil.ValidateNdkPlatform (Log, AndroidNdkDirectory, arch, enableLLVM:EnableLLVM)) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ bool DoExecute ()
break;
}

if (!NdkUtil.ValidateNdkPlatform (Log, AndroidNdkDirectory, arch, requireLibm:true)) {
if (!NdkUtil.ValidateNdkPlatform (Log, AndroidNdkDirectory, arch, enableLLVM: false)) {
return false;
}

Expand Down
10 changes: 8 additions & 2 deletions src/Xamarin.Android.Build.Tasks/Tasks/NdkUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Xamarin.Android.Tasks
{
public static class NdkUtil {

public static bool ValidateNdkPlatform (TaskLoggingHelper log, string ndkPath, AndroidTargetArch arch, bool requireLibm)
public static bool ValidateNdkPlatform (TaskLoggingHelper log, string ndkPath, AndroidTargetArch arch, bool enableLLVM)
{
// Check that we have a compatible NDK version for the targeted ABIs.
NdkUtil.NdkVersion ndkVersion;
Expand All @@ -30,12 +30,18 @@ public static bool ValidateNdkPlatform (TaskLoggingHelper log, string ndkPath, A

// NDK r10d is buggy and cannot link x86_64 ABI shared libraries because they are 32-bits.
// See https://code.google.com/p/android/issues/detail?id=161421
if (requireLibm && ndkVersion.Version == 10 && ndkVersion.Revision == "d" && arch == AndroidTargetArch.X86_64) {
if (enableLLVM && ndkVersion.Version == 10 && ndkVersion.Revision == "d" && arch == AndroidTargetArch.X86_64) {
log.LogCodedError ("XA3004", "Android NDK r10d is buggy and provides an incompatible x86_64 libm.so. " +
"See https://code.google.com/p/android/issues/detail?id=161422.");
return false;
}

if (enableLLVM && (ndkVersion.Version < 10 || (ndkVersion.Version == 10 && ndkVersion.Revision[0] < 'd'))) {
log.LogMessage (MessageImportance.High,
"The detected Android NDK version is incompatible with the targeted LLVM configuration, " +
"please upgrade to NDK r10d or newer.");
}

return true;
}

Expand Down