-
Notifications
You must be signed in to change notification settings - Fork 5k
[android] Add -keepnativesymbols to Windows build #114466
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
base: main
Are you sure you want to change the base?
Conversation
This is so the symbols are kept in the native libs so that you can debug straight away in android studio. The cmake that gets generated for each test app also needed CMAKE_BUILD_TYPE to be set otherwise the breakpoints would not be hit. It'll just work on non-windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 6 changed files in this pull request and generated no comments.
Files not reviewed (4)
- eng/build.ps1: Language not supported
- src/coreclr/runtime.proj: Language not supported
- src/native/libs/build-native.proj: Language not supported
- src/tasks/AndroidAppBuilder/Templates/CMakeLists-android.txt: Language not supported
Comments suppressed due to low confidence (2)
src/tasks/MobileBuildTasks/Android/AndroidProject.cs:67
- The removal of the Debug build configuration in the else branch might lead to unintended behavior for builds that expect a Debug configuration. Confirm that this change aligns with the intended debugging experience on non-Windows platforms.
cmakeGenArgs += " -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_C_FLAGS=\"-s -Wno-unused-command-line-argument\"";
src/tasks/AndroidAppBuilder/ApkBuilder.cs:363
- Appending 'set(CMAKE_BUILD_TYPE Debug)' directly in the CMakeLists may conflict with other build type settings. Verify that this approach consistently enables breakpoints in the intended debug builds.
defines.AppendLine("set(CMAKE_BUILD_TYPE Debug)");
@@ -103,7 +102,7 @@ | |||
<_CoreClrBuildArg Include="-cmakeargs "-DCLR_CMAKE_ESRP_CLIENT=$(DotNetEsrpToolPath)"" /> | |||
</ItemGroup> | |||
|
|||
<ItemGroup Condition="'$(TargetsBrowser)' == 'true'"> | |||
<ItemGroup Condition="'$(KeepNativeSymbols)' == 'true' or '$(TargetsWindows)' != 'true'"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition replaces `$(KeepNativeSymbols)' != 'false'. I'm still not a fan as I think we want it to be opt in except for (I think) wasm that wants it on explicitly.
Are there other platforms where want this on by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we have other platforms. Symbols in separate files remove > 50% from the binary size, e.g.
$ dotnet10 publish -o dist -c Release
$ du -sh dist/*
1.3M dist/aot7
2.3M dist/aot7.dbg
$ dotnet10 publish -o dist -c Release -p:StripSymbols=false
$ du -sh dist/*
3.5M dist/aot7
Production machine will only need a binary. Symbols are deemed optional; downloaded only when investigating issues.
This is so the symbols are kept in the native libs so that you can debug straight away in android studio. Also, the cmake that gets generated for each test app also needed CMAKE_BUILD_TYPE to be set otherwise the breakpoints would not be hit. It'll just work on non-windows.