swift-sdk-generator: Creating an AmazonLinux2 Swift SDK fails

Hello,

I wonder if it would be possible to generate an Amazon Linux 2 SDK ? When I try to follow instruction to generate a SDK with a docker image, it generates files with the name Ubuntu

I surely missed something.

swift run swift-sdk-generator make-linux-sdk --from-container-image swift:6.0-amazonlinux2 --with-docker --swift-version 6.0.1-RELEASE                 
Building for debugging...
[1/1] Write swift-version-7BB6C6736DFA3E78.txt
Build of product 'swift-sdk-generator' complete! (0.33s)

Looking up configuration values...

Downloading required toolchain packages...
Using downloaded artifacts in these locations:
/Users/stormacq/Desktop/swift-sdk-generator/Artifacts/host_llvm_17.0.5_arm64-apple-macos15.0.0.tar.xz
/Users/stormacq/Desktop/swift-sdk-generator/Artifacts/host_swift_6.0.1-RELEASE_arm64-apple-macos15.0.0.pkg

Unpacking and copying Swift binaries for the host triple...
10608439 blocks

Launching a Docker container to copy Swift SDK for the target triple from it...

Copying Swift core libraries for the target triple into Swift SDK bundle...

Unpacking and copying `lld` linker...

Fixing up absolute symlinks...

Fixing absolute paths in `glibc.modulemap`...

Generating toolset JSON file...

Generating destination JSON file...

Generating .artifactbundle manifest file...

All done! Install the newly generated SDK with this command:
swift experimental-sdk install /Users/stormacq/Desktop/swift-sdk-generator/Bundles/6.0.1-RELEASE_ubuntu_jammy_aarch64.artifactbundle

After that, use the newly installed SDK when building with this command:
swift build --experimental-swift-sdk 6.0.1-RELEASE_ubuntu_jammy_aarch64

Time taken for this generator run: 3:08 seconds.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21 (15 by maintainers)

Commits related to this issue

Most upvoted comments

Thank you @euanh and @xtremekforever, closing this now.

Amazon Linux is based on RHEL, so if certain logic of Swift SDK creation can be shared between distributions instead of maintaining two separate copies, why not share those?

Hi @sebsto

I can reproduce this problem.

When I try to follow instruction to generate a SDK with a docker image, it generates files with the name Ubuntu

This is the default, you can override it using the --sdk-name flag e.g. --sdk-name 6.0.1-RELEASE_amazon_linux_2_aarch64

ld.lld: error: /Users/stormacq/Library/org.swift.swiftpm/swift-sdks/6.0.1-RELEASE_ubuntu_jammy_aarch64.artifactbundle/6.0.1-RELEASE_ubuntu_jammy_aarch64/aarch64-unknown-linux-gnu/ubuntu-jammy.sdk/lib/gcc/aarch64-redhat-linux/7/…/…/…/…/lib64/libc.so:5: cannot find /lib/ld-linux-aarch64.so.1 inside /Users/stormacq/Library/org.swift.swiftpm/swift-sdks/6.0.1-RELEASE_ubuntu_jammy_aarch64.artifactbundle/6.0.1-RELEASE_ubuntu_jammy_aarch64/aarch64-unknown-linux-gnu/ubuntu-jammy.sdk

My initial thought was that this was also caused by the SDK generator’s default assumption that it is working with an Ubuntu-derived distribution, whereas it seems Amazon Linux is based on CentOS. I had hoped that specifying --linux-distribution rhel would fix this - that flag causes it to handle some Ubuntu/RHEL differences. However I get the same error so I’ll need to investigate more.