Unable to cross-compile for a Linux platform with the buildbot scripts #78960
Labels
armv7
Architecture: ARMv7
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
build-script
Area → utils: The build script
cross-compilation
Area → utils: Cross-compilation of project sources
Description
In order to build Swift for platforms such as armv6, armv7, or even less-powerful arm64 architectures, the ideal way to build is to cross-compile instead of trying to build the Swift toolchain directly on the target, which is very slow.
However, currently the build scripts in the swiftlang/swift repo do not properly support cross compilation for Linux architectures. For example, when trying to build for armv7 and an external sysroot, the first build steps completely fail to build for the desired architecture. As an example, here is the failure from cmark:
Reproduction
To reproduce the first issue with cmark, run the following command in Linux/Ubuntu:
Otherwise, run it without --build-llvm=0 to see other crashes that occur after LLVM is built for the host:
Basically, every step of compilation will fail without being patched.
Expected behavior
I would expect the above commands to succeed as long as the armv7 (armhf) libraries are installed in the host using something like:
Cross compilation should also work if using an external sysroot, like this:
Environment
Swift version 6.0.3 (swift-6.0.3-RELEASE)
Target: x86_64-unknown-linux-gnu
Additional information
I intend to look at updating the scripts to properly cross compile to linux- hosts. If this is not the proper path, please let me know, but this seems to be the most logical thing to use since --cross-compile-hosts can already cross-compile to other Apple platforms.
Here are the short terms goals of being able to cross compile using the build-script. Let's get the build scripts updated to make it possible to cross compile the following components to linux-armv7:
This is the "minimal installation" that is needed for something like a cross-compilation Swift SDK (swift-sdk-generator).
The text was updated successfully, but these errors were encountered: