Skip to content

Conversation

@grendello
Copy link
Contributor

Fixes: #6840
Context: #6683

Pass the -s flag to the native linker in order to produce shared
AOT libraries without debug symbols. Symbols are stripped unless
the $(DebugSymbols) property is set to True.

Fixes: dotnet#6840
Context: dotnet#6683

Pass the `-s` flag to the native linker in order to produce shared
AOT libraries without debug symbols.  Symbols are stripped unless
the `$(DebugSymbols)` property is set to `True`.
@jonathanpeppers
Copy link
Member

This seems pretty good!

Size difference in bytes ([*1] apk1 only, [*2] apk2 only):

 17,416 lib/armeabi-v7a/libaot-Mono.Security.dll.so *2
 11,356 lib/x86/libaot-Mono.Security.dll.so *2
Error: apkdiff: PackageSize decrease 3,413,474 is 3,364,322 bytes more than the threshold 49,152. apk1 size: 19,475,110 bytes, apk2 size: 16,061,636 bytes.

And this was a classic Xamarin.Andorid/Xamarin.Forms apps.

@jonpryor
Copy link
Contributor

Fixes: https://github.com/xamarin/xamarin-android/issues/6840

Context: b21cbf943a19079773f9e762908939181a7f2180

Commit b21cbf94 contained a TODO:

> TODO: the Resulting `.apk` sizes also increase[d] unexpectedly, with
> `Xamarin.Forms_Performance_Integration-Signed-Release-Profiled-Aot.apkdesc`
> showing a 1.7MB increase in `.apk` size.  We believe that this is
> because of more verbose debug symbols.
> xamarin/xamarin-android#6840 will track this.

Update the `<GetAotArguments/>` MSBuild task to add the `-s` linker
flag to `GetAotArguments.LdFlags`.  This will cause the native linker
to produce shared AOT libraries without debug symbols.

Debug symbols are stripped unless the `$(DebugSymbols)`=True.

This fixes the size regression in
`Xamarin.Forms_Performance_Integration-Signed-Release-Profiled-Aot.apkdesc`,
shrinking PackageSize from 19,475,110 down to 16,061,636.
Compare to the pre-b21cbf94 PackageSize of 17,713,830: we're now
1.6MB *smaller* than b21cbf94!

@jonpryor jonpryor merged commit 5efda9d into dotnet:main Mar 22, 2022
@grendello grendello deleted the aot-strip branch March 22, 2022 18:01
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strip AOT shared libraries when packaging

4 participants