diff --git a/build-tools/create-packs/Microsoft.Android.Runtime.proj b/build-tools/create-packs/Microsoft.Android.Runtime.proj index 6f48f093739..328ed85713b 100644 --- a/build-tools/create-packs/Microsoft.Android.Runtime.proj +++ b/build-tools/create-packs/Microsoft.Android.Runtime.proj @@ -99,12 +99,6 @@ projects that use the Microsoft.Android.Runtimes framework in .NET 6+. Condition=" '%(_AndroidNdkRedistributable.AndroidRID)' == '$(AndroidRID)' And '%(_AndroidNdkRedistributable.Kind)' == 'Toolchain' " /> - - - - - diff --git a/build-tools/scripts/Ndk.projitems b/build-tools/scripts/Ndk.projitems index 9e2ffe303cb..b86068b50d5 100644 --- a/build-tools/scripts/Ndk.projitems +++ b/build-tools/scripts/Ndk.projitems @@ -24,7 +24,6 @@ android-arm arm-linux-androideabi arm - arm True True True @@ -37,7 +36,6 @@ android-arm64 aarch64-linux-android aarch64 - aarch64 True True True @@ -50,7 +48,6 @@ android-x86 i686-linux-android i686 - i386 True False False @@ -63,7 +60,6 @@ android-x64 x86_64-linux-android x86_64 - x86_64 True True True diff --git a/build-tools/scripts/Ndk.targets b/build-tools/scripts/Ndk.targets index 34c74605ac9..17226bbdf1d 100644 --- a/build-tools/scripts/Ndk.targets +++ b/build-tools/scripts/Ndk.targets @@ -28,10 +28,7 @@ <_AndroidNdkRedistributable Include="@(AndroidSupportedTargetJitAbi -> '$(_AndroidNdkSysrootLib)\%(ToolchainPrefix)\%(ApiLevel)\libz.so')" Kind="System" /> <_AndroidNdkRedistributable Include="@(AndroidSupportedTargetJitAbi -> '$(_AndroidNdkSysrootLib)\%(ToolchainPrefix)\%(ApiLevel)\crtbegin_so.o')" Kind="Toolchain" /> <_AndroidNdkRedistributable Include="@(AndroidSupportedTargetJitAbi -> '$(_AndroidNdkSysrootLib)\%(ToolchainPrefix)\%(ApiLevel)\crtend_so.o')" Kind="Toolchain" /> - <_AndroidNdkRedistributable Include="@(AndroidSupportedTargetJitAbi -> '$(_AndroidNdkSysrootLib)\%(ToolchainPrefix)\libc++_static.a')" Kind="CplusPlus" /> - <_AndroidNdkRedistributable Include="@(AndroidSupportedTargetJitAbi -> '$(_AndroidNdkSysrootLib)\%(ToolchainPrefix)\libc++abi.a')" Kind="CplusPlus" /> <_AndroidNdkRedistributable Include="@(AndroidSupportedTargetJitAbi -> '$(_AndroidNdkClangLibLinux)\libclang_rt.builtins-%(ClangArch)-android.a')" Kind="Toolchain" /> - <_AndroidNdkRedistributable Include="@(AndroidSupportedTargetJitAbi -> '$(_AndroidNdkClangLibLinux)\%(UnwindArchDir)\libunwind.a')" Kind="CplusPlus" /> diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/LinkNativeRuntime.cs b/src/Xamarin.Android.Build.Tasks/Tasks/LinkNativeRuntime.cs index d1648e8fdfa..cc2b3391652 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/LinkNativeRuntime.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/LinkNativeRuntime.cs @@ -114,14 +114,14 @@ List OrganizeCommandLineItemsCLR (string abi) // ...and after them the BCL PAL libraries... ret.AddRange (sets[NativeRuntimeComponents.KnownSets.BCL]); - // ...and then the C/C++ runtime libraries + // ...and then the C runtime and compiler support libraries var systemLibs = new Dictionary (StringComparer.Ordinal); foreach (ITaskItem item in GetAbiItems (LinkLibraries, "_RequiredLinkLibraries", abi)) { systemLibs.Add (Path.GetFileName (item.ItemSpec), item); } ret.Add (systemLibs["log"]); - ret.AddRange (sets[NativeRuntimeComponents.KnownSets.CplusPlusRuntime]); + ret.AddRange (sets[NativeRuntimeComponents.KnownSets.CompilerRuntime]); ret.Add (systemLibs["z"]); ret.Add (systemLibs["m"]); ret.Add (systemLibs["dl"]); diff --git a/src/Xamarin.Android.Build.Tasks/Utilities/NativeRuntimeComponents.cs b/src/Xamarin.Android.Build.Tasks/Utilities/NativeRuntimeComponents.cs index 6234630b914..26f08c2e2eb 100644 --- a/src/Xamarin.Android.Build.Tasks/Utilities/NativeRuntimeComponents.cs +++ b/src/Xamarin.Android.Build.Tasks/Utilities/NativeRuntimeComponents.cs @@ -12,7 +12,7 @@ public sealed class KnownSets { public const string BCL = "bcl"; public const string CoreClrRuntime = "coreclr"; - public const string CplusPlusRuntime = "c++"; + public const string CompilerRuntime = "compiler-rt"; public const string XamarinAndroidRuntime = "xaruntime"; } @@ -43,7 +43,7 @@ public Archive (string name, string setName, Func? include = null sealed class ClangBuiltinsArchive : Archive { public ClangBuiltinsArchive (string clangAbi) - : base ($"libclang_rt.builtins-{clangAbi}-android.a", KnownSets.CplusPlusRuntime) + : base ($"libclang_rt.builtins-{clangAbi}-android.a", KnownSets.CompilerRuntime) {} } @@ -72,15 +72,6 @@ public ClrArchive (string name, bool wholeArchive = false) } } - sealed class CplusPlusArchive : Archive - { - public CplusPlusArchive (string name) - : base (name, KnownSets.CplusPlusRuntime) - { - DontExportSymbols = true; - } - } - readonly ITaskItem[]? monoComponents; public readonly List KnownArchives; @@ -127,17 +118,11 @@ public NativeRuntimeComponents (ITaskItem[]? monoComponents) new AndroidArchive ("libxa-shared-bits-release.a"), new AndroidArchive ("libxamarin-startup-release.a"), - // C++ standard library - new CplusPlusArchive ("libc++_static.a"), - new CplusPlusArchive ("libc++abi.a"), - // LLVM clang built-ins archives new ClangBuiltinsArchive ("aarch64"), new ClangBuiltinsArchive ("arm"), new ClangBuiltinsArchive ("i686"), new ClangBuiltinsArchive ("x86_64"), - - new CplusPlusArchive ("libunwind.a"), // techically it's from clang }; // Just the base names of libraries to link into the unified runtime. Must have all the dependencies of all the static archives we diff --git a/src/native/CMakeLists.txt b/src/native/CMakeLists.txt index e2e44a7baec..406dd1307cf 100644 --- a/src/native/CMakeLists.txt +++ b/src/native/CMakeLists.txt @@ -649,7 +649,6 @@ else() add_subdirectory(common/java-interop) if (IS_MONO_RUNTIME OR IS_CLR_RUNTIME) - add_subdirectory(common/libunwind) add_subdirectory(common/runtime-base) add_subdirectory(${SOURCES_PREFIX}/runtime-base) @@ -658,6 +657,9 @@ else() endif() if (IS_MONO_RUNTIME) + # Only `mono/tracing` links `xa::unwind`; the CoreCLR host has no unwinder of its own. + add_subdirectory(common/libunwind) + add_subdirectory(mono/tracing) add_subdirectory(mono/pinvoke-override) diff --git a/src/native/CMakePresets.json.in b/src/native/CMakePresets.json.in index 1c5607585f1..394fa9ea34a 100644 --- a/src/native/CMakePresets.json.in +++ b/src/native/CMakePresets.json.in @@ -59,7 +59,17 @@ "hidden": true, "inherits": "common", "cacheVariables": { - "ANDROID_STL": "c++_static", + "ANDROID_STL": "none", + "ANDROID_CPP_FEATURES": "no-rtti no-exceptions" + } + }, + + { + "name": "coreclr-default-common", + "hidden": true, + "inherits": "common", + "cacheVariables": { + "ANDROID_STL": "none", "ANDROID_CPP_FEATURES": "no-rtti no-exceptions" } }, @@ -158,7 +168,7 @@ { "name": "coreclr-default-debug-armeabi-v7a", - "inherits": ["default-common", "common-debug", "common-armeabi-v7a"] + "inherits": ["coreclr-default-common", "common-debug", "common-armeabi-v7a"] }, { @@ -173,7 +183,7 @@ { "name": "coreclr-default-release-armeabi-v7a", - "inherits": ["default-common", "common-release", "common-armeabi-v7a"] + "inherits": ["coreclr-default-common", "common-release", "common-armeabi-v7a"] }, { @@ -222,7 +232,7 @@ { "name": "coreclr-default-debug-arm64-v8a", - "inherits": ["default-common", "common-debug", "common-arm64-v8a"] + "inherits": ["coreclr-default-common", "common-debug", "common-arm64-v8a"] }, { @@ -237,7 +247,7 @@ { "name": "coreclr-default-release-arm64-v8a", - "inherits": ["default-common", "common-release", "common-arm64-v8a"] + "inherits": ["coreclr-default-common", "common-release", "common-arm64-v8a"] }, { @@ -330,7 +340,7 @@ { "name": "coreclr-default-debug-x86_64", - "inherits": ["default-common", "common-debug", "common-x86_64"] + "inherits": ["coreclr-default-common", "common-debug", "common-x86_64"] }, { @@ -345,7 +355,7 @@ { "name": "coreclr-default-release-x86_64", - "inherits": ["default-common", "common-release", "common-x86_64"] + "inherits": ["coreclr-default-common", "common-release", "common-x86_64"] }, { diff --git a/src/native/native.targets b/src/native/native.targets index 324920e6d1a..abced124723 100644 --- a/src/native/native.targets +++ b/src/native/native.targets @@ -372,15 +372,6 @@ RuntimePackName="$(_RuntimePackName)" /> - - - <_RuntimePackFiles Include="@(_AndroidNdkRedistributable)" - Condition=" '%(_AndroidNdkRedistributable.Kind)' == 'CplusPlus' " - AndroidRID="%(_AndroidNdkRedistributable.AndroidRID)" - AndroidRuntime="$(CMakeRuntimeFlavor)" - RuntimePackName="$(_RuntimePackName)" /> - -