This is an archive of the discontinued LLVM Phabricator instance.

test-release.sh: Add support for cross-compiling
Needs ReviewPublic

Authored by tstellar on May 24 2023, 4:01 PM.

Details

Reviewers
thieta
sscalpone
Summary

To enable cross-compiling, pass a CMake toolchain file to the script using
the -toolchain-file option.

For example:
./test-release.sh -release 16.0.0 -final -toolchain-file pwd/aarch64-redhat-linux.cmake -triple aarch64-redhat-linux -use-ninja

Diff Detail

Event Timeline

tstellar created this revision.May 24 2023, 4:01 PM
Herald added a project: Restricted Project. · View Herald Transcript
tstellar requested review of this revision.May 24 2023, 4:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 24 2023, 4:01 PM

Looks fine to me. But I am unsure if we need to have the toolchain file checked into LLVM. Wouldn't that be up to the person cross-compiling? Going to be hard to assume stuff there?

barannikov88 added inline comments.
llvm/utils/release/aarch64-redhat-linux.cmake
5

How about splitting this into
CMAKE_SYSROOT and CMAKE_<LANG>_COMPILER_TARGET?
(This is what the CMake documentation suggests, I don't know if it works).

thieta added inline comments.May 25 2023, 5:47 AM
llvm/utils/release/aarch64-redhat-linux.cmake
5

Yeah that totally works and is the right way to handle that for sure.

Compared with my internal toolchain files this one seems very short and missing stuff. But I am not convinced that we should have one of these files in the LLVM repo in the first place.

But I am not convinced that we should have one of these files in the LLVM repo in the first place.

It could serve as an example. There is a bunch of CMake cache files in clang/cmake/caches and those are quite helpful in understanding how to build a toolchain.
It would be nice if this is mentioned in documentation, however.

llvm/utils/release/aarch64-redhat-linux.cmake
5

It might serve as an example.
Maybe in different directory though

Looks fine to me. But I am unsure if we need to have the toolchain file checked into LLVM. Wouldn't that be up to the person cross-compiling? Going to be hard to assume stuff there?

I wanted to add cross-compile support so that we could build 'official' binaries using GitHub actions for other arches besides x86_64. For this scenario, I think it makes sense to have the toolchain file somewhere in tree, so that it is easy to reproduce the builds. This specific file works with a container image that I created with all the necessary cross-libs, which I would also like to put in tree somewhere.

Looks fine to me. But I am unsure if we need to have the toolchain file checked into LLVM. Wouldn't that be up to the person cross-compiling? Going to be hard to assume stuff there?

I wanted to add cross-compile support so that we could build 'official' binaries using GitHub actions for other arches besides x86_64. For this scenario, I think it makes sense to have the toolchain file somewhere in tree, so that it is easy to reproduce the builds. This specific file works with a container image that I created with all the necessary cross-libs, which I would also like to put in tree somewhere.

I guess this makes sense for that use. I wonder if we shouldn't start putting these files (all files related to release management) in a new top-level directory like release or utils instead of shoving them under the llvm directory. I think it might make more sense and be easier to understand that they are universal instead of just related to the llvm sub-project.