shellcheck
shellcheck copied to clipboard
Fails on apple M2 chip
For bugs
- My shellcheck version (
shellcheck --version
or "online"): 0.9.0 - [x] The rule's wiki page does not already cover this (e.g. https://shellcheck.net/wiki/SC2086)
Here's a snippet or screenshot that shows the problem:
Running any shellcheck with any script on my M2 device yields currently yields the following error.
Here's what shellcheck currently says:
[Errno 86] Bad CPU type in executable
Note, that I run shellcheck via its pre-commit hook that "simply wraps the shellcheck binary"
Of course it fails if you try to run an x86_64 binary on ARM (aarch64). Built it yourself.
I've installed shellcheck
via brew
to check that it works:
$ brew install shellcheck
==> Fetching shellcheck
==> Downloading https://ghcr.io/v2/homebrew/core/shellcheck/manifests/0.9.0
[...]
==> Pouring shellcheck--0.9.0.arm64_ventura.bottle.tar.gz
🍺 /opt/homebrew/Cellar/shellcheck/0.9.0: 7 files, 65.8MB
==> Running `brew cleanup shellcheck`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
$ shellcheck --version
ShellCheck - shell script analysis tool
version: 0.9.0
license: GNU General Public License, version 3
website: https://www.shellcheck.net
$ sysctl -n machdep.cpu.brand_string
Apple M2
No need to actually compile anything.
Confirmed: When installed with brew, shellcheck works on my device. Question is, how do I get the pre-commit hook to work
Okay, as far as I can tell, the pre-commit hook uses one of the binaries provided as part of the releases, but currently, these only contain an x86 build for darwin, is that correct? Could it be an option to also build for arm and add that to the releases moving forward?
Okay, as far as I can tell, the pre-commit hook uses one of the binaries provided as part of the releases, but currently, these only contain an x86 build for darwin, is that correct? Could it be an option to also build for arm and add that to the releases moving forward?
This is the runner's configuration for this project: https://github.com/koalaman/shellcheck/actions/runs/3682710473/workflow. I'm not certain how easy it would be to add arm64, but it should technically be available from GitHub's CI pipeline. Although, it might only be for arm64/linux or some QEMU-based infrastructure (which might not be sufficient).
According to https://github.com/actions/runner-images, the rollout progress is not quite there yet.
One additional option would be for you to support the project with a self-hosted runner: https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners and https://www.pantsbuild.org/docs/ci-for-macos-on-arm64.
Or you could sponsor the integration of hosted ARM runners from BuildJet (https://buildjet.com/for-github-actions/blog/hosted-arm-runners-on-github-actions), which support a fast M1/M2 pipeline which does not cost too much. Maybe even on the orka platform (https://www.macstadium.com/orka).
I'm leaving the relevant github roadmap and tracking issue here as well: https://github.com/github/roadmap/issues/528 and https://github.com/rust-lang/rust/issues/73908
For the sake of completeness: Installing Rosetta explicitly also allows to use the released Intel macOS versions. Use sudo softwareupdate --install-rosetta
.