@vitek-karas commented on Wed Feb 06 2019
Using relatively new 3.0 SDK
mkdir ca1
cd ca1
dotnet new console
dotnet publish --self-contained -r linux-x64
In the publish directory there are 6 .a files which don't seem to have any purpose. Basically for every native library (.so) coming from CoreFx, there's a corresponding .a as well:
-rwxrw-rw- 1 vitek vitek 2836614 Feb 5 04:05 System.IO.Compression.Native.a
-rwxrw-rw- 1 vitek vitek 27254 Feb 5 04:05 System.IO.Ports.Native.a
-rwxrw-rw- 1 vitek vitek 396432 Feb 5 04:05 System.Native.a
-rwxrw-rw- 1 vitek vitek 79868 Feb 5 04:05 System.Net.Http.Native.a
-rwxrw-rw- 1 vitek vitek 29400 Feb 5 04:05 System.Net.Security.Native.a
-rwxrw-rw- 1 vitek vitek 906184 Feb 5 04:05 System.Security.Cryptography.Native.OpenSsl.a
I don't think these files are needed for anything.
Per customer report this also reproes on MacOS, but I didn't verify.
@livarcocc commented on Wed Feb 06 2019
@peterhuene can you take a look?
@peterhuene commented on Wed Feb 06 2019
We should only be copying what's in the native assets directory, so if present it gets copied (hence why you get the .txt file too). Did something change in what gets packaged into Microsoft.NETCore.App?
I'll investigate.
@peterhuene commented on Wed Feb 06 2019
I can reproduce this on the current shipping 2.2.103 SDK.
It appears the runtime.$RID.microsoft.netcore.app packages (where $RID is not a Windows-based RID) does indeed contain the static library files in their native assets. As a result, they get treated like native assets like any other files and copied for the publish.
I think this is a core-setup issue. These files should not be packaged for Microsoft.NETCore.App packages on non-Windows platforms.
We can certainly filter these out in Core-Setup, but I think a better option is to have CoreFX stop putting the .a files in its transport packages. This keeps the change close to where the source lives.
Moving to CoreFX.
Issue moved to dotnet/corefx #35153 via ZenHub
Reopening: after discussion in https://github.com/dotnet/corefx/issues/35153, we will be filtering Microsoft.NETCore.App here. CoreRT uses the .a files from the CoreFX transport package, so they have to stay in the transport package.
Filtering them when packaging NETCore.App will work ok fine for now.
Once the single-exe work proceeds to stage 5, we will need to keep bundling these into NETCore.App package (or a new NETCore.App sibling package). I think it is ok to delay solving this problem until we actually get there.
cc @swaroop-sridhar
@dagood now that we have runtime pack lists, it would be great to filter out .a, .md, or any other file that has nothing to do with running a self-contained application.
Also, is createdump a runtime dependency? If not, I don't think most users would want that in their published application.
Also, is
createdumpa runtime dependency? If not, I don't think most users would want that in their published application.
Yep, it is considered part of the runtime. It's launched when there's an unhandled exception and needs to be in the same dir as libcoreclr.so. /cc @mikem8361
I figured as much but I want to make sure. Thanks!
Yes, createdump has a dependency on “libmscordaccore.so” in the runtime directory.
.
NikolaMilosavljevic modified the milestones: 5.0.0, 6.0.0 14 days ago
Chatting with @vitek-karas, he mentioned that we aren't going to get to stage 5 of single-exe in .NET 5.0, and maybe won't ever get there, since it will require a platform linker.
I'm seeing .a files show up in my linux self-contained apps in 5.0, which just bloats the size of these apps without any benefit. Using a latest build, these are about 4MB of junk in both the NuGet runtime pack, and in the resulting self-contained apps.
Can we reconsider fixing this issue in 5.0?
Since repo consolidation and the asset flow being more direct, it might be easy for folks involved with the native builds to fix this. Not sure how CoreRT factors in now. The new sharedfx SDK may play a role if we still can't simply omit these files from the asset flow (@jkoritzinsky).
I just noticed this with preview 8.
root@5027d78c2dfa:/usr/share/dotnet/shared/Microsoft.NETCore.App/5.0.0-preview.8.20407.11# ls -l *.a
-rw-r--r-- 1 root root 3671090 Aug 7 18:05 libSystem.IO.Compression.Native.a
-rw-r--r-- 1 root root 428142 Aug 7 18:05 libSystem.Native.a
-rw-r--r-- 1 root root 36752 Aug 7 18:05 libSystem.Net.Security.Native.a
-rw-r--r-- 1 root root 966970 Aug 7 18:05 libSystem.Security.Cryptography.Native.OpenSsl.a
-rw-r--r-- 1 root root 1715670 Aug 7 19:04 libnethost.a
This is 6.8MB.