When I try to cross compile Swift 5.10 using the utils/build-script, I get the following crash:
Traceback (most recent call last):
File "/home/builduser/workspace/swift/./utils/build-script", line 800, in <module>
exit_code = main()
File "/home/builduser/tmp/swift-armv7/workspace/swift/./utils/build-script", line 795, in main
return main_normal()
File "/home/builduser/tmp/swift-armv7/workspace/swift/./utils/build-script", line 740, in main_normal
invocation.execute()
File "/home/builduser/tmp/swift-armv7/workspace/swift/utils/swift_build_support/swift_build_support/build_script_invocation.py", line 734, in execute
self._execute(pipeline, all_host_names)
File "/home/builduser/tmp/swift-armv7/workspace/swift/utils/swift_build_support/swift_build_support/build_script_invocation.py", line 794, in _execute
self.execute_product_build_steps(product_class, host_target)
File "/home/builduser/tmp/swift-armv7/workspace/swift/utils/swift_build_support/swift_build_support/build_script_invocation.py", line 855, in execute_product_build_steps
product.build(host_target)
File "/home/builduser/tmp/swift-armv7/workspace/swift/utils/swift_build_support/swift_build_support/products/llvm.py", line 212, in build
toolchain_file = self.generate_linux_toolchain_file(platform, arch)
File "/home/builduser/tmp/swift-armv7/workspace/swift/utils/swift_build_support/swift_build_support/products/product.py", line 403, in generate_linux_toolchain_file
maybe_sysroot = self.get_linux_sysroot(platform, arch)
File "/home/builduser/tmp/swift-armv7/workspace/swift/utils/swift_build_support/swift_build_support/products/product.py", line 373, in get_linux_sysroot
sysroot_arch, abi = self.get_linux_target_components(arch)
ValueError: too many values to unpack (expected 2)
I did a little bit of investigation, and turns out it's just a simple typo in this method in utils/swift_build_support/swift_build_support/products/product.py:
def get_linux_sysroot(self, platform, arch):
if not self.is_cross_compile_target('{}-{}'.format(platform, arch)):
return None
sysroot_arch, abi = self.get_linux_target_components(arch)
# $ARCH-$PLATFORM-$ABI
# E.x.: aarch64-linux-gnu
sysroot_dirname = '{}-{}-{}'.format(sysroot_arch, platform, abi)
return os.path.join(os.sep, 'usr', sysroot_dirname)
The get_linux_target_components() method returns 3 values instead of 2, so the sysroot_arch, abi = self.get_linux_target_components(arch) line should be: sysroot_arch, _, abi = self.get_linux_target_components(arch).
Reproduction
One easy way to reproduce this is by checking out the release/5.10 branch of swiftlang/swift, then running the build-script:
After it gets past the LLVM build stuff, the build crashes with the error above.
Expected behavior
I expect to not get a crash when cross compiling. This seems like just a small typo, and something introduced starting with Swift 5.10 (it was not present in 5.9).
Environment
Swift version 5.10.1 (swift-5.10.1-RELEASE)
Target: x86_64-unknown-linux-gnu
Description
When I try to cross compile Swift 5.10 using the utils/build-script, I get the following crash:
I did a little bit of investigation, and turns out it's just a simple typo in this method in
utils/swift_build_support/swift_build_support/products/product.py
:The
get_linux_target_components()
method returns 3 values instead of 2, so thesysroot_arch, abi = self.get_linux_target_components(arch)
line should be:sysroot_arch, _, abi = self.get_linux_target_components(arch)
.Reproduction
One easy way to reproduce this is by checking out the release/5.10 branch of swiftlang/swift, then running the build-script:
./swift/utils/build-script --cross-compile-hosts=linux-armv7 --skip-build-llvm
After it gets past the LLVM build stuff, the build crashes with the error above.
Expected behavior
I expect to not get a crash when cross compiling. This seems like just a small typo, and something introduced starting with Swift 5.10 (it was not present in 5.9).
Environment
Swift version 5.10.1 (swift-5.10.1-RELEASE) Target: x86_64-unknown-linux-gnu
Additional information
No response