-
Notifications
You must be signed in to change notification settings - Fork 16
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
armhf support #65
Comments
This would definitely require a Swift toolchain build, which I'm actually interested in supporting in the generator eventually. Are you targeting a specific Linux distribution? Would you be able to clarify what that is and its exact version for development and testing? |
I'm building on Ubuntu 22.04.3 |
I'm also interested in this but have been unable to build a full toolchain for Swift for armhf. We have been able to build llvm, swift, and the core libraries for armhf to be able to put together a simple sysroot for Debian 11 and 12, but beyond that that we don't have any other tools built. I wonder how much of a toolchain we actually need to support armhf/armv7 as a cross-compilation target with this SDK generator? @MaxDesiatov do you know what we'd need? |
Do you have a preset for that platform defined in the presets file? https://github.com/swiftlang/swift/blob/main/utils/build-presets.ini Core libraries should be enough in theory, and if those can be built with a readily available preset, it would simplify the generator setup a lot. |
I don't have anything in build-presents.ini, instead we've been using cmake due to the fact that it's actually possible to cross compile for armv7 without too much pain. Is it even possible to cross compile using buildbot? If not then that takes it away as an option... |
Everything buildable with a preset locally can be built with a buildbot too, I'm not aware of any differences between those two cases that would preclude cross-compilation. |
In my experience using build presets with buildbot to try to cross compile armv7 is a pain. There's always an issue of LLVM not finding something, some path being wrong, or it straight up doing a step that doesn't work for cross compilation. I will continue looking at it, but I wonder if the generator would work if I just pointed it to some artifacts that were built with cmake that are for armv7...which would include Swift stdlib, dispatch, foundation, and xctest. |
@MaxDesiatov I have a buildbot profile that can generate the Swift stdlib and corelibs (dispatch, foundation, xctest) for armv7 that can be used for cross-compilation. It does require a separate armhf sysroot of Ubuntu/Debian (possibly even Fedora) but this can be used on a CI system as well. I am working on creating a pull request to swiftlang/swift with these changes, but I still wonder how having this would help to create an SDK generator for it? Here are the directories that are generated from the buildbot in <install_destdir>/usr/lib/swift/linux:
I'm guessing that the armv7* files could probably be copied into swift.xctoolchain correct? And I'd imagine then that the *.so files for armv7 could then go into the SDK for the target. What do you think- how should this be setup? |
Can you include a preset that produces this output in your pull request and link that PR from here? Thanks! |
…-armhf' into swiftlang#65-support-building-armhf-sdks
I added a new ticket to swiftlang/swift to track changes for adding official cross-compilation support to the build scripts: My idea is to tackle it on a component-per-component basis to make sure nothing breaks in the process, since I see that the I have several goals here, but the biggest goal is being able to build a linux-armv7 toolchain, with the eventual goal of supporting armv7 officially on swift.org and even generating Docker containers from the CI. |
…r/swift-sdk-generator into swiftlang#65-support-armv7
…hain or a container (#170) This would implement #65. Although there is no official support for armv7 in Swift yet, this opens the door for being able to generate Swift SDKs for cross compilation to armv7 given you have build artifacts to give it. In my case, I can grab some that I built from my [swift-armv7 repo](https://github.com/xtremekforever/swift-armv7/releases/tag/6.0.3), download and extract, then run the generator like this: ```bash $ swift run swift-sdk-generator make-linux-sdk --swift-version 6.0.3-RELEASE --target armv7-unknown-linux-gnueabihf --target-swift-package-path ~/Downloads/swift-6.0.3-RELEASE-ubuntu-jammy-armv7-install ... All done! Install the newly generated SDK with this command: swift experimental-sdk install ~/swift-sdk-generator/Bundles/6.0.3-RELEASE_ubuntu_jammy_armv7.artifactbundle After that, use the newly installed SDK when building with this command: swift build --experimental-swift-sdk 6.0.3-RELEASE_ubuntu_jammy_armv7 ``` And, this generates a working Swift SDK that I can use to cross compile anything, like a Hummingbird app: ```bash $ swift build --swift-sdk 6.0.3-RELEASE_ubuntu_jammy_armv7 warning: 'swift-algorithms': found 1 file(s) which are unhandled; explicitly declare them as resources or exclude from the target ~/hummingbird-examples/hello/.build/checkouts/swift-algorithms/Sources/Algorithms/Documentation.docc Building for debugging... [948/948] Linking App Build complete! (35.16s) ``` So, I think that it could be reasonable to add this support to the generator now. It's something I will use myself, but also when official support for armv7 lands for Swift, it'll be ready ;) Co-authored-by: Max Desiatov <m_desiatov@apple.com>
@lhoward armhf support has been added to the swift-sdk-generator! All you need to do is this:
This assumes you have your own Swift 6.0.3 for armv7 built, or you download the one from my repo: https://github.com/xtremekforever/swift-armv7/releases/tag/6.0.3 I think this issue can be closed now that we have this support! |
How difficult would it be to add
armhf
target architecture support (for Linux)?The text was updated successfully, but these errors were encountered: