Running swift run swift-sdk-generator make-linux-sdk in a Ubuntu 22.04 container produces the following error:
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
Error: Process launched with CommandInfo(command: "tar -C \"/swift-sdk-generator/Artifacts/host_llvm_17.0.5_x86_64-unknown-linux\" --strip-components=1 -xzf /swift-sdk-generator/Artifacts/host_llvm_17.0.5_x86_64-unknown-linux.tar.xz", file: "/swift-sdk-generator/Sources/SwiftSDKGenerator/Generator/SwiftSDKGenerator.swift", line: 245) failed with exit code 2
Full output log
# swift run swift-sdk-generator make-linux-sdk
Building for debugging...
[1/1] Write swift-version-24593BA9C3E375BF.txt
Build complete! (0.53s)
Looking up configuration values...
Downloading required toolchain packages...
Using downloaded artifacts in these locations:
/swift-sdk-generator/Artifacts/target_swift_5.9.2-RELEASE_x86_64-unknown-linux-gnu.tar.gz
/swift-sdk-generator/Artifacts/host_llvm_17.0.5_x86_64-unknown-linux.tar.xz
/swift-sdk-generator/Artifacts/host_swift_5.9.2-RELEASE_x86_64-unknown-linux.pkg
Parsing Ubuntu packages list...
Downloading 11 Ubuntu packages...
http://gb.archive.ubuntu.com/ubuntu/pool/main/g/glibc/libc6-dev_2.35-0ubuntu3.8_amd64.deb – 2.1 MB
http://gb.archive.ubuntu.com/ubuntu/pool/main/g/glibc/libc6_2.35-0ubuntu3.8_amd64.deb – 3.2 MB
http://gb.archive.ubuntu.com/ubuntu/pool/main/z/zlib/zlib1g-dev_1.2.11.dfsg-2ubuntu9.2_amd64.deb – 164 KB
http://gb.archive.ubuntu.com/ubuntu/pool/main/g/gcc-12/libgcc-s1_12.3.0-1ubuntu1~22.04_amd64.deb – 54 KB
http://gb.archive.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_5.15.0-113.123_amd64.deb – 1.3 MB
http://gb.archive.ubuntu.com/ubuntu/pool/main/z/zlib/zlib1g_1.2.11.dfsg-2ubuntu9.2_amd64.deb – 58 KB
http://gb.archive.ubuntu.com/ubuntu/pool/main/g/gcc-12/libstdc++6_12.3.0-1ubuntu1~22.04_amd64.deb – 699 KB
http://gb.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-12/libstdc++-12-dev_12.3.0-1ubuntu1~22.04_amd64.deb – 2.2 MB
http://gb.archive.ubuntu.com/ubuntu/pool/main/g/gcc-12/libgcc-12-dev_12.3.0-1ubuntu1~22.04_amd64.deb – 2.6 MB
http://gb.archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu70_70.1-2_amd64.deb – 10.6 MB
http://gb.archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu-dev_70.1-2_amd64.deb – 11.6 MB
control.tar.zst
data.tar.zst
debian-binary
control.tar.zst
data.tar.zst
debian-binary
control.tar.zst
data.tar.zst
debian-binary
control.tar.zst
data.tar.zst
debian-binary
control.tar.zst
data.tar.zst
debian-binary
control.tar.zst
data.tar.zst
debian-binary
control.tar.zst
data.tar.zst
debian-binary
control.tar.zst
data.tar.zst
debian-binary
control.tar.zst
data.tar.zst
debian-binary
control.tar.zst
data.tar.zst
debian-binary
control.tar.zst
data.tar.zst
debian-binary
Unpacking and copying Swift binaries for the host triple...
8460552 blocks
Unpacking Swift distribution for the target triple...
Copying Swift core libraries for the target triple into Swift SDK bundle...
Unpacking and copying `lld` linker...
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
Error: Process launched with CommandInfo(command: "tar -C \"/swift-sdk-generator/Artifacts/host_llvm_17.0.5_x86_64-unknown-linux\" --strip-components=1 -xzf /swift-sdk-generator/Artifacts/host_llvm_17.0.5_x86_64-unknown-linux.tar.xz", file: "/swift-sdk-generator/Sources/SwiftSDKGenerator/Generator/SwiftSDKGenerator.swift", line: 245) failed with exit code 2
The issue seems to be that the z flag in tar -xzf seems to force GNU tar into unzipping, even if the archive is compressed with XZ. macOS tar seems to recognize the format correctly, hence why this issue likely didn't come up there.
On Linux (with GNU tar):
$ echo '123' > a
$ tar -cJf a.tar.xz a
$ file a.tar.xz
a.tar.xz: XZ compressed data, checksum CRC64
$ mkdir unpacked
$ tar -xzf a.tar.xz -C unpacked
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
$ tar -xf a.tar.xz -C unpacked
$ cat unpacked/a
123
On macOS:
$ echo '123' > a
$ tar -cJf a.tar.xz a
$ file a.tar.xz
a.tar.xz: XZ compressed data, checksum CRC64
$ mkdir unpacked
$ tar -xzf a.tar.xz -C unpacked
$ cat unpacked/a
123
$ tar -xf a.tar.xz -C unpacked
$ cat unpacked/a
123
Running
swift run swift-sdk-generator make-linux-sdk
in a Ubuntu 22.04 container produces the following error:Full output log
The issue seems to be that the
z
flag intar -xzf
seems to force GNU tar into unzipping, even if the archive is compressed with XZ. macOS tar seems to recognize the format correctly, hence why this issue likely didn't come up there.On Linux (with GNU tar):
On macOS: