dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.25k stars 4.73k forks source link

Error building native AOT tests following instructions #109356

Open sbomer opened 3 days ago

sbomer commented 3 days ago

Build native AOT tests following the documented workflow https://github.com/dotnet/runtime/blob/main/docs/workflow/building/coreclr/nativeaot.md:

  1. Build product: .\build.cmd clr.aot+libs -rc Debug
  2. Build native aot tests: .\src\tests\build.cmd nativeaot Debug tree nativeaot

This gives errors like:

runtime/artifacts/bin/coreclr/linux.x64.Debug/build/Microsoft.NETCore.Native.Publish.targets(78,5): error : The FrameworkAssemblies ItemGroup is required for _ComputeAssembliesToCompileToNative

This happens because test build script defaults to LibrariesConfiguration=Release, while the product build step above builds Debug libraries. The workaround is easy - pass /p:LibrariesConfiguration=Debug to the test build, or build the product with -lc Release (thanks @AaronRobinsonMSFT).

This should at least give a better error to indicate what the problem is, like we do in this check: https://github.com/dotnet/runtime/blob/8886107370b1ff15662dd38f3b3a5546188842e7/eng/liveBuilds.targets#L154 The instructions should probably be updated to pass LibrariesConfiguration.

dotnet-policy-service[bot] commented 3 days ago

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas See info in area-owners.md if you want to be subscribed.