swift-riscv / swift-riscv64

Building swift for riscv64 platforms
Apache License 2.0
21 stars 1 forks source link

Status for Swift 5.9 and beyond? #8

Closed silvanshade closed 9 months ago

silvanshade commented 10 months ago

First, thanks for working on this.

I was wondering if you could summarize the current status of RISC-V support for Swift 5.9 and beyond.

I see the patches for the 5.8 sources in the respective directory but it looks like several of those changes are not included (yet?) in the 5.9 patches.

Is support for the 5.9 releases still a work in progress or is the intention that most of the changes will be included upstream? I briefly tried to compile 5.9.1 for riscv64-unknown-linux-gnu (including the patches from here) but it quickly failed, so I'm assuming most of the changes from here are not actually included in the main Swift project repo. Is that correct?

I may just go ahead and try to port the missing 5.8 patches to 5.9 and see if it works but if you have any comments about the current implementation status, or whether there are issues 5.9, I would appreciate it.

futurejones commented 10 months ago

@silvanshade at this point I am not looking at building for 5.9 and beyond until we can get a successful build on 5.8.

Building 5.9 and beyond now require a preinstalled 5.8.1 toolchain for the standard build method. The Swift build-ci docker images now all include 5.8.1 installed - https://github.com/apple/swift-docker/blob/main/swift-ci/master/ubuntu/22.04/Dockerfile

The other main issue at the moment is the lack of progress and support in Ubuntu for riscv64. I originally was using ubuntu 22.04 as the main riscv64 build platform but there have been no updates from ubuntu for riscv64 docker images for more than 12 months.

Debian on the other hand has announced full support for riscv64 in their next release (Debian 13 Trixie) and are constantly pushing updates.

I am now moving to Debian for the main build test platform for riscv64.

As there are no official swift builds for Debian this requires building and verifying arm64 and x86_64 builds as well as trying to build riscv64 to ensure platform build issues are not mistaken as riscv64 build issues.

The only riscv64 hardware I have access to at the moment is the VisionFive 2 board which is extremely slow and makes testing and verification very time consuming. I hope to have news about new hardware coming soon Milk-V Pioneer which should speed up progress considerably.

silvanshade commented 10 months ago

Thanks for the response.

@silvanshade at this point I am not looking at building for 5.9 and beyond until we can get a successful build on 5.8.

Building 5.9 and beyond now require a preinstalled 5.8.1 toolchain for the standard build method. The Swift build-ci docker images now all include 5.8.1 installed - https://github.com/apple/swift-docker/blob/main/swift-ci/master/ubuntu/22.04/Dockerfile

Oh, okay. I hadn't actually tried to build for 5.8, but that clarifies the situation.

The other main issue at the moment is the lack of progress and support in Ubuntu for riscv64. I originally was using ubuntu 22.04 as the main riscv64 build platform but there have been no updates from ubuntu for riscv64 docker images for more than 12 months.

Debian on the other hand has announced full support for riscv64 in their next release (Debian 13 Trixie) and are constantly pushing updates.

I am now moving to Debian for the main build test platform for riscv64.

I see. That's unfortunate about the lack of updates for the docker images. At this point, I've mostly just been experimenting with RISC-V on Ubuntu by using MultiArch and QEMU. It seems to work reasonably well for what I've been doing so far.

As there are no official swift builds for Debian this requires building and verifying arm64 and x86_64 builds as well as trying to build riscv64 to ensure platform build issues are not mistaken as riscv64 build issues.

That makes sense.

I'd be interested in helping out with that somehow if there's some useful way to contribute.

The reason I opened the issue to ask this question is because I'm working on a project to develop Rust libraries to interface with the C++ APIs for LLVM, Clang, MLIR, and Swift (the compiler libraries).

One of the challenges in getting this to work seamlessly for downstream users of those Rust libraries is how to handle the availability of LLVM toolchain libraries on the user's system. Ideally, I want to avoid requiring users to manually compile LLVM and related components, but currently there isn't another realistic option, especially since the C++ libraries are often not distributed with a typical LLVM installation (e.g., on Windows, or not on any platform by default for the Swift compiler libraries).

Something I started working on as a solution to that is another project called llvmup, which is intended to work similar to rustup if you're familiar with that. The idea is to have a tool that allows a user to easily download a prebuilt toolchain, separated into multiple components, for the native platform or various target platforms (for cross-compilation).

The part of that project where I'm providing the prebuilt toolchains is at llvmup/toolchains. I'm still working out a few issues with the build/release process, but in any case, one of the included components is the Swift compiler libraries. (I'm not building the full Swift toolchain since it's not needed, but I have experimented with that).

The swift-including toolchains components are currently being built for amd64, armv7, arm64, i686, ppc64el, and s390x. For toolchains including everything except Swift, I also build for riscv64.

If there's something I could do to help with Swift on RISC-V, it would help me fix that asymmetry in the toolchain offerings.

The only riscv64 hardware I have access to at the moment is the VisionFive 2 board which is extremely slow and makes testing and verification very time consuming. I hope to have news about new hardware coming soon Milk-V Pioneer which should speed up progress considerably.

That's good to hear! Actually, I am hoping to be receiving a Pioneer board soon also.

Anyway, thanks for the information. I'd be interested to hear any updates about all of this. If there's something I can help test, or some way to help out with the build issues, please let me know.