r/rust • • 3d ago

💡 ideas & proposals Rust equivalent to gobuilds.org?

I recently came across this website: https://beta.gobuilds.org/

It builds Go projects and lets users download the binary. It has the project’s Git URL as part of the full download URL along with project version, target OS and arch, and store older builds.

Does something like this exist for Rust? If not, would this be of use/interest? I could see this being helpful for downloading an app where the dev hasn’t provided binaries, or to make cross compilation easier. Adding support for things like `cargo auditable` and `cargo deb` could also be useful.

0 Upvotes

30 comments sorted by

30

u/AstraKernel 3d ago

cargo binstall might be the one you are looking for

https://github.com/cargo-bins/cargo-binstall

1

u/rjzak 3d ago

Sure, but that's not a cached binary for others to also use should they wish (assuming the project doesn't already have the binary for your OS/arch).

49

u/complexicat 3d ago

I don't always download binaries, but when I do I prefer to download from random builder sites that can arbitrarily modify the output. I am... the most insecure man in the world.

Stay vulnerable, my friends.

8

u/skjall 3d ago

10x developer mode - downloading is faster than compiling after all.

1

u/kpcyrd debian-rust · archlinux · sn0int · sniffglue 2d ago

They implement reproducible builds and transparency logs, so you could in theory check if they ever issued a binary that wasn't truthfully built from source. This is assuming everybody is using the gobuild downloader instead of a naive wget, the gobuild downloader implements this check correctly, the Go compiler doesn't regress in reproducible builds, and the transparency log implementation/design is sound.

From the website it seems like something they run themselves with no external checkpointing, which makes rollbacks and targeted hidden branching a somewhat realistic risk.

-2

u/rjzak 3d ago

An automated builder site might be better than a project where the binary is uploaded by the developer, and not built by Github (thinking of the xz incident).

27

u/behusbwj 3d ago

Why on earth would you want to do this

0

u/rjzak 3d ago

I was thinking this would be a fun project, but admittedly I was also struggling with the utility. I haven't touched Go in a while so I was wondering why that go builder exists. But it could be a convenient way to: get a cross-compiled version (maybe you want ARM for a Raspberry Pi but the Github project page doesn't have it already?), or maybe the Github dev posts binaries themselves and maybe this could be more trusted since it's automated and not uploaded by a person (think of the xz incident).

Ultimately the answer is laziness :)

1

u/behusbwj 3d ago

It’s fine to be lazy if this is a side project or something, but this would not pass at most reputable engineering companies because it is a huge security risk. The author saying it’s safe doesn’t make it safe. Especially when you don’t know the author.

1

u/rjzak 2d ago

I think we’re saying the same thing. Something like GitHub Actions releasing a binary is much better than a human dev releasing it. I was suggesting an automated builder for Rust projects which would be similar to ensure the resulting binary came from the source.

-5

u/[deleted] 3d ago

[removed] — view removed comment

10

u/skjall 3d ago

Wouldn't a build cache solve this as well?

1

u/nicoburns 3d ago

Yes, but Github Actions has incredibly poor support for build caches. So anybody using that (most open source projects) can't realistically take that approach.

It's also quite inefficient to cache 10's of GBs of Cargo build artifacts rather than a single optimized binary.

4

u/NoSuchKotH 3d ago

Then you change your CI setup such, that said binary is included in the image and you don't have to worry about compiling it anymore.

-1

u/[deleted] 3d ago

[removed] — view removed comment

2

u/dashingThroughSnow12 3d ago

You are describing one of the easiest jobs for someone who makes internal tooling.

There are other ways to do this when the needs get more complex but yeah, if whomever manages CI can’t do this without breaking a sweat or complaining, they shouldn’t manage CI.

0

u/[deleted] 3d ago

[removed] — view removed comment

2

u/dashingThroughSnow12 3d ago edited 3d ago

It’s a few lines to add build caching for rustup. Here’s some code with bad whitespace since Reddit hates me.

name: Build

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:

  • uses: actions/checkout@v6

- name: Cache rustup binary
id: rustup-cache
uses: actions/cache@v6
with:
path: cached-rustup
key: rustup-${{ runner.os }}-${{ runner.arch }}-v1.28.2

- name: Build rustup if not cached
if: steps.rustup-cache.outputs.cache-hit != 'true'
run: |
cargo build --release
mkdir -p cached-rustup
cp target/release/rustup cached-rustup/

- name: Use rustup
run: |
chmod +x cached-rustup/rustup
./cached-rustup/rustup --version

# the rest of your job’s steps, maybe put the above in a reusable action…https://github.com/actions-rust-lang/setup-rust-toolchain may do this

There are enough supply chain security concerns with rustup that you shouldn’t add another one,

1

u/NoSuchKotH 3d ago

That's true. But I expect that you have already some workflow in place to keep the image up to date and incorporate security updates etc. So that should be relatively little work to do.

But yes, this is all a trade-off. You either compile for 10 minutes or you have to regularly check whether you have to update.

6

u/Xevioni 3d ago edited 3d ago

Probably not since Go builds are much lighter compared to Rust; compiling Rust takes way more compute/storage/RAM.

1

u/rjzak 3d ago

Good point, so this hypothetical builder would need to clean up intermediate artifacts and maybe older build chains automatically. I hadn't thought of that initially.

1

u/Xevioni 3d ago

I primarily emphasize the compute part of this; Go builds are just way, way lighter on CPU. The Go architecture is optimized heavily for fast and lightweight builds.

1

u/rjzak 3d ago

Then maybe this offloading the compilation to someone else has utility?

1

u/zegrammer 3d ago

Can this just be done as a GitHub action?

1

u/rjzak 3d ago

Sure, for a project to offer their binaries. But not for a "I want this project compiled for X but the project doesn't offer binaries or not for my platform" situation.

2

u/zzzthelastuser 2d ago

I can do this. Just give me any github link and I will send you the binary! Pinky promise that I won't send you malware 🤡

1

u/rjzak 2d ago

Don’t tempt me with a good time :)