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

Building with Buck2 #2247

Open
rj-jesus opened this issue Jun 27, 2024 · 5 comments
Open

Building with Buck2 #2247

rj-jesus opened this issue Jun 27, 2024 · 5 comments

Comments

@rj-jesus
Copy link

As per the title, is it possible to build Folly with Buck2?

There are lots of BUCK files in the repository, and they seem up-to-date, so I would assume it's possible to do so. However, whenever I try I stumble upon errors such as:

$ buck2 targets //...
File changed: root//.git/index.lock
Error parsing root//folly/settings/test
Error evaluating build file: `root//folly/settings/test:BUCK`

Caused by:
    error: Variable `cpp_library` not found, did you mean `cxx_library`?
      --> folly/settings/test/BUCK:32:1
       |
    32 | cpp_library(
       | ^^^^^^^^^^^
       |
    
Failed to parse 1 package

I'm especially interested in this as a big portion of the benchmarks seem to be enabled only through Buck2 (please correct me if I'm wrong!).

Any help is greatly appreciated!

@Orvid
Copy link
Contributor

Orvid commented Jun 27, 2024

While the BUCK files are present, they are not yet usable in open source, though I believe @namanahuja has been working on that.

@Orvid
Copy link
Contributor

Orvid commented Jun 27, 2024

For the benchmarks, if there's one in particular you want to build via cmake, it should be possible to just add it to the existing CMakeLists.txt with a line similar to this: https://github.com/facebook/folly/blob/main/CMakeLists.txt#L660

The BUCK files are what we use to build Folly internally, so are the source of truth. That does mean that occasionally things don't get added to the CMakeLists.txt file when their added :(

@Orvid
Copy link
Contributor

Orvid commented Jul 1, 2024

#2241 should fix the specific issue you posted here, but the OSS buck build tests are still listed as skipped, so I don't know if there are other issues you'll run into.

@rj-jesus
Copy link
Author

rj-jesus commented Jul 2, 2024

Hi @Orvid, thanks very much for your comments and the fix---it does work!

$ buck2 targets //... | grep benchmark
File changed: root//.git/index.lock
File changed: root//CLANG/include/cairo/cairo.h
File changed: root//CLANG/include/cairo/cairo-xlib.h
437 additional file change events
Build ID: af83b036-f888-402b-b809-5c33240b4dda
Jobs completed: 2. Time elapsed: 0.0s.
root//folly:benchmark
root//folly:benchmark_util
root//folly/compression/test:quotient_multiset_benchmark
root//folly/concurrency/test:cache_locality_benchmark
root//folly/debugging/exception_tracer/test:exception_tracer_benchmark_main
root//folly/experimental/io/test:io_benchmark
...

However, I only seem to be able to list benchmarks defined with cpp_binary such as those above. Those defined with cpp_benchmark don't seem to get listed (e.g. memset_benchmark and several others). Do you know why this might be?

@Orvid
Copy link
Contributor

Orvid commented Jul 2, 2024

My blind guess (I've not looked into the details at all) would be that cpp_benchmark is probably not yet implemented for open source builds and is instead stubbed out to do nothing so work can continue on the rest of it.

Edit:
Yep, looks like cpp_benchmark is currently stubbed out: https://github.com/facebook/folly/blob/main/shim/build_defs/cpp_benchmark.bzl#L8

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