-
Notifications
You must be signed in to change notification settings - Fork 5k
Simplify RID model and handle Linux libc flavors in orchestrated builds #113765
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
Simplify RID model and handle Linux libc flavors in orchestrated builds #113765
Conversation
This is needed to fix the linux-bionic builds in the VMR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot wasn't able to review any files in this pull request.
Files not reviewed (1)
- eng/DotNetBuild.props: Language not supported
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this imply that due to L18, the passed in TargetOS value will never be used?
Yes. The problem is that the runtime's build scripts process and change the passed in TargetOS when determining the RID. Because of our "nested inner build" logic, we effectively were stripping the "-bionic" part of "linux-bionic" from the inner build invocation and building the product in a weird blend of linux, linux-bionic, and android. By letting this calculation happen again and overwriting the TargetOS based on the RID, we can restore the calculation of the TargetOS to the correct value by re-extracting it from the RID (which we calculate based on the originally-passed-in TargetOS). |
My 2 cents: it may be interesting to globally introduce a property that is the "portable rid OS corresponding to the target". That one would be |
It sounds like we are missing handling of linux-bionic somewhere next to the existing handling of linux-musl which should have the same behavior but doesn't (e.g. alpine distro packages use source-build without issues). If we can find and fix that problem, I think that would be better targeted fix rather than exposing these props. Ideally, |
Alpine doesn't have a problem because musl and glibc builds are more similar. |
Coming back to this, here's the flow of what's happening in main and why musl doesn't have a problem here:
This change lets the logic at step 4 correct the adjustment in step 2 using the RID that's passed in by the orchestrator. I'd like to get in this change as-is. After we switch to flat code-flow to the VMR, we can revisit how we handle RIDs and platform specification and simplify it from the VMR where we can do all the changes in one PR. |
Note that in the first step, |
Thanks for the explainer @jkoritzinsky and @tmds. We were discussing whether it makes sense to maintain a standalone linux-bionic RID going forward: #106748 (comment). Probably telemetry would be able to clarify how many non-Android installations are using linux-bionic in .NET 8 and 9, and whether it would make sense to provide it with feature switches on top of android runtime. Separate RID implies that the maintainers of 3p nupkg with native assets need to provide two same/similar/identical binaries with different names per arch, both require Android NDK to be present on the build machine regardless the code uses any auxiliary platform feature. If the use-cases of linux-bionic are only dev oriented (such as Termux, which is an emulator), then we can likely live with a single android runtime. e.g. Rosetta emulator is also supported by osx-* RIDs without a specialized package for it. Runtime just disables doublemapping (
Probably it would be a better fix here if PortableTargetOS is propagated separately from VMR to inner builds. That sort of a |
Yes, that was my suggestion in #113765 (comment). |
I don't want to propagate it separately as our inner build invocation should be as close to a standard build invocation as possible. I don't want to have to maintain two different ways of passing the OS. I'll see if I can make this a little cleaner. |
…props so we can reduce duplication and get rid of the TreatAsLocalProperty property. Remove ToolsRID
… our output rid, OutputRID, or for the host RID, NETCoreSdkRuntimeIdentifier.
I've pulled apart the RID calculations again and significantly cleaned them up and reduced the set of different RID concepts. Lets see how CI likes it. |
/azp run runtime, runtime-diagnostics, runtime-dev-innerloop, dotnet-linker-tests |
Azure Pipelines successfully started running 4 pipeline(s). |
I've verified these changes with a full source-build (Fedora x64). I did not notice any differences between artifacts produced in the test build and the baseline. My test might not have exercised the code paths fully. @jkoritzinsky let me know if there is a more appropriate source-build scenario. |
@jkoritzinsky assuming that this PR will remove the remaining runtime patch in the VMR, we need to get this in before April 23rd so that we are patch free by that date. Just in case you didn't know about this deadline. |
Yeah I split off #114285 because of the deadline. I just need a code review and this will be ready to merge. |
<InnerBuildArgs Condition="'$(_portableOS)' == 'win'">$(InnerBuildArgs) $(FlagParameterPrefix)os windows</InnerBuildArgs> | ||
<InnerBuildArgs>$(InnerBuildArgs) $(FlagParameterPrefix)os $(_portableOS)</InnerBuildArgs> | ||
<!-- Mobile builds are never "cross" builds as they don't have a rootfs-based filesystem build. --> | ||
<InnerBuildArgs Condition="'$(CrossBuild)' == 'true' or ('$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(TargetsMobile)' != 'true')">$(InnerBuildArgs) $(FlagParameterPrefix)cross</InnerBuildArgs> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
osx/win x64 host building for osx/win arm64 target is in the same situation and also doesn't use rootfs.
I know this is pre-existing but maybe for your cleanup instead of CrossBuild and the -cross flag we should have BuildUsingCrossRootFs
and only apply it where we actually use a rootfs ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to do that in a future PR so we can get this in by the deadline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, sorry if I wasn't clear but I was suggesting to keep this in mind for a separate cleanup PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good. Considering queuing runtime and VMR (source-build & unfiied-build) official builds for additional validation.
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.
We don't have a need for host in native AOT but after dotnet#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.
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.
This is needed to fix the linux-bionic builds in the VMR.
Contributes to dotnet/source-build#4955