Skip to content

Improve default cross compiler state #88917

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

Merged
merged 3 commits into from
Jul 27, 2023

Conversation

directhex
Copy link
Contributor

@directhex directhex commented Jul 14, 2023

There are several cases where a "basic" build with Mono results in an inscrutable error:

  CMake Error at /usr/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
    Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)

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 on or 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 and BuildMonoCross 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 x64 mono-aot-cross binary)

@directhex directhex requested a review from marek-safar as a code owner July 14, 2023 16:13
@ghost ghost assigned directhex Jul 14, 2023
@ghost ghost added the area-Build-mono label Jul 14, 2023
@directhex directhex merged commit bc7621c into dotnet:main Jul 27, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Aug 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants