Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Build host.native for native AOT libraries testing #114764

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

Merged
merged 2 commits into from
Apr 30, 2025
Merged

Conversation

MichalStrehovsky
Copy link
Member

@MichalStrehovsky MichalStrehovsky commented Apr 17, 2025

We don't have a need for host in native AOT but after #113765 the native AOT outerloop started failing with:

  Building native export: "/usr/local/bin/clang-20" -O2 -shared -fpic -D DNNE_ASSEMBLY_NAME=Microsoft.Interop.Tests.NativeExports -D DNNE_COMPILE_AS_SOURCE -I "/__w/1/s/.packages/dnne/2.0.5/tools/platform" -I "/__w/1/s/artifacts/bin/linux-arm64.Release/corehost" -o "/__w/1/s/artifacts/obj/NativeExports/Release/net10.0/linux-arm64/dnne/bin/Microsoft.Interop.Tests.NativeExportsNE.so" --target=aarch64-linux-gnu --gcc-toolchain=/crossrootfs/arm64/usr --sysroot=/crossrootfs/arm64  "/__w/1/s/artifacts/obj/NativeExports/Release/net10.0/linux-arm64/dnne/Microsoft.Interop.Tests.NativeExports.g.c" "/__w/1/s/.packages/dnne/2.0.5/tools/platform/platform.c" -lstdc++ "/__w/1/s/artifacts/bin/linux-arm64.Release/corehost/libnethost.a" --target=aarch64-linux-gnu --gcc-toolchain=/crossrootfs/arm64/usr --sysroot=/crossrootfs/arm64 -fuse-ld=lld  -Wl,--rpath-link=/crossrootfs/arm64/lib/aarch64-linux-gnu -Wl,--rpath-link=/crossrootfs/arm64/usr/lib/aarch64-linux-gnu 
clang-20 : error : no such file or directory: '/__w/1/s/artifacts/bin/linux-arm64.Release/corehost/libnethost.a' [/__w/1/s/src/libraries/System.Runtime.InteropServices/tests/TestAssets/NativeExports/NativeExports.csproj]

because some of the interop testing uses DNNE. This is a blind attempt to fix it.

Sample: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1016185&view=logs&j=2f6a7d26-0d60-5ade-d191-981fe0847989&t=950a5a68-ae8a-5bb4-8cad-fb293bb99dc4

Cc @dotnet/ilc-contrib

We don't have a need for host in native AOT but after #113765 the outerloop started failing with:

```
  Building native export: "/usr/local/bin/clang-20" -O2 -shared -fpic -D DNNE_ASSEMBLY_NAME=Microsoft.Interop.Tests.NativeExports -D DNNE_COMPILE_AS_SOURCE -I "/__w/1/s/.packages/dnne/2.0.5/tools/platform" -I "/__w/1/s/artifacts/bin/linux-arm64.Release/corehost" -o "/__w/1/s/artifacts/obj/NativeExports/Release/net10.0/linux-arm64/dnne/bin/Microsoft.Interop.Tests.NativeExportsNE.so" --target=aarch64-linux-gnu --gcc-toolchain=/crossrootfs/arm64/usr --sysroot=/crossrootfs/arm64  "/__w/1/s/artifacts/obj/NativeExports/Release/net10.0/linux-arm64/dnne/Microsoft.Interop.Tests.NativeExports.g.c" "/__w/1/s/.packages/dnne/2.0.5/tools/platform/platform.c" -lstdc++ "/__w/1/s/artifacts/bin/linux-arm64.Release/corehost/libnethost.a" --target=aarch64-linux-gnu --gcc-toolchain=/crossrootfs/arm64/usr --sysroot=/crossrootfs/arm64 -fuse-ld=lld  -Wl,--rpath-link=/crossrootfs/arm64/lib/aarch64-linux-gnu -Wl,--rpath-link=/crossrootfs/arm64/usr/lib/aarch64-linux-gnu 
clang-20 : error : no such file or directory: '/__w/1/s/artifacts/bin/linux-arm64.Release/corehost/libnethost.a' [/__w/1/s/src/libraries/System.Runtime.InteropServices/tests/TestAssets/NativeExports/NativeExports.csproj]
```

because some of the interop testing uses DNNE. This is a blind attempt to fix it.
@Copilot Copilot AI review requested due to automatic review settings April 17, 2025 07:15
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

@MichalStrehovsky
Copy link
Member Author

/azp run runtime-nativeaot-outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@MichalStrehovsky
Copy link
Member Author

Linux still on the floor because when it rains it pours (#114485 (comment)), not sure if this fixed the interop tests or we just don't get to them...

@MichalStrehovsky
Copy link
Member Author

/azp run runtime-nativeaot-outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jkotas
Copy link
Member

jkotas commented Apr 21, 2025

@jkoritzinsky @AaronRobinsonMSFT Is this the right fix? Is it expected that DNNE needs a live native host, even when targeting NAOT?

@jkoritzinsky
Copy link
Member

DNNE would need the native host for the regular build. It won't kick in for the Publish target, but it will for the Build target.

@agocke
Copy link
Member

agocke commented Apr 21, 2025

Does it need the live host or could we pull from the host package?

@jkoritzinsky
Copy link
Member

We could condition it to pull from the package when TestNativeAot is true.

Once the new bootstrapping PR is in, we could even further adjust it to use the packaged version unless UseBootstrap=true is specified (as using either live for bootstrapped is required for cross-targeting to unknown/non-Microsoft RIDs).

@agocke
Copy link
Member

agocke commented Apr 22, 2025

Yup, that's precisely what I was thinking.

@am11
Copy link
Member

am11 commented Apr 26, 2025

DNNE would need the native host for the regular build. It won't kick in for the Publish target, but it will for the Build target.

We could also make it skip the apphost during Build when TestNativeAot is true.
TestNativeAot == true: csc then AoT
TestNativeaot != true: csc then FDE

@jkoritzinsky
Copy link
Member

DNNE needs nethost.h from the apphost build in its published location. It doesn't need the apphost itself.

@am11
Copy link
Member

am11 commented Apr 26, 2025

If nethost.h is all it needs, then source copy $(SharedNativeRoot)corehost/nethost/nethost.h can be used when published location doesn't exist. This header has no functional change since net6.0.

@jkoritzinsky
Copy link
Member

It also needs the nethost lib now that I think about it (to build the DNNE entrypoint module) so we can't just point into the source tree for the header.

@am11
Copy link
Member

am11 commented Apr 26, 2025

It exposes one API get_hostfxr_path which NativeAOT doesn't implement, so while having build behave differently than publish with TestNativeAot=true is understood, it sounds wasteful to build an entire subset to satisfy some condition for intermediate artifacts which are never used by the AOT tests.

@MichalStrehovsky
Copy link
Member Author

@jkoritzinsky could you please submit a PR with a fix? I don't understand what fix is being discussed here.

We typically revert PRs that cause such wide issues and cannot be fixed immediately. People need to work around this to get work done (#114948 (comment)). I was taking time off last week and came back to this still being an issue. We need a fix now.

@agocke
Copy link
Member

agocke commented Apr 30, 2025

I'll merge this one for now -- we can remove the dependency later.

@agocke agocke merged commit 4afdf63 into main Apr 30, 2025
109 of 111 checks passed
@agocke agocke deleted the MichalStrehovsky-patch-1 branch April 30, 2025 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants