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

Add apple arm binary #2324

Merged
merged 1 commit into from
Oct 21, 2023
Merged
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: 5 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,14 @@ stages:
imageName: 'windows-2019'
rustup_toolchain: stable
target: 'x86_64-pc-windows-msvc'
mac-stable:
mac-stable-intel:
imageName: 'macos-11'
rustup_toolchain: stable
target: 'x86_64-apple-darwin'
mac-stable-arm:
imageName: 'macos-11'
rustup_toolchain: stable
target: 'aarch64-apple-darwin'
Copy link
Collaborator

Choose a reason for hiding this comment

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

I can't find it in the docs, can you point to where it's shown to be available?

Copy link
Contributor Author

@technimad technimad Oct 18, 2023

Choose a reason for hiding this comment

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

It’s a tier2 supported platform. https://doc.rust-lang.org/nightly/rustc/platform-support.html#tier-2-with-host-tools

It will cross-compile when run on a x64 host.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I meant, where is it available in azure pipelines. I don't see ARM in in https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#software

Would cross-compilation work out of the box? I don't have an Intel mac to test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I’m pretty sure it will work out of the box. Can test this weekend.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, cross-compilation works out of the box.
Below I use the same commands as used in the azure pipelines.
This is run on an intel Mac and produces an arm executable.
The Zola sources are in /Volumes/Data3/zola

(The rust tool chain is really great!)

zola@mac-mini ~ % uname -a
Darwin mac-mini 21.6.0 Darwin Kernel Version 21.6.0: Fri Sep 15 16:17:23 PDT 2023; root:xnu-8020.240.18.703.5~1/RELEASE_X86_64 x86_64
zola@mac-mini ~ % curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable
info: downloading installer
... download info omitted ...
info: default toolchain set to 'stable-x86_64-apple-darwin'

  stable-x86_64-apple-darwin installed - rustc 1.73.0 (cc66ad468 2023-10-03)


Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).

To configure your current shell, run:
source "$HOME/.cargo/env"
zola@mac-mini ~ % source $HOME/.cargo/env 
zola@mac-mini ~ % rustup target add aarch64-apple-darwin
info: downloading component 'rust-std' for 'aarch64-apple-darwin'
info: installing component 'rust-std' for 'aarch64-apple-darwin'
 24.5 MiB /  24.5 MiB (100 %)  10.1 MiB/s in  2s ETA:  0s
zola@mac-mini ~ % cd /Volumes/Data3/zola 
zola@mac-mini zola % cargo build --release --target aarch64-apple-darwin
    Updating crates.io index
  Downloaded unicode-ident v1.0.8
... download and compilation lines omitted ...
    Finished release [optimized] target(s) in 14m 23s
zola@mac-mini zola % file target/aarch64-apple-darwin/release/zola
target/aarch64-apple-darwin/release/zola: Mach-O 64-bit executable arm64

Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought there would be some issues with reqwest and the tls features but i guess it's ok!

linux-stable:
imageName: 'ubuntu-20.04'
rustup_toolchain: stable
Expand Down