Release an arm64 / macOS apple silicon binary
The most recent release of zls (https://github.com/zigtools/zls/releases/tag/0.9.0) includes only x86 binaries. It'd be helpful for developers on the current generation of Apple computers to be able to use zls.
Could builds for arm64 macOS be included in the next release?
It seems GitHub action only provide x86 machines, I wonder if cross compile could work here
- https://github.community/t/does-github-actions-cloud-allow-running-of-arm-based-instances/119319
I have had success cross-compiling for arm64 macOS with Rust and Go, so I assume it might be possible with Zig, but I haven't tried yet.
Sad, Zig(47c58cba5) cann't compile zls(latest ba68a4d)
(master)$ ~/downloads/zig-macos-aarch64-0.10.0-dev.3024+47c58cba5/zig build -Drelease-safe
/Downloads/zig-macos-aarch64-0.10.0-dev.3024+47c58cba5/lib/zig/std/fs.zig:960:25: error: only 'IterableDir' can be iterated; 'IterableDir' can be obtained with 'openIterableDir'
pub const iterate = @compileError("only 'IterableDir' can be iterated; 'IterableDir' can be obtained with 'openIterableDir'");
^
error: zls...
error: The following command exited with error code 1:
/Downloads/zig-macos-aarch64-0.10.0-dev.3024+47c58cba5/zig build-exe /code/misc/zls/src/main.zig -OReleaseSafe --cache-dir /code/misc/zls/zig-cache --global-cache-dir /.cache/zig --name zls --pkg-begin build_options /code/misc/zls/zig-cache/options/ZN5T5qs__MtT8K02r_1S-BHCIQm36qquqqxMkxJvDpZqrwQ-wS_m2895sSwEs1B_ --pkg-end --pkg-begin known-folders /code/misc/zls/src/known-folders/known-folders.zig --pkg-end --enable-cache
error: the following build command failed with exit code 1:
/code/misc/zls/zig-cache/o/f7ef6c24324123d6a9875be3d5afb20b/build /Downloads/zig-macos-aarch64-0.10.0-dev.3024+47c58cba5/zig /code/misc/zls /code/misc/zls/zig-cache /.cache/zig -Drelease-safe
After some blame, it's this commit break zls...
-
- https://github.com/ziglang/zig/commit/2b67f56c35d0a61be43f8ca23535096ae3ca4948#diff-f01c086c6578a4706cb6bf136d56fb04a344ed23735bbaf1c51976cfc384eac5
I'm also on Macbook with M1 chip and zls fails when I try to use the x86 release with VS Code. Is there any workaround or do we have to wait til the next release? Thanks. :)
@nahuakang do you have rosetta installed? you should be able to run x86 releases
@haze Thanks for the suggestion but I'm still getting (zls is installed at ~/zls):
Attempting to use zls @ $HOME/zls
[Error - 1:36:06 PM] Zig Language Server client: couldn't create connection to server.
Launching server using command $HOME/zls failed. Error: spawn $HOME/zls ENOENT
Incidentally: My helix editor uses the zls now and it works fine there, but VS Code doesn't seem to work.
- https://github.com/zigtools/zls/blob/6ed5ba833b51cf1a2b80e3dbb01cc73795dd4776/.github/workflows/main.yml#L36
I think we can just add aarch64-macos to this line.
@haze Any thoughts?
@nahuakang your question is off-topic, maybe open a new issue is appropriate.
@haze Thanks for the suggestion but I'm still getting (
zlsis installed at~/zls):Attempting to use zls @ $HOME/zls [Error - 1:36:06 PM] Zig Language Server client: couldn't create connection to server. Launching server using command $HOME/zls failed. Error: spawn $HOME/zls ENOENTIncidentally: My
helixeditor uses thezlsnow and it works fine there, but VS Code doesn't seem to work.
maybe VSCODE isn’t expanding that environment variable?
- https://github.com/zigtools/zls/blob/6ed5ba833b51cf1a2b80e3dbb01cc73795dd4776/.github/workflows/main.yml#L36
I think we can just add
aarch64-macosto this line.@haze Any thoughts?
i think this can work, i don’t remember if linux can produce macos aarch64 binaries and in the worst case you can always compile them from the intel runner; it’s up to @SuperAuguste to do it tho
This would be great, because x86_64 version crashes on Apple M1.
I'll do this now, sorry for the delay y'all! In the future, feel free to PR things like this - no change is too small!