This is an archive of the discontinued LLVM Phabricator instance.

Optionally install clang-tblgen to aid cross-compiling
ClosedPublic

Authored by chewi on Jan 5 2023, 2:54 PM.

Details

Summary

clang-tblgen is required to cross-compile clang itself. Unlike before, most of the infrastructure is in place to do this now, and the only thing preventing it is LLVM_BUILD_UTILS, which doesn't apply to Clang.

I thought about changing this to ${project}_BUILD_UTILS and adding a CLANG_BUILD_UTILS option, but there seems little point for just one tool.

Instead, it checks whether clang-tblgen was explicitly requested in LLVM_DISTRIBUTION_COMPONENTS, which is good enough for Gentoo and other distributions.

Closes: https://github.com/llvm/llvm-project/issues/20282

Diff Detail

Event Timeline

chewi created this revision.Jan 5 2023, 2:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 5 2023, 2:54 PM
Herald added a subscriber: StephenFan. · View Herald Transcript
chewi requested review of this revision.Jan 5 2023, 2:54 PM
chewi added a comment.Jan 5 2023, 3:56 PM

Apologies. I conceived this against 15.0.6, but have now noticed that the latest TableGen.cmake may have changed things. I'll retest tomorrow and adjust as necessary.

chewi updated this revision to Diff 487073.Jan 7 2023, 2:38 AM
chewi edited the summary of this revision. (Show Details)
chewi added a reviewer: nikic.

Reworked and retested against the main branch. Thankfully, it is simpler now.

Herald added a project: Restricted Project. · View Herald TranscriptJan 7 2023, 2:38 AM
chewi added a comment.Jan 7 2023, 2:42 AM

I forgot to add: I notice you no longer need llvm-tblgen already present when cross-compiling LLVM, but sadly, that still isn't the case for clang-tblgen. I tried leveraging CrossCompile.cmake to perform a "NATIVE" Clang build, but I think a lot more work would be needed to do it this way.

nikic accepted this revision.Jan 11 2023, 7:48 AM

LGTM

This revision is now accepted and ready to land.Jan 11 2023, 7:48 AM
chewi added a comment.Jan 11 2023, 1:51 PM

I don't have commit access. Please merge this for me.

nikic added a comment.Jan 11 2023, 2:04 PM

Can you please share the Name <email> to use for the commit?

chewi added a comment.Jan 11 2023, 3:44 PM

James Le Cuirot <chewi@gentoo.org>

I'm new to this process, so thanks for bearing with me.

This revision was landed with ongoing or failed builds.Jan 12 2023, 12:44 AM
This revision was automatically updated to reflect the committed changes.