Author: | Sergio0694 |
---|---|
Assignees: | - |
Labels: | `area-Interop-coreclr`, `untriaged`, `area-NativeAOT-coreclr` |
Milestone: | - |
Closed Sergio0694 closed 1 year ago
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas See info in area-owners.md if you want to be subscribed.
Author: | Sergio0694 |
---|---|
Assignees: | - |
Labels: | `area-Interop-coreclr`, `untriaged`, `area-NativeAOT-coreclr` |
Milestone: | - |
tests\ComputeSharp.Dynamic.NuGet\bin\Release\net7.0\win-x64\native
This needs to be publish
directory. native
directory is just for intermediate files, it does not contain everything.
We actually have opposite problem: There are things in the publish directory that are not supposed to be there.
Ooh my bad, I incorrectly thought "native" was the right folder for the output 😅 Yeah then "publish" actually seems correct, and everything works just fine:
Sorry! 😄
Description
I'm adding NAOT tests to my CI for ComputeSharp as part of updating to the .NET 7 SDK (figured it would be nice to also start validating NAOT builds end to end as part of my pipeline), and I've noticed that my two end to end test projects using native libraries are not working at all with NAOT. That is, using
dotnet publish
with NAOT results in the .exe being generated that doesn't include the native libs it needs either statically linker nor copied next to it in the output folder. As a result, that .exe is completely unusable (it just crashes at runtime).I'd expect NAOT to see that a given NuGet package includes native libs, and automatically link them statically into the generated .exe, or at least copy them next to the output .exe in the "native" folder that results from
dotnet publish
. For context,dotnet build
anddotnet run
on any other framework (from .NET Framework all the way to .NET 6) work just fine in this case.Reproduction Steps
Expected behavior
This should just run correctly.
Actual behavior
Crashes due to a missing native library:
The output folder doesn't include the native libs (which are package into the NuGet package), and the .exe is clearly too small to possibly have them statically linked into it (as they are about 20MB in side on their own, but the .exe is 4MB):