-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mono runtime binaries need to be stripped #45013
Comments
Maybe we should compile without -g in release mode ? |
Not for iOS at least, you'll need the debug symbols to create the dSYM directory before stripping any binaries. |
Indeed, noticed that in apkdiff output when comparing
|
There is an argument to be made that no Under this worldview, Alternatively, the package containing the mono runtime binaries could ship with two sets of binaries: one
The However, what we could instead do is (optionally) |
Rephrased: with .NET 6, Xamarin.Android will need a way to get an un- What should that mechanism be? As previously suggested, if the NuGet package containing the mono runtime binaries is not If you do strip |
Context: #5558 Context: dotnet/runtime#45013 Due to runtime issue #45013 we are producing large packages for `Release` configurations, where native libraries contain debug information. So we will strip framework native libs for now. Added new target and task to call ndk's strip tool with `--strip-debug` option. The target should work partially. The apk size reference files were updated, the so that we catch size regressions in case the native libs are not stripped. The `DotNetBuild` test was updated to check for native libs in the new location, where we put them during build. The apk sizes differences, before/after BuildReleaseArm64False/net6: ``` Size difference in bytes ([*1] apk1 only, [*2] apk2 only): + 296 lib/arm64-v8a/libxa-internal-api.so - 560 lib/arm64-v8a/libmonodroid.so - 168,344 lib/arm64-v8a/libxamarin-debug-app-helper.so - 14,762,720 lib/arm64-v8a/libmonosgen-2.0.so Summary: + 0 Other entries 0.00% (of 58,624) + 0 Dalvik executables 0.00% (of 316,988) + 0 Assemblies 0.00% (of 690,435) - 14,931,328 Shared libraries -74.17% (of 20,130,552) + 0 Uncompressed assemblies 0.00% (of 1,357,824) - 4,947,968 Package size difference -62.74% (of 7,886,783) ``` Interestingly, the size of `libxa-internal-api.so` increases, only marginally though. That get us back to much better ratio between apk sizes of legacy and net6 (BuildReleaseArm64False): ``` Summary: + 603 Other entries 1.04% (of 58,021) + 32 Dalvik executables 0.01% (of 316,956) - 463,004 Assemblies -40.14% (of 1,153,439) - 5,314,304 Shared libraries -50.55% (of 10,513,528) - 1,408,000 Uncompressed assemblies -50.91% (of 2,765,824) - 2,072,341 Package size difference -41.35% (of 5,011,156) ``` and apk sizes for legacy/net6 (BuildReleaseArm64True): ``` Summary: + 13,527 Other entries 1.50% (of 903,720) + 616 Dalvik executables 0.02% (of 3,454,376) + 1,022,148 Assemblies 21.87% (of 4,674,167) - 5,310,496 Shared libraries -50.17% (of 10,584,912) + 1,545,728 Uncompressed assemblies 13.69% (of 11,293,696) - 572,295 Package size difference -5.43% (of 10,537,118) ``` Co-authored-by: Jonathan Peppers <[email protected]>
The "normal" behaviour here in the dotnet world is stripped libs (.dylib, .so) go into a runtime.nupkg, and both stripped libs and the stripped symbol companion files (.dwarf, .dbg) go into a runtime.symbols.nupkg file. That's what happens with coreclr, and the native pieces like libSystem.Native.dylib. I've made #53240 which does it to Mono too. |
@directhex Can we close then? |
Closing, this was fixed in #53240 and subsequent fixups |
This got lost with the CMake conversion, leading to e.g. the release build of libmonosgen-2.0.so for Android to be 20MB instead of 3MB.
The text was updated successfully, but these errors were encountered: