question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Buck doesn't fetch cxx_library from cache before linking go_binary

See original GitHub issue

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

@mkaczanowski

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
linzhpcommented, Jan 8, 2019

Yes, I can still reproduce it with latest Buck from master. I use buckd, and it restarts when I run buck clean

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found