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

cxx zig toolchain doesn't work on macOS #461

Closed
jazzdan opened this issue Oct 26, 2023 · 1 comment
Closed

cxx zig toolchain doesn't work on macOS #461

jazzdan opened this issue Oct 26, 2023 · 1 comment

Comments

@jazzdan
Copy link
Contributor

jazzdan commented Oct 26, 2023

I understand that the zig toolchain is experimental but I figured I'd report this here for others.

The zig toolchain calls ln with flags that don't exist on macOS. Building a hello world C file results in this error:

$ buck2 build //:hello
Action failed: toolchains//:zig (cp_compiler)
Local command returned non-zero exit code 1
Reproduce locally: `env -- "BUCK_SCRATCH_PATH=buck-out/v2/tmp/toolchains/213ed1b7ab869379/__zig__/cp_compiler" ln -srf b ...<omitted>... e__/zig-archive/zig-macos-aarch64-0.9.1//zig buck-out/v2/gen/toolchains/213ed1b7ab869379/__zig__/zig (run `buck2 log what-failed` to get the full command)`
stdout:
stderr:
ln: illegal option -- r
usage: ln [-s [-F] | -L | -P] [-f | -i] [-hnv] source_file [target_file]
       ln [-s [-F] | -L | -P] [-f | -i] [-hnv] source_file ... target_dir
       link source_file target_file
Build ID: c02e1d44-46bf-4c97-b33c-17e8b7e65c7f
Network: Up: 0B  Down: 37MiB
Jobs completed: 20. Time elapsed: 6.3s.
Cache hits: 0%. Commands: 2 (cached: 0, remote: 0, local: 2)
BUILD FAILED
Failed to build 'toolchains//:zig (prelude//platforms:default#213ed1b7ab869379)'
$ sw_vers
ProductName:		macOS
ProductVersion:		13.6
BuildVersion:		22G120

Repro steps

  1. git clone git@github.com:jazzdan/buck2_zig_toolchain_macos_bug.git
  2. cd buck2_zig_toolchain_macos_bug
  3. buck2 build //:hello
@jazzdan
Copy link
Contributor Author

jazzdan commented Oct 26, 2023

@aherrmann you inspired me to try this toolchain after our talk in Reykjavik. :)

facebook-github-bot pushed a commit that referenced this issue Oct 27, 2023
Summary:
Closes #461

Updates the Zig toolchain example to take recent Buck2 changes into account.
Wrap the Zig C/C++ compiler commands in scripts to avoid quoting errors.
Avoid `ln -r`, BSD `ln` does not support `-r`.
Test the Zig example on CI.

Pull Request resolved: #462

Reviewed By: stepancheg

Differential Revision: D50738512

Pulled By: ndmitchell

fbshipit-source-id: dee31a30d258669f77460ebf1a8c7f5ecd9584a7
facebook-github-bot pushed a commit to facebook/ocamlrep that referenced this issue Oct 27, 2023
Summary:
Closes facebook/buck2#461

Updates the Zig toolchain example to take recent Buck2 changes into account.
Wrap the Zig C/C++ compiler commands in scripts to avoid quoting errors.
Avoid `ln -r`, BSD `ln` does not support `-r`.
Test the Zig example on CI.

X-link: facebook/buck2#462

Reviewed By: stepancheg

Differential Revision: D50738512

Pulled By: ndmitchell

fbshipit-source-id: dee31a30d258669f77460ebf1a8c7f5ecd9584a7
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 a pull request may close this issue.

1 participant