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

Local build is broken on macOS #146

Open
mofeing opened this issue Oct 21, 2024 · 3 comments
Open

Local build is broken on macOS #146

mofeing opened this issue Oct 21, 2024 · 3 comments

Comments

@mofeing
Copy link
Collaborator

mofeing commented Oct 21, 2024

Referencing EnzymeAD/Reactant.jl#191

While trying to build #178 in macOS aarch64, I encountered the following error:

ERROR: /private/var/tmp/_bazel_mofeing/348146763cd9e75f8b24f7326c7da0a0/external/enzyme_ad/BUILD:58:10: Linking external/enzyme_ad/enzymexlamlir-tblgen [for tool] failed: (Exit 1): cc_wrapper.sh failed: error executing command (from target @enzyme_ad//:enzymexlamlir-tblgen) 
  (cd /private/var/tmp/_bazel_mofeing/348146763cd9e75f8b24f7326c7da0a0/sandbox/darwin-sandbox/610/execroot/__main__ && \
  exec env - \
    PATH='/Users/mofeing/Library/Caches/bazelisk/downloads/sha256/c6b6dc17efcdf13fba484c6fe0b6c3361b888ae7b9573bc25a2dbe8c502448eb/bin:/opt/homebrew/bin:/opt/homebrew/Cellar/pyenv-virtualenv/1.2.4/shims:/Users/mofeing/.pyenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/opt/llvm/bin:/Applications/SuperCollider.app/Contents/MacOS:/Users/mofeing/.cargo/bin:/opt/homebrew/Caskroom/supercollider/3.13.0/SuperCollider.app/Contents/Resources:/opt/homebrew/opt/molten-vk/bin:/Users/mofeing/.local/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Library/Apple/usr/bin:/Applications/Little Snitch.app/Contents/Components:/Applications/quarto/bin' \
    PWD=/proc/self/cwd \
  external/local_config_cc/cc_wrapper.sh @bazel-out/darwin_arm64-opt-exec-50AE0418/bin/external/enzyme_ad/enzymexlamlir-tblgen-2.params)
# Configuration: e0577b931c3d1306f5dfb647be2c29e19ef2a3f534787952d766fd2b735e74f6
# Execution platform: @local_execution_config_platform//:platform

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
clang: error: invalid linker name in argument '-fuse-ld=/opt/homebrew/opt/llvm/bin/ld64.lld'
Target //:libReactantExtra.so failed to build
INFO: Elapsed time: 135.791s, Critical Path: 20.59s
INFO: 2227 processes: 1622 internal, 605 darwin-sandbox.
FAILED: Build did NOT complete successfully

This bug was not introduced in #178 because there are no changes in the build system. Bisecting the repo, I've found out that this bug was introduced in 00b4d69

@wsmoses no flag was modified in that commit, but the Enzyme-JAX commit was updated from 4eeaef0 to 9f93d68, and the erroring target is external/enzyme_ad/enzymexlamlir-tblgen so most probably the bug origins there.

@mofeing
Copy link
Collaborator Author

mofeing commented Oct 27, 2024

@wsmoses it is failing because it seems that LLVM 19, installed through Homebrew, no longer provides the ld64.lld binary. What version does it appear if you do brew info llvm?

I've tried uninstalling it and using the llvm@17 recipe but it's not detecting it and it's still searching on /opt/homebrew/opt/llvm/bin. I can't find where that -fuse-ld flag is being set. Would you mind pointing it to me please?

@mofeing
Copy link
Collaborator Author

mofeing commented Oct 28, 2024

Homebrew now packages LLD (and ld64.lld) in another formula, so all you have to do is

brew install lld

and bazel should point to /opt/homebrew/opt/lld/bin/ld64.lld instead... but don't know how to change that @wsmoses

@wsmoses
Copy link
Member

wsmoses commented Oct 28, 2024

Oh that's unfortunate. Not sure but can try to investigate later.

In the meantime if you add the symlink yourself can you build so you're unblocked

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

No branches or pull requests

2 participants