Skip to content

Set /p:CrossBuild=true consistently for all repos#7574

Merged
akoeplinger merged 5 commits into
dotnet:mainfrom
am11:patch-9
Jul 14, 2026
Merged

Set /p:CrossBuild=true consistently for all repos#7574
akoeplinger merged 5 commits into
dotnet:mainfrom
am11:patch-9

Conversation

@am11

@am11 am11 commented Jul 7, 2026

Copy link
Copy Markdown
Member

We infer cross build for runtime. Now that more repos have started to use NativeAot, it should be moved to common props.

Secondly, aspnetcore should adhere to NativeAotSupported just like SDK does.

@am11
am11 requested review from a team as code owners July 7, 2026 15:27
@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team July 7, 2026 15:27
@am11

am11 commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

openbsd-x64 build was failing at aspnetcore https://github.com/am11/dotnet-riscv/actions/runs/28865536436/job/85614557857, note that SysRoot is missing (because CrossBuild wasn't set):

  ld.lld : error : cannot open crtbeginS.o: No such file or directory [/dotnet/src/aspnetcore/src/Tools/NativeAot/aspnetcoretools/aspnetcoretools.csproj]
  ld.lld : error : unable to find library -l:libgssapi.so.9.0 [/dotnet/src/aspnetcore/src/Tools/NativeAot/aspnetcoretools/aspnetcoretools.csproj]
  ld.lld : error : unable to find library -l:libinotify.so.4.0 [/dotnet/src/aspnetcore/src/Tools/NativeAot/aspnetcoretools/aspnetcoretools.csproj]
  ld.lld : error : unable to find library -lcompiler_rt [/dotnet/src/aspnetcore/src/Tools/NativeAot/aspnetcoretools/aspnetcoretools.csproj]
  ld.lld : error : unable to find library -lcompiler_rt [/dotnet/src/aspnetcore/src/Tools/NativeAot/aspnetcoretools/aspnetcoretools.csproj]
  ld.lld : error : cannot open crtendS.o: No such file or directory [/dotnet/src/aspnetcore/src/Tools/NativeAot/aspnetcoretools/aspnetcoretools.csproj]
  clang-22 : error : linker command failed with exit code 1 (use -v to see invocation) [/dotnet/src/aspnetcore/src/Tools/NativeAot/aspnetcoretools/aspnetcoretools.csproj]
  /dotnet/src/aspnetcore/artifacts/.packages/microsoft.dotnet.ilcompiler/11.0.0-preview.7.26357.199/build/Microsoft.NETCore.Native.targets(420,5): error MSB3073: The command ""/usr/local/bin/clang-22" "/dotnet/src/aspnetcore/artifacts/obj/aspnetcoretools/Release/net11.0/openbsd-x64/native/aspnetcoretools.o" -o "/dotnet/src/aspnetcore/artifacts/bin/aspnetcoretools/Release/net11.0/openbsd-x64/native/libaspnetcoretools.so" -Wl,--version-script="/dotnet/src/aspnetcore/artifacts/obj/aspnetcoretools/Release/net11.0/openbsd-x64/native/aspnetcoretools.exports" -Wl,--export-dynamic -gz=zlib -fuse-ld=lld /dotnet/src/aspnetcore/artifacts/.packages/microsoft.netcore.app.runtime.nativeaot.openbsd-x64/11.0.0-preview.7.26357.199/runtimes/openbsd-x64/native/libSystem.Native.a /dotnet/src/aspnetcore/artifacts/.packages/microsoft.netcore.app.runtime.nativeaot.openbsd-x64/11.0.0-preview.7.26357.199/runtimes/openbsd-x64/native/libSystem.IO.Compression.Native.a /dotnet/src/aspnetcore/artifacts/.packages/microsoft.netcore.app.runtime.nativeaot.openbsd-x64/11.0.0-preview.7.26357.199/runtimes/openbsd-x64/native/libSystem.Net.Security.Native.a /dotnet/src/aspnetcore/artifacts/.packages/microsoft.netcore.app.runtime.nativeaot.openbsd-x64/11.0.0-preview.7.26357.199/runtimes/openbsd-x64/native/libSystem.Security.Cryptography.Native.OpenSsl.a /dotnet/src/aspnetcore/artifacts/.packages/microsoft.netcore.app.runtime.nativeaot.openbsd-x64/11.0.0-preview.7.26357.199/runtimes/openbsd-x64/native/libbootstrapperdll.o /dotnet/src/aspnetcore/artifacts/.packages/microsoft.netcore.app.runtime.nativeaot.openbsd-x64/11.0.0-preview.7.26357.199/runtimes/openbsd-x64/native/libRuntime.WorkstationGC.a /dotnet/src/aspnetcore/artifacts/.packages/microsoft.netcore.app.runtime.nativeaot.openbsd-x64/11.0.0-preview.7.26357.199/runtimes/openbsd-x64/native/libeventpipe-disabled.a /dotnet/src/aspnetcore/artifacts/.packages/microsoft.netcore.app.runtime.nativeaot.openbsd-x64/11.0.0-preview.7.26357.199/runtimes/openbsd-x64/native/libRuntime.VxsortDisabled.a /dotnet/src/aspnetcore/artifacts/.packages/microsoft.netcore.app.runtime.nativeaot.openbsd-x64/11.0.0-preview.7.26357.199/runtimes/openbsd-x64/native/libstandalonegc-disabled.a /dotnet/src/aspnetcore/artifacts/.packages/microsoft.netcore.app.runtime.nativeaot.openbsd-x64/11.0.0-preview.7.26357.199/runtimes/openbsd-x64/native/libaotminipal.a /dotnet/src/aspnetcore/artifacts/.packages/microsoft.netcore.app.runtime.nativeaot.openbsd-x64/11.0.0-preview.7.26357.199/runtimes/openbsd-x64/native/libstdc++compat.a /dotnet/src/aspnetcore/artifacts/.packages/microsoft.netcore.app.runtime.nativeaot.openbsd-x64/11.0.0-preview.7.26357.199/runtimes/openbsd-x64/native/libz.a /dotnet/src/aspnetcore/artifacts/.packages/microsoft.netcore.app.runtime.nativeaot.openbsd-x64/11.0.0-preview.7.26357.199/runtimes/openbsd-x64/native/libbrotlienc.a /dotnet/src/aspnetcore/artifacts/.packages/microsoft.netcore.app.runtime.nativeaot.openbsd-x64/11.0.0-preview.7.26357.199/runtimes/openbsd-x64/native/libbrotlidec.a /dotnet/src/aspnetcore/artifacts/.packages/microsoft.netcore.app.runtime.nativeaot.openbsd-x64/11.0.0-preview.7.26357.199/runtimes/openbsd-x64/native/libbrotlicommon.a /dotnet/src/aspnetcore/artifacts/.packages/microsoft.netcore.app.runtime.nativeaot.openbsd-x64/11.0.0-preview.7.26357.199/runtimes/openbsd-x64/native/libzstd.a --target=x86_64-unknown-openbsd -g -Wl,--build-id=sha1 -Wl,--as-needed -Wl,-e,0x0 -pthread -lm -shared -Wl,-z,relro -Wl,-z,now -Wl,-z,nobtcfi -Wl,--no-execute-only -L"/usr/local/heimdal/lib" -l:libgssapi.so.9.0 -Wl,-rpath,/usr/local/heimdal/lib -L"/usr/local/lib/inotify" -l:libinotify.so.4.0 -Wl,-rpath,/usr/local/lib/inotify -Wl,--eh-frame-hdr -Wl,--icf=all -Wl,--discard-all -Wl,--gc-sections -Wl,-T,"/dotnet/src/aspnetcore/artifacts/obj/aspnetcoretools/Release/net11.0/openbsd-x64/native/sections.ld"" exited with code 1. [/dotnet/src/aspnetcore/src/Tools/NativeAot/aspnetcoretools/aspnetcoretools.csproj]

cc @DamianEdwards, @jkotas, @MichalStrehovsky, with this patch it passed https://github.com/am11/dotnet-riscv/actions/runs/28895261193/job/85718050571.

@am11

am11 commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

Only repo-projects/ dir changes are needed for openbsd-x64.

src/aspnetcore changes are just a leftover from previous sharing of NativeAotSupported.props with runtime and SDK where I forgot to update aspnetcore (the third repo using PublishAot). It doesn't affect openbsd-x64 because NativeAotSupported is true for this platform, but it will help other platforms like linux-ppc64le, illumos-x64 etc.

Comment thread repo-projects/runtime.proj
@am11
am11 requested a review from akoeplinger July 8, 2026 16:53
@am11 am11 mentioned this pull request Jul 9, 2026
@am11

am11 commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

If there is no further feedback could this be merged? It's a regression for all community platforms (not just OpenBSD) compared to .NET 10 since SDK and aspnetcore are using PublishAot in this preview (and require CrossBuild prop to propagate for .NET eng infra).

@am11
am11 requested a review from MichalStrehovsky July 11, 2026 08:56
@am11

am11 commented Jul 13, 2026

Copy link
Copy Markdown
Member Author

@jkotas, @MichalStrehovsky, PTAL.

@MichalStrehovsky

Copy link
Copy Markdown
Member

Can this be scoped down to only what's needed for OpenBSD (the CrossBuild=true part)?

I have question marks around the aspnetcore change (aspnetcoretools.csproj‎ without PublishAot is meaningless - and we already seem to have a mechanism in place that works with the DotNetBuildUseMonoRuntime).

@am11

am11 commented Jul 13, 2026

Copy link
Copy Markdown
Member Author

I have question marks around the aspnetcore change (aspnetcoretools.csproj‎ without PublishAot is meaningless - and we already seem to have a mechanism in place that works with the DotNetBuildUseMonoRuntime).

There are coreclr targeting platforms like SunOS, Haiku and NetBSD, which are pending AOT support. Those ports are work in progress and devs build the full VMR for testing on the machine as part of the work (old habit). Hence the condition <PublishAot Condition="'$(NativeAotSupported)' == 'true'">true</PublishAot> makes sense. I haven't done the reachability analysis, but keeping things consistent for now.

Those ports started in 2020 which predate NativeAOT integration. The new port OpenBSD is on the new plan where we've considered crossgen2/AOT as "mandatory" part of the porting process and completed the work in few months. Once the other ports are completed, we can simplify the "supported OS" part of the equation and do a cleanup pass. Haiku is almost there (AOT PR is up), SunOS needs 2-3 more PRs to get there (but the pace is a bit slow) and NetBSD is on the fritz for a while (I may get to it after OpenBSD and SunOS).

@akoeplinger akoeplinger 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

@akoeplinger
akoeplinger merged commit ecc427b into dotnet:main Jul 14, 2026
11 checks passed
@am11
am11 deleted the patch-9 branch July 14, 2026 14:26
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