Improve default cross compiler state #88917
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are several cases where a "basic" build with Mono results in an inscrutable error:
Counter-intuitively, this is typically triggered by missing compiler flags in the
BuildMonoAOT
build target - caused by poor handling of cases where these variables are not specified on the command line. We also had some incorrect conditionals in variable setting based onor
sometimes evaluating the wrong groups.This PR fixes e.g.:
docker run -e ROOTFS_DIR=/crossrootfs/x64 -it -w $(pwd) --platform linux/amd64 -v $(pwd):$(pwd) mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-amd64 ./build.sh -ci -arch x64 --cross -os linux -s mono+libs+host+packs -c Release /p:MonoAOTEnableLLVM=true /p:MonoBundleLLVMOptimizer=true /p:BuildMonoAOTCrossCompiler=true /p:MonoLibClang="/usr/local/lib/libclang.so.16"
But we do not yet have a solution to:
docker run -e ROOTFS_DIR=/crossrootfs/arm64 -it -w $(pwd) --platform linux/amd64 -v $(pwd):$(pwd) mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm64 ./build.sh -ci -arch arm64 --cross -os linux -s mono+libs+host+packs -c Release /p:MonoAOTEnableLLVM=true /p:MonoBundleLLVMOptimizer=true /p:BuildMonoAOTCrossCompiler=true /p:MonoLibClang="/usr/local/lib/libclang.so.16"
The second case fails because we need a different ROOTFS_DIR value for
BuildMonoRuntime
andBuildMonoCross
targets (we can't build a cross-compiler to cross-compile for arm64 on an x64 host unless we have an x64 crossrootfs for an x64mono-aot-cross
binary)