Skip to content

Conversation

@am11
Copy link
Member

@am11 am11 commented Nov 28, 2023

Fix #95223 (I wasn't able to test it myself against bionic, but I think this was the reason why -target was missing)

@ghost ghost added area-NativeAOT-coreclr community-contribution Indicates that the PR has been added by a community member labels Nov 28, 2023
@ghost
Copy link

ghost commented Nov 28, 2023

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

Issue Details

Fix #95223 (I wasn't able to test it myself against bionic, but I think this was the reason why -target was missing)

Author: am11
Assignees: -
Labels:

area-NativeAOT-coreclr

Milestone: -

@MichalStrehovsky
Copy link
Member

I have an alternative fix for this that just does the below. I want something that can be safely backported to .NET 8 and I would be weary to backport anything more broad.

I didn't send a PR yet because I'm also fixing #93942 without which x64 bionic build doesn't work at all anyway.

diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets
index fe49cab873a..a64d20b4ca3 100644
--- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets
+++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets
@@ -34,6 +34,7 @@ The .NET Foundation licenses this file to you under the MIT license.

       <CrossCompileRid />
       <CrossCompileRid Condition="!$(RuntimeIdentifier.EndsWith('-$(_hostArchitecture)'))">$(RuntimeIdentifier)</CrossCompileRid>
+      <CrossCompileRid Condition="'$(CrossCompileRid)' == '' and '$(_linuxLibcFlavor)' == 'bionic'">$(RuntimeIdentifier)</CrossCompileRid>

       <CrossCompileArch />
       <CrossCompileArch Condition="$(CrossCompileRid.EndsWith('-x64'))">x86_64</CrossCompileArch>

@am11
Copy link
Member Author

am11 commented Nov 28, 2023

anything more broad

This actually takes us one step further to host: linux-x64, target: freebsd-x64 => cross. Isn't this better, at least for main branch?

@MichalStrehovsky
Copy link
Member

anything more broad

This actually takes us one step further to host: linux-x64, target: freebsd-x64 => cross. Isn't this better, at least for main branch?

Yup, it's a better fix. But if I can take a diff from main that merges cleanly to 8.0, that's less risky, so I'd still prefer to merge the less risky thing first and then we can improve.

Your fix would probably allow me to delete this, so I'm definitely a fan:

https://github.com/MichalStrehovsky/PublishAotCross/blob/8fbc8fad1c943228c191c998d3995e5d300f7741/src/Crosscompile.targets#L34-L57

MichalStrehovsky added a commit to MichalStrehovsky/runtime that referenced this pull request Nov 28, 2023
Fixes dotnet#93942. Works around dotnet#95223 (a better but more risky fix is in dotnet#95312, so I'm not going to resolve that with this PR).

The first issue is that we don't consider x64 Windows (or x64 Linux) to x64 Bionic build a crossbuild. The crossbuild detection only looks at architecture, not at the OS. The fix is very conservative so that we can backport to 8.0. Bionic is always a crossbuild.

The second part is a port of dotnet/corert#8323 to x64. It is a lot less work than on arm64 because x64 Linux already has to assume `INLINE_GETTHREAD` could be a call so everything is setup for it.

I tested this all on a x64 Bionic hello world. I also ran all of smoke tests on x64 Linux with `FEATURE_EMULATED_TLS` enabled. All of this looks very non-risky so I'm going to ask for a backport.
MichalStrehovsky added a commit that referenced this pull request Nov 29, 2023
Fixes #93942. Works around #95223 (a better but more risky fix is in #95312, so I'm not going to resolve that with this PR).

The first issue is that we don't consider x64 Windows (or x64 Linux) to x64 Bionic build a crossbuild. The crossbuild detection only looks at architecture, not at the OS. The fix is very conservative so that we can backport to 8.0. Bionic is always a crossbuild.

The second part is a port of dotnet/corert#8323 to x64. It is a lot less work than on arm64 because x64 Linux already has to assume `INLINE_GETTHREAD` could be a call so everything is setup for it.

I tested this all on a x64 Bionic hello world. I also ran all of smoke tests on x64 Linux with `FEATURE_EMULATED_TLS` enabled. All of this looks very non-risky so I'm going to ask for a backport.
github-actions bot pushed a commit that referenced this pull request Nov 29, 2023
Fixes #93942. Works around #95223 (a better but more risky fix is in #95312, so I'm not going to resolve that with this PR).

The first issue is that we don't consider x64 Windows (or x64 Linux) to x64 Bionic build a crossbuild. The crossbuild detection only looks at architecture, not at the OS. The fix is very conservative so that we can backport to 8.0. Bionic is always a crossbuild.

The second part is a port of dotnet/corert#8323 to x64. It is a lot less work than on arm64 because x64 Linux already has to assume `INLINE_GETTHREAD` could be a call so everything is setup for it.

I tested this all on a x64 Bionic hello world. I also ran all of smoke tests on x64 Linux with `FEATURE_EMULATED_TLS` enabled. All of this looks very non-risky so I'm going to ask for a backport.
@am11 am11 force-pushed the patch-25 branch 2 times, most recently from e4d59fe to 3c894d4 Compare November 30, 2023 16:16
Copy link
Member

@MichalStrehovsky MichalStrehovsky left a comment

Choose a reason for hiding this comment

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

Thank you!

@MichalStrehovsky MichalStrehovsky merged commit 413efe7 into dotnet:main Dec 1, 2023
@am11 am11 deleted the patch-25 branch December 1, 2023 13:38
@github-actions github-actions bot locked and limited conversation to collaborators Jan 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-NativeAOT-coreclr community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Publishing for linux-bionix-x64 using NativeAOT fails

2 participants