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

Prepare releases, including pre-built binaries #209

Merged
merged 10 commits into from
Dec 2, 2024

Conversation

andrewdavidmackenzie
Copy link
Contributor

@andrewdavidmackenzie andrewdavidmackenzie commented Nov 30, 2024

Fixes #207

Using cargo-dist to do the builds for selected targets and then create the release, upload sourc etarball as usual plus binary assets.

Adds a short RELEASING.md document to document the process.

Here is the first attempt at a release build in my own repo:

https://github.com/andrewdavidmackenzie/wild/actions/runs/12099771708

It's lacking something installed for musl so fails, which I'll try and fix.

@andrewdavidmackenzie andrewdavidmackenzie marked this pull request as draft November 30, 2024 22:02
@andrewdavidmackenzie andrewdavidmackenzie changed the title Prepare releases, including pre-built binaries WIP: Prepare releases, including pre-built binaries Nov 30, 2024
@andrewdavidmackenzie
Copy link
Contributor Author

andrewdavidmackenzie commented Nov 30, 2024

warning: [email protected]: Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is musl-g++ installed?

on my machine I (seem to, never knew!!) have musl-gcc installed. I guess it needs that?

@davidlattimore
Copy link
Owner

warning: [email protected]: Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is musl-g++ installed?

on my machine I (seem to, never knew!!) have musl-gcc installed. I guess it needs that?

Is this for running tests? There are certainly some tests that check that static linking with musl works

@davidlattimore
Copy link
Owner

Do you want to try this out on your fork to see if it works as expected? You might need to temporarily enable actions on your fork, since I think they're disabled by default.

@andrewdavidmackenzie
Copy link
Contributor Author

andrewdavidmackenzie commented Dec 1, 2024 via email

@andrewdavidmackenzie
Copy link
Contributor Author

cargo build --target x86_64-unknown-linux-musl

fails on my local machine with the same error.

error occurred: Failed to find tool. Is musl-g++ installed?

I guess you installed it manually, but I'm confused why I don't see it in ci.yml

@andrewdavidmackenzie
Copy link
Contributor Author

I see symbolic-demangle is referenced in cackle.yml

@andrewdavidmackenzie
Copy link
Contributor Author

Without understanding all this, it seems that ci.yml installs bubblewrap

      - run: sudo apt install bubblewrap lld

which is referenced from cackle.yml as the sandbox...

@andrewdavidmackenzie
Copy link
Contributor Author

andrewdavidmackenzie commented Dec 1, 2024

symbolic-demangle doesn't support building for musl. I asked them about that:

getsentry/symbolic#880

I see this issue against them:
rust-lang/cc-rs#105

@andrewdavidmackenzie
Copy link
Contributor Author

A bit of a rat-hole...

We could dodge the whole issue and reduce the binaries we would build as part of a release...

@davidlattimore
Copy link
Owner

It looks like symbolic_demangle is only currently used by linker-diff. So if we're doing release builds of just the linker itself, then we shouldn't need it. Which I guess raises the question of which binaries we should include in the releases? My inclination is that we should probably just have the main wild binary - or if we do distribute linker-diff, that it should probably be a separate download. It's useful for diagnostics, but shouldn't be necessary for most users.

It's also fine to to not distribute musl binaries at this stage if that makes things easier.

@davidlattimore
Copy link
Owner

Another possible reason to not distribute a musl-based build is that it people might use it not realising that it doesn't give optimal performance. I just benchmarked wild built with musl against wild built with glibc and the musl version was 30% slower. I think this is probably a mix of a slower allocator and slower memcpy, memcmp etc. I then tried a musl build with a faster custom allocator (mimalloc) and it was then only 10% slower than glibc. This is in contrast to using mimalloc with glibc, where it seems to make no difference to performance. i.e. for the way wild uses the allocator, the default glibc allocator is fine performance wise, but not the musl allocator.

There's precedent for using a different allocator just for musl builds. I think I saw that ripgrep does that.

@andrewdavidmackenzie
Copy link
Contributor Author

Dropping musl is simple and would avoid this problem, even if releasing all binaries.

Releasing only linker (gnu and musl) would also avoid it.

Apart from for musl based systems like alpine, what other reason to release musl binary?

@davidlattimore
Copy link
Owner

Apart from for musl based systems like alpine, what other reason to release musl binary?

One common reason for building a musl-based binary is to have a statically linked binary, which can then work on pretty much any Linux system regardless of libc version. However this isn't really an advantage of musl so much as an advantage of static linking. It's possible to statically link with glibc and to dynamically link with musl.

@andrewdavidmackenzie
Copy link
Contributor Author

I tried reducing build to just wild, but it has a dev-dependency on linker-diff, and I think that's triggering the linker-diff build on musl, which fails.

So then I removed musl also.

If we want to re-add musl, even if just for wild, we'll need to resolve the build on linker diff, or find a way to avoid it in release builds of the wild binary (tests aren't run, so strictly speaking it's not needed but AFAIK, cargo doesn't distinguish between build dependencies and test dependencies in the dev-dependencies list...)

@andrewdavidmackenzie
Copy link
Contributor Author

andrewdavidmackenzie commented Dec 2, 2024

Successfull release build in GH Action in my repo: https://github.com/andrewdavidmackenzie/wild/actions/runs/12117386105

Here is the release it created: https://github.com/andrewdavidmackenzie/wild/releases

That can be manually edited by someone, and GH offers a "Generate release notes" button that will put in all the commits since the last release - and then you can edit that if you wish to clean it up.

Once you have a look and we merge this, I might delete that release to avoid confusion.

@andrewdavidmackenzie andrewdavidmackenzie changed the title WIP: Prepare releases, including pre-built binaries Prepare releases, including pre-built binaries Dec 2, 2024
@andrewdavidmackenzie andrewdavidmackenzie marked this pull request as ready for review December 2, 2024 10:59
@davidlattimore
Copy link
Owner

Looks good to me, although there's merge conflicts

@andrewdavidmackenzie
Copy link
Contributor Author

Fixed

@davidlattimore davidlattimore merged commit 278a7a2 into davidlattimore:main Dec 2, 2024
9 checks passed
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.

Set up binary releases
2 participants