Skip to content

Strip libmonosgen linked library - #53240

Merged
directhex merged 16 commits into
dotnet:mainfrom
directhex:strip-mono-correctly
Jun 8, 2021
Merged

Strip libmonosgen linked library#53240
directhex merged 16 commits into
dotnet:mainfrom
directhex:strip-mono-correctly

Conversation

@directhex

@directhexdirecthex commented May 25, 2021

Copy link
Copy Markdown
Contributor

It seems in all Mono .symbols.nupkg packages, instead of a stripped .dylib/so and companion .dwarf/.dbg, we've just been shipping unstripped libs (and shipping unstripped libs in the non-symbols packages too). This commit largely duplicates the functions from eng/native/functions.cmake into an MSbuild proj, as our entire install logic is already in MSbuild not CMake. Moving to the common CMake functions would be a much larger task.

This should reduce our install size, and better mirror the rest of dotnet's debug infra & behaviour.

It seems in the .symbols.nupkg package, instead of a stripped .dylib/so and
companion .dwarf/.dbg, we've just been shipping unstripped libs. This commit
largely duplicates the functions from eng/native/functions.cmake into an
MSbuild proj, as our entire logic is already in MSbuild not CMake.
@ghostghost added the area-Build-mono label May 25, 2021
@directhex

directhex commented May 26, 2021

Copy link
Copy Markdown
ContributorAuthor

@akoeplingerakoeplinger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably also fixes #45013, though we should check we don't impact XA/XI.

Comment threadsrc/mono/mono.proj Outdated
@akoeplinger

Copy link
Copy Markdown
Member

What's the status of this PR?

@directhex

Copy link
Copy Markdown
ContributorAuthor

I think it's fine, just running into flakiness in unrelated places in testing

@akoeplinger

Copy link
Copy Markdown
Member

Retriggered the lanes just to be sure :)

@lateralusX

lateralusX commented Jun 4, 2021

Copy link
Copy Markdown
Member

@directhex we would need to strip libmono-component-*.so when doing dynamic components build (currently only on Android), something we could add into this PR as well?

@directhex

Copy link
Copy Markdown
ContributorAuthor

@lateralusX how can i force a dynamic components build on... anything that isn't android? that's one platform i don't have the environment set up locally for

@directhex

Copy link
Copy Markdown
ContributorAuthor

wait, docker, right. bleh

@directhex

Copy link
Copy Markdown
ContributorAuthor

Failed to create CoreCLR, HRESULT: 0x8007FF06

I hate docker

@directhex

Copy link
Copy Markdown
ContributorAuthor

@lateralusX this is looking good locally

$ unzip -lf /home/directhex/Projects/runtime/artifacts/packages/Release/Shipping/Microsoft.NETCore.App.Runtime.Mono.android-arm64.6.0.0-ci.symbols.nupkg | grep
dbg
1717872 2021-06-08 14:05 runtimes/android-arm64/native/libmono-component-diagnostics_tracing.so.dbg
475664 2021-06-08 14:05 runtimes/android-arm64/native/libmono-component-hot_reload.so.dbg
17705560 2021-06-08 14:05 runtimes/android-arm64/native/libmonosgen-2.0.so.dbg
2766008 2021-06-08 14:05 runtimes/android-arm64/native/libSystem.IO.Compression.Native.so.dbg
313464 2021-06-08 14:05 runtimes/android-arm64/native/libSystem.Native.so.dbg
751080 2021-06-08 14:05 runtimes/android-arm64/native/libSystem.Security.Cryptography.Native.Android.so.dbg
$ unzip -lf /home/directhex/Projects/runtime/artifacts/packages/Release/Shipping/Microsoft.NETCore.App.Runtime.Mono.android-arm64.6.0.0-ci.nupkg | grep dbg

@lateralusX

Copy link
Copy Markdown
Member

@lateralusX how can i force a dynamic components build on... anything that isn't android? that's one platform i don't have the environment set up locally for

Sorry, just saw this, there is MonoComponentsStatic in mono.proj controling build, so not setting it or make sure cmake won't get -DSTATIC_COMPONENTS=1 should enable dynamic component builds.

@lateralusX

Copy link
Copy Markdown
Member

What is the size of the stripped .so files?

@directhex

Copy link
Copy Markdown
ContributorAuthor

@lateralusX

-rw-r--r-- 3 root root 275K Jun 8 10:05 artifacts/bin/mono/Android.arm64.Release/libmono-component-diagnostics_tracing.so
-rwxr-xr-x 3 root root 1.7M Jun 8 10:05 artifacts/bin/mono/Android.arm64.Release/libmono-component-diagnostics_tracing.so.dbg
-rw-r--r-- 3 root root 131K Jun 8 10:05 artifacts/bin/mono/Android.arm64.Release/libmono-component-hot_reload.so
-rwxr-xr-x 3 root root 465K Jun 8 10:05 artifacts/bin/mono/Android.arm64.Release/libmono-component-hot_reload.so.dbg
-rw-r--r-- 3 root root 3.2M Jun 8 10:05 artifacts/bin/mono/Android.arm64.Release/libmonosgen-2.0.so
-rwxr-xr-x 3 root root 17M Jun 8 10:05 artifacts/bin/mono/Android.arm64.Release/libmonosgen-2.0.so.dbg

@directhex
directhex merged commit 84c11e4 into dotnet:mainJun 8, 2021
@ghostghost locked as resolved and limited conversation to collaborators Jul 8, 2021
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@directhex@akoeplinger@lateralusX@steveisok