facebook / facebook/buck2

apple silicon (m1/m2) macOS default build of hello world fails.

Open
#147 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
4.4k
Forks
394
PR merge metrics
No merged PRs in 30d

Description

I'm just started to play with Buck2 on mac os.
I have clang installed for Xcode but I did not install `llvm` `lld` with eg `brew install llvm` and did not set it up in zsh.
```
export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"
export CPPFLAGS="-I/opt/homebrew/opt/llvm/include"
export PATH=/opt/homebrew/opt/llvm/bin:$PATH
```

if I run with the setup above:

building hello world example fails like this
```
-> % buck2 build //:main [master|●2…9]
File changed: root//.git/modules/prelude/index.lock
File changed: root//.git/index.lock
Action failed: root//:main (cxx_link_executable)
Local command returned non-zero exit code 1
Reproduce locally: `clang++ "-fuse-ld=lld" -o buck-out/v2/gen/root/213ed1b7ab869379/__main__/main @buck-out/v2/gen/root/213ed1b7ab869379/__main__/main.linker.argsfile`
stdout:
stderr:
clang: error: invalid linker name in argument '-fuse-ld=lld'
Build ID: 8491bb68-24f5-4d81-9696-3f1574e4ca0f
Jobs completed: 3. Time elapsed: 0.1s. Cache hits: 0%. Commands: 1 (cached: 0, remote: 0, local: 1)
```

After installing llvm and setting up the linker and path.
And more importantly, restarting buck2 with `buck2 kill` (took some time to figure out that changes in environment taking effect only after restart of the buck daemon)
it started to work like this:
```
-> % buck2 build //:main [master|●2…8]
Build ID: 49f3cd84-87cd-404e-80ff-7df9536143c8
Jobs completed: 53. Time elapsed: 2.4s. Cache hits: 0%. Commands: 5 (cached: 0, remote: 0, local: 5)
BUILD SUCCEEDED
```

I have in general 2 questions:

1. If the default toolchain is doing some kind of auto-discovery Why there is no check that the default settings are working (eg CMAKE's compiler diagnostic)?

2. to achieve hermetic builds I was expecting that bulk2 would install in a sandbox a toolchain which is matching with my default platform. Are there examples of how to create hermetic builds with sandboxes where the compiler toolchain is populated during the build?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.