Buck doesn't fetch cxx_library from cache before linking go_binary
See original GitHub issueWhen Buck’s cache is configured to a directory outside buck-out, buck clean
will not clean the cache (assuming this is by design), but buck-out/gen and buck-out/bin are cleaned. So during next buck build
, Buck will fetch artifacts from cache and populate buck-out/gen and buck-out/bin whenever possible. This works in most cases except when there is a cxx_library to be linked with a go_binrary. Steps to reproduce the problem
git clone git@github.com:linzhp/buck_go_examples.git
cd buck_go_examples
buck build sqliteTest:version
buck clean
echo " " >> sqliteTest/main.go
buck build sqliteTest:version
Then there will be an error from the linker:
/usr/local/Cellar/go/1.11.2/libexec/pkg/tool/darwin_amd64/link: running /usr/bin/clang++ failed: exit status 1
ld: file not found: buck-out/gen/vendor/github.com/mattn/go-sqlite3/cxx_lib#default,static-pic/libcxx_lib.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Building: finished in 1.2 sec (100%) 7/7 jobs, 7 updated
Total time: 1.8 sec
Command failed with exit code 2.
stderr: /usr/local/Cellar/go/1.11.2/libexec/pkg/tool/darwin_amd64/link: running /usr/bin/clang++ failed: exit status 1
ld: file not found: buck-out/gen/vendor/github.com/mattn/go-sqlite3/cxx_lib#default,static-pic/libcxx_lib.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)
When running <go link>.
When building rule //sqliteTest:version.
The issue is, during the second build, Buck fetched all go_library dependencies from the cache during the compilation, but it didn’t fetch from the cache during the linking.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Buck: .buckconfig
Before executing, Buck reads this file to incorporate any customizations it ... However, static C/C++ link jobs can take up lots of cache...
Read more >buck/buckconfig.soy at main · facebook/buck - GitHub
Before executing, Buck reads this file to incorporate any customizations ... this config option provides a way to disable caching of all C/C++...
Read more >For those of us unfamiliar with the term "reproducible", yet in ...
This allows users to verify that the binary packages you see were actually gotten by compiling the source code (presuming your compiler isn't...
Read more >How to Create a Buck-based C/C++ Project - Buckaroo
... a Buck-based C/C++ Project. Buck is a fast build tool developed by Facebook. ... Before we start, it might be helpful to...
Read more >Caching general build artifacts between stages - GitLab.org
But you can do another push to the same branch and have stage A started on runner Y, but the next stages will...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
fixed in revision: https://github.com/facebook/buck/commit/afecad16e8d2ef5ed058794adca7c626e2561fa2
Yes, I can still reproduce it with latest Buck from master. I use buckd, and it restarts when I run
buck clean