Skip to content

Add ability to use clang with GNU toolchain on Haiku#16756

Merged
jkoritzinsky merged 2 commits intodotnet:mainfrom
am11:patch-19
Apr 25, 2026
Merged

Add ability to use clang with GNU toolchain on Haiku#16756
jkoritzinsky merged 2 commits intodotnet:mainfrom
am11:patch-19

Conversation

@am11
Copy link
Copy Markdown
Member

@am11 am11 commented Apr 24, 2026

Downstream PR: dotnet/runtime#127392

locate_toolchain_exec(g++ CMAKE_CXX_COMPILER)
elseif(HAIKU)
set(CMAKE_SYSROOT "${CROSS_ROOTFS}")
set(CMAKE_PROGRAM_PATH "${CMAKE_PROGRAM_PATH};${CROSS_ROOTFS}/cross-tools-x86_64/bin")
Copy link
Copy Markdown
Contributor

@trungnt2910 trungnt2910 Apr 24, 2026

Choose a reason for hiding this comment

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

Will CMake still be able to correctly search for the GCC cross-compilers after this for pure-GNU builds (with the -gcc flag)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We normally only support either clang or gcc with --cross. clang is usually preferred; one reason is llvm-toolchains are multi-targeting (clang and lld can produce any binary on any host platform, including windows) while GNU toolchain is built in a target specific manner.

I have added the check to make -gcc work though. I recommend you switch to clang and mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net11.0-cross-haiku-amd64 as well for builds to keep things tight and in check (unless there is a problem / meaningful-difference with binaries produced by either toolchain).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sure, if that's the case (and if you have already gotten a full clang-based build working) then I'm fine with dropping GCC.

If there are any further bugs it's better to upstream patches to llvm-project instead.

@jkoritzinsky jkoritzinsky merged commit e822416 into dotnet:main Apr 25, 2026
9 checks passed
@am11 am11 deleted the patch-19 branch April 25, 2026 17:48
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