Add NDK 27 as minimum for Android to fix 16kb page alignment issue on libc++_shared.so
This commit is contained in:
@@ -67,7 +67,8 @@ namespace Flax.Build.Platforms
|
||||
if (subDirs.Length != 0)
|
||||
{
|
||||
Utilities.SortVersionDirectories(subDirs);
|
||||
FindNDK(subDirs.Last());
|
||||
for (int i = subDirs.Length - 1; i >= 0 && !IsValid; i--)
|
||||
FindNDK(subDirs[i]);
|
||||
}
|
||||
|
||||
if (!IsValid)
|
||||
@@ -109,6 +110,14 @@ namespace Flax.Build.Platforms
|
||||
}
|
||||
if (IsValid)
|
||||
{
|
||||
var minVersion = new Version(27, 0); // NDK 27 (and newer) contains the libc++_shared.so with 16kb alignment
|
||||
if (Version < minVersion)
|
||||
{
|
||||
IsValid = false;
|
||||
Log.Verbose(RootPath);
|
||||
Log.Error(string.Format("Unsupported Android NDK version {0}. Minimum supported is {1}.", Version, minVersion));
|
||||
return;
|
||||
}
|
||||
RootPath = sdkPath;
|
||||
Log.Info(string.Format("Found Android NDK {1} at {0}", RootPath, Version));
|
||||
}
|
||||
|
||||
@@ -104,6 +104,9 @@ namespace Flax.Build.Platforms
|
||||
args.Add("-fno-function-sections");
|
||||
}
|
||||
|
||||
// Support 16kb pages
|
||||
args.Add("-D__BIONIC_NO_PAGE_SIZE_MACRO");
|
||||
|
||||
switch (Architecture)
|
||||
{
|
||||
case TargetArchitecture.x86:
|
||||
@@ -195,10 +198,10 @@ namespace Flax.Build.Platforms
|
||||
{
|
||||
// https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#libc
|
||||
var ndkPath = AndroidNdk.Instance.RootPath;
|
||||
var libCppSharedPath = Path.Combine(ndkPath, "sources/cxx-stl/llvm-libc++/libs/", GetAbiName(Architecture), "libc++_shared.so"); // NDK24 (and older) location
|
||||
var libCppSharedPath = Path.Combine(ndkPath, "toolchains/llvm/prebuilt", AndroidSdk.GetHostName(), "sysroot/usr/lib/", GetToolchainName(TargetPlatform.Android, Architecture), "libc++_shared.so"); // NDK25+ location
|
||||
if (!File.Exists(libCppSharedPath))
|
||||
{
|
||||
libCppSharedPath = Path.Combine(ndkPath, "toolchains/llvm/prebuilt", AndroidSdk.GetHostName(), "sysroot/usr/lib/", GetToolchainName(TargetPlatform.Android, Architecture), "libc++_shared.so"); // NDK25+ location
|
||||
libCppSharedPath = Path.Combine(ndkPath, "sources/cxx-stl/llvm-libc++/libs/", GetAbiName(Architecture), "libc++_shared.so"); // NDK24 (and older) location
|
||||
if (!File.Exists(libCppSharedPath))
|
||||
throw new Exception($"Missing Android NDK `libc++_shared.so` for architecture {Architecture}.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user