Skip to content

Pass --targetos to crossgen2 - #55004

Merged
jkotas merged 6 commits into
dotnet:mainfrom
am11:patch-7
Jun 26, 2026
Merged

jkotas merged 6 commits into
dotnet:mainfrom
am11:patch-7

Conversation

@am11

@am11 am11 commented Jun 26, 2026

Copy link
Copy Markdown
Member

OpenBSD x64 SDK is throwing

$ dotnet --version
Unhandled exception. System.BadImageFormatException: An attempt was made to load a program with an incorrect format.
 (0x8007000B)
Abort trap                 (core dumped) dotnet --version

@am11

am11 commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

Applied this PR as patch to openbsd VMR workflow https://github.com/am11/dotnet-riscv/actions/runs/28232818605/workflow#L48 and published P7 SDK; it fixed BadImageFormatException.

cc @jkotas, @akoeplinger, with this, we don't need to disable crossgen2 in SDK build for non-linux cross targets.

@jkotas jkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is OpenBSD the first OS where we are running into this? I would expect FreeBSD to run into this as well.

Comment thread src/Tasks/sdk-tasks/Crossgen.cs Resolved
Comment thread src/Tasks/sdk-tasks/Crossgen.cs Resolved
Comment thread src/Tasks/sdk-tasks/Crossgen.cs Resolved
@am11

am11 commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

@jkotas, they disable crossgen2 during SDK build.

Comment thread src/Tasks/sdk-tasks/Crossgen.cs Resolved
Comment thread src/Tasks/sdk-tasks/Crossgen.cs Resolved
@am11

am11 commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

FYI @Thefrank - TBH, I couldn't find the patch which disables crossgen2 in your repo, so I'm not enitrely sure how SDK -- which defaults to using PublishReadyToRun its own assemblies -- could work with linux in PE header. Therefore, I've claimed above that you guys must be disabling it during the cross build. 👀

@jkotas jkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM otherwise

@Thefrank

Copy link
Copy Markdown
Contributor

Crossgen2 is disabled/skipped for cross builds

VMR accepts -p:SkipUsingCrossgen=true

NET9 and earlier required -p:CrossgenOutput=false on aspnetcore and -p:CrossgenOutput=false -p:DISABLE_CROSSGEN=true on the installer

@jkotas jkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@jkotas
jkotas enabled auto-merge (squash) June 26, 2026 18:02
@Thefrank

Copy link
Copy Markdown
Contributor

So, after this PR, it will no longer be necessary to disable Crossgen on cross builds for NET11+?

@am11

am11 commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

So, after this PR, it will no longer be necessary to disable Crossgen on cross builds for NET11+?

Yes, disabling won't be necessary. I tried this patch on OpenBSD build and it worked cleanly without any additional patch.

@jkotas
jkotas merged commit 58d81d4 into dotnet:main Jun 26, 2026
25 checks passed
@am11
am11 deleted the patch-7 branch June 26, 2026 20:24
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants