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

Build static binary on linux #1862

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ stages:
rustup_toolchain: stable
target: 'x86_64-apple-darwin'
linux-stable:
imageName: 'ubuntu-20.04'
imageName: 'rust:alpine'
rustup_toolchain: stable
target: 'x86_64-unknown-linux-gnu'
target: 'x86_64-unknown-linux-musl'
Copy link
Collaborator

Choose a reason for hiding this comment

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

that would break all the package managers, if you want to add musl, it needs to be another target, not replace the existing one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why would it? All the distros compile it themselves, IMO the only use case for a pre-compiled binary is downloading it to some arbitrary system, which we can't make any assumptions about. So it seems to me that for Linux we should ship only static binaries.

Copy link
Collaborator

Choose a reason for hiding this comment

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

All the distros compile it themselves, IMO the only use case for a pre-compiled binary is downloading it to some arbitrary system, which we can't make any assumptions about

I would rather have both options than only one

So it seems to me that for Linux we should ship only static binaries.

Last time I checked musl, performance was significantly worse. It might have been fixed since then but my results were kinda similar to https://andygrove.io/2020/05/why-musl-extremely-slow/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing this out, I didn't know. I'll close this PR then.

pool:
vmImage: $(imageName)
steps:
- script: |
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
displayName: Install rust
condition: ne( variables['Agent.OS'], 'Windows_NT' )
condition: eq( variables['Agent.OS'], 'Darwin' )
Copy link
Collaborator

Choose a reason for hiding this comment

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

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For Linux the official rust:alpine image is used, which has all the needed stuff installed. So the only target that needs explicit toolchain installation is Darwin

- script: |
set CARGO_HOME=%USERPROFILE%\.cargo
curl -sSf -o rustup-init.exe https://win.rustup.rs
Expand Down