zls icon indicating copy to clipboard operation
zls copied to clipboard

Release an arm64 / macOS apple silicon binary

Open leighmcculloch opened this issue 3 years ago • 10 comments

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?

leighmcculloch avatar Mar 02 '22 16:03 leighmcculloch

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

jiacai2050 avatar Jul 17 '22 05:07 jiacai2050

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.

leighmcculloch avatar Jul 17 '22 05:07 leighmcculloch

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


jiacai2050 avatar Jul 17 '22 07:07 jiacai2050

After some blame, it's this commit break zls...

    • https://github.com/ziglang/zig/commit/2b67f56c35d0a61be43f8ca23535096ae3ca4948#diff-f01c086c6578a4706cb6bf136d56fb04a344ed23735bbaf1c51976cfc384eac5

jiacai2050 avatar Jul 17 '22 08:07 jiacai2050

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 avatar Aug 05 '22 10:08 nahuakang

@nahuakang do you have rosetta installed? you should be able to run x86 releases

haze avatar Aug 05 '22 10:08 haze

@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.

nahuakang avatar Aug 05 '22 11:08 nahuakang

  • 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?

jiacai2050 avatar Aug 05 '22 11:08 jiacai2050

@nahuakang your question is off-topic, maybe open a new issue is appropriate.

jiacai2050 avatar Aug 05 '22 12:08 jiacai2050

@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.

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-macos to 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

haze avatar Aug 05 '22 12:08 haze

This would be great, because x86_64 version crashes on Apple M1.

mitghi avatar Sep 03 '22 14:09 mitghi

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!

SuperAuguste avatar Sep 03 '22 19:09 SuperAuguste