Skip to content

Commit ddb2006

Browse files
committed
Temporarily include libunwind.a from the NDK toolchain
MonoVM requires `libunwind.a` on x86_64. Until the requirement is removed, we'll include the archive. dotnet/runtime#107615
1 parent c23fddd commit ddb2006

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

build-tools/create-packs/Microsoft.Android.Runtime.proj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ projects that use the Microsoft.Android framework in .NET 6+.
5454
<_AndroidRuntimePackAssets Include="$(MicrosoftAndroidSdkOutDir)lib\$(AndroidRID)\crtbegin_so.o" />
5555
<_AndroidRuntimePackAssets Include="$(MicrosoftAndroidSdkOutDir)lib\$(AndroidRID)\crtend_so.o" />
5656
<_AndroidRuntimePackAssets Include="$(MicrosoftAndroidSdkOutDir)lib\$(AndroidRID)\libclang_rt.builtins-*-android.a" />
57+
58+
<!-- Remove once https://github.com/dotnet/runtime/pull/107615 is merged and released -->
59+
<_AndroidRuntimePackAssets Include="$(MicrosoftAndroidSdkOutDir)lib\$(AndroidRID)\libunwind.a" />
60+
5761
<FrameworkListFileClass Include="@(_AndroidRuntimePackAssemblies->'%(Filename)%(Extension)')" Profile="Android" />
5862
<FrameworkListFileClass Include="@(_AndroidRuntimePackAssets->'%(Filename)%(Extension)')" Profile="Android" />
5963
</ItemGroup>

build-tools/xaprepare/xaprepare/Steps/Step_Android_SDK_NDK.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,18 @@ bool CopyRedistributableFiles (Context context)
197197
BuildAndroidPlatforms.NdkMinimumAPI.ToString (CultureInfo.InvariantCulture)
198198
);
199199

200+
string clangArch = Configurables.Defaults.AbiToClangArch[abi];
200201
CopyFile (abi, crtFilesPath, "crtbegin_so.o");
201202
CopyFile (abi, crtFilesPath, "crtend_so.o");
202-
CopyFile (abi, clangLibPath, $"libclang_rt.builtins-{Configurables.Defaults.AbiToClangArch[abi]}-android.a");
203+
CopyFile (abi, clangLibPath, $"libclang_rt.builtins-{clangArch}-android.a");
204+
205+
// Yay, consistency
206+
if (String.Compare (clangArch, "i686", StringComparison.Ordinal) == 0) {
207+
clangArch = "i386";
208+
}
209+
210+
// Remove once https://github.com/dotnet/runtime/pull/107615 is merged and released
211+
CopyFile (abi, Path.Combine (clangLibPath, clangArch), "libunwind.a");
203212
}
204213

205214
return true;

src/Xamarin.Android.Build.Tasks/Utilities/NativeRuntimeComponents.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ public NativeRuntimeComponents (ITaskItem[] monoComponents)
102102
new ClangBuiltinsArchive ("arm"),
103103
new ClangBuiltinsArchive ("i686"),
104104
new ClangBuiltinsArchive ("x86_64"),
105+
106+
// Remove once https://github.com/dotnet/runtime/pull/107615 is merged and released
107+
new Archive ("libunwind.a") {
108+
DontExportSymbols = true,
109+
},
105110
};
106111

107112
// Just the base names of libraries to link into the unified runtime. Must have all the dependencies of all the static archives we

0 commit comments

Comments
 (0)