Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for generating Swift SDKs for Ubuntu 24.04 Noble #188

Merged
merged 9 commits into from
Feb 25, 2025

Conversation

xtremekforever
Copy link
Contributor

I was working on adding Debian 12 support for #116, but realized that adding Ubuntu Noble is "low-hanging fruit", since it's very straightforward. The default is still Ubuntu 22.04 Jammy, but this adds the option of generating the Swift SDK for 24.04 Noble now.

swift run swift-sdk-generator make-linux-sdk --linux-distribution-version 24.04

I have also changed the packages download to get Packages.xz instead of Packages.gz since it is a smaller file download. I wonder if it is okay to use xz here since I noticed that the directories on the Debian mirrors only have Packages.xz files available, unlike the Ubuntu mirrors which all have Packages.gz AND Packages.xz files available.

@MaxDesiatov @euanh

@MaxDesiatov
Copy link
Contributor

IIRC problem with xz was that it required additional tooling installed on macOS, and at least documentation updated here in README.md to reflect that. Maybe we should also have it listed in a Brewfile, especially if we don't have this file already.

@xtremekforever
Copy link
Contributor Author

IIRC problem with xz was that it required additional tooling installed on macOS, and at least documentation updated here in README.md to reflect that. Maybe we should also have it listed in a Brewfile, especially if we don't have this file already.

Yep, looks like xz is not available natively on macOS. So you think it's fine as long as we show it in the README.md? Also, provide a Brewfile to install it for you (not sure how those work)?

@MaxDesiatov
Copy link
Contributor

MaxDesiatov commented Feb 17, 2025

Yes, providing a command to install from
a Brewfile in README.md seems reasonable.

I'd also prefer the generator to fall back to the currently support archive format if xz is not installed.

@xtremekforever
Copy link
Contributor Author

Yes, providing a command to install from a Brewfile in README.md seems reasonable.

I'd also prefer the generator to fall back to the currently support archive format if xz is not installed.

That can be done! And then when we are interacting with the Debian mirrors, I guess we could just throw if xz is not installed and show that it is required for creating a Swift SDK for Debian.

Copy link
Contributor

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, just a logging nit so that users are informed about this subtlety

 - In the future it may be required for Debian, but for now it is optional.
 - Seems like the environment needed to be passed to the which() method.
@MaxDesiatov MaxDesiatov requested a review from euanh February 20, 2025 15:34
@MaxDesiatov
Copy link
Contributor

@swift-ci test

@MaxDesiatov MaxDesiatov merged commit 0aa5486 into swiftlang:main Feb 25, 2025
3 checks passed
@xtremekforever xtremekforever deleted the #116-support-ubuntu-noble branch February 25, 2025 16:51
MaxDesiatov pushed a commit that referenced this pull request Mar 3, 2025
…ts (#193)

Apparently I didn't test very well from PR #188, because when I went to use the Ubuntu Noble Swift SDK, I got this error:

```
error: link command failed with exit code 1 (use -v to see invocation)
ld.lld: error: ~/.swiftpm/swift-sdks/6.0.3-RELEASE_ubuntu_noble_aarch64.artifactbundle/6.0.3-RELEASE_ubuntu_noble_aarch64/aarch64-unknown-linux-gnu/ubuntu-noble.sdk/usr/lib/aarch64-linux-gnu/libm.so:4: cannot find /lib/aarch64-linux-gnu/libm.so.6 inside ~/.swiftpm/swift-sdks/6.0.3-RELEASE_ubuntu_noble_aarch64/aarch64-unknown-linux-gnu/ubuntu-noble.sdk
>>> GROUP ( /lib/aarch64-linux-gnu/libm.so.6  AS_NEEDED ( /lib/aarch64-linux-gnu/libmvec.so.1 ) )
>>>         ^
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld.lld: error: ~/.swiftpm/swift-sdks/6.0.3-RELEASE_ubuntu_noble_aarch64.artifactbundle/6.0.3-RELEASE_ubuntu_noble_aarch64/aarch64-unknown-linux-gnu/ubuntu-noble.sdk/usr/lib/aarch64-linux-gnu/libm.so:4: cannot find /lib/aarch64-linux-gnu/libm.so.6 inside /~/.swiftpm/swift-sdks/6.0.3-RELEASE_ubuntu_noble_aarch64.artifactbundle/6.0.3-RELEASE_ubuntu_noble_aarch64/aarch64-unknown-linux-gnu/ubuntu-noble.sdk
>>> GROUP ( /lib/aarch64-linux-gnu/libm.so.6  AS_NEEDED ( /lib/aarch64-linux-gnu/libmvec.so.1 ) )
>>>         ^
```

Turns out, the packages for Ubuntu Noble do not come with a lib/ symlink included, so all I needed was to add a custom step to create that symlink from `ubuntu-noble.sdk/lib` -> `ubuntu-noble.sdk/usr/lib` and all is well.

As a part of these changes, I also added a missing cleanup of the target toolchain to remove unused parts of the LinuxRecipe as is done for the [WebAssemblyRecipe](https://github.com/swiftlang/swift-sdk-generator/blob/a0ff972af294243ef9211534f7c9ba6f83672b82/Sources/SwiftSDKGenerator/SwiftSDKRecipes/WebAssemblyRecipe.swift#L120-L125). Doing this reduces the size of `ubuntu-noble.sdk` from 1GB to 721MB, when building the Swift SDK without docker. This can help for the end-to-end tests, and is nice to have for smaller Swift SDK distributions.

Finally, I updated the EndToEndTests to provide `linuxDistributionVersion` and set the Swift60_Ubuntu tests to use "24.04" as a way to test this lib/ directory fix. This has me thinking we may want to think about end-to-end tests for each version of Ubuntu, like "20.04", "22.04", and "24.04", for each version of Swift.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants