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

fix #17: Provide arm64 Darwin build #18

Closed
wants to merge 3 commits into from
Closed

Conversation

kumy
Copy link
Contributor

@kumy kumy commented Oct 29, 2022

@dimo414
Copy link
Owner

dimo414 commented Oct 29, 2022

Looks like that isn't quite right :( https://github.com/dimo414/bkt/actions/runs/3350623559/jobs/5554317449

If you're not able to work it out I'll take a look later this week.

@kumy
Copy link
Contributor Author

kumy commented Oct 29, 2022

I'll give a second look, and let you know

@kumy
Copy link
Contributor Author

kumy commented Oct 30, 2022

https://github.com/kumy/bkt/actions/runs/3356073982/jobs/5560864461

I'm a bit afraid of the errors I get now. I pass my turn on it. Please @dimo414 If you wish to check 🙏

@dimo414
Copy link
Owner

dimo414 commented Nov 2, 2022

@zbentley I think you mentioned you're on an arm64 Mac now, do you happen to have any insight? I looked at a couple Rust projects like ripgrep and bat but they don't seem to have cut releases for this architecture yet. I haven't dug much deeper than looking for existing builds to copy yet, so it might be something trivial.

@dimo414
Copy link
Owner

dimo414 commented Nov 4, 2022

Judging from this error:

cross build --release --target=aarch64-apple-darwin
[cross] warning: `cross` does not provide a Docker image for target aarch64-apple-darwin, specify a custom image in `Cross.toml`.
[cross] note: Falling back to `cargo` on the host.
   Compiling proc-macro2 v1.0.36
   Compiling unicode-xid v0.2.2
   Compiling version_check v0.9.4
   Compiling syn v1.0.86
   Compiling libc v0.2.119
   Compiling cfg-if v1.0.0
error[E0463]: can't find crate for `core`
Error:   |
  = note: the `aarch64-apple-darwin` target may not be installed
  = help: consider downloading the target with `rustup target add aarch64-apple-darwin`

and the discussion in cross-rs/cross#558 it's possible Cross doesn't yet support aarch64?

@dimo414
Copy link
Owner

dimo414 commented Nov 4, 2022

Here's another discussion: sharkdp/fd#1088

@zbentley
Copy link

zbentley commented Nov 5, 2022

I'm not sure off the top of my head what the issue may be, but some ideas:

  • aarch64 is usually the Linux term for the architecture. MacOS refers to it as arm64 in many cases, including in the output of arch(1).
  • Ripgrep definitely does provide built artifacts for M1 macs, which means either that project or Homebrew's packaging thereof must have this solved:
∴ file $(which rg)
/opt/homebrew/bin/rg: Mach-O 64-bit executable arm64
  • cross-the-tool is a fairly "thick" way to achieve cross compilation of Rust for multiple platforms, and you may well be correct that this architecture isn't yet supported. MacOS is quite a pain to build for when not on a mac, and trying to truly cross compile for it rather than relying on GH actions' native MacOS runtime sounds like a recipe for trouble (that's not an indictment of cross, just an observation that it may not be the best tool for the job here). Some quick googling turns up some other, more native methods at getting this working, which you could try out, though they'd require a more significant reworking of the build system than the one proposed here. Example 1, example 2.

@dimo414
Copy link
Owner

dimo414 commented Nov 5, 2022

Pretty sure Homebrew typically does local compilations (so presumably bkt can also be installed locally via Homebrew, if either of you want to try it). Thanks for the pointers!

@dimo414
Copy link
Owner

dimo414 commented Nov 6, 2022

Thanks for taking a swing at this, I'm going to close this for the time being.

@dimo414 dimo414 closed this Nov 6, 2022
@dimo414 dimo414 mentioned this pull request Nov 6, 2022
@zbentley
Copy link

zbentley commented Nov 6, 2022

Pretty sure Homebrew typically does local compilations

This is not the case. Homebrew defaults to their CDN which ships prepackaged artifacts (compiled binaries in the case of Rust software) appropriate for the target architecture. This process is known as bottling.

As a result, brew install bkt doesn't compile anything, nor does it require the installation of the Rust toolchain at all:

 ∴ brew install bkt
==> Downloading https://ghcr.io/v2/homebrew/core/bkt/manifests/0.5.4
Already downloaded: /Users/zac.bentley/Library/Caches/Homebrew/downloads/47ab08d4e4393fdd5a851ac540c349eedff8ceb64637f3fa6e88860cd3e6b20d--bkt-0.5.4.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/bkt/blobs/sha256:c87900965e5e508b6396358f50efdc787cdff1a2acc25675015ff2455f880be8
Already downloaded: /Users/zac.bentley/Library/Caches/Homebrew/downloads/772ddeac6c78e7aa6794c1c7fe167a94c1c188e0a37954752067f8978e8ab255--bkt--0.5.4.arm64_monterey.bottle.tar.gz
==> Pouring bkt--0.5.4.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/bkt/0.5.4: 7 files, 1MB

Seems fine to close either way!

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.

3 participants