facebook / fb303

fb303 is a core set of thrift functions that provide a common mechanism for querying stats and other information from a service.
Apache License 2.0
75 stars 48 forks source link

building fails with folly #8

Open martynas-gryb opened 3 years ago

martynas-gryb commented 3 years ago

When compiling fb303 for latest openr build, build fails:

/usr/bin/ccache /usr/bin/c++  -DFMT_LOCALE -DGFLAGS_IS_A_DLL=0 -I/tmp/fbcode_builder_getdeps-ZhomeZtesterZfbopenrZbuildZfbcode_builder-root/repos/github.com-facebookincubator-fb303.git -I. -isystem /opt/facebook/gflags-pFtnO7FGNohWj2trXxCs1LJfTIHedZ2PK7-kG1OaSXE/include -isystem /opt/facebook/glog-R44LrGPBZ5Ekev3frpigEm9bl9nhgX5MwHVbIcKZDg0/include -isystem /opt/facebook/boost-7LpWNokbp7fffjv2w4hlkWWkwII6NJnUz1J5Mz-Bn6o/include -isystem /opt/facebook/double-conversion-NqKE7AnVid4b3W43A8WK4LjVfw0xFTLqUuHrTl0NFLo/include -isystem /opt/facebook/libevent-44TH0t7Nx1sKPHl68UnriEFhcTq0gOnPP1uj7eAK_Cs/include -isystem /opt/facebook/lz4-uHW3b2jq-6sYkhgHWIC5uOF5J-XvWPpVHKisDg3mybY/include -isystem /opt/facebook/zstd-R8qk54ynfKeMcTBOFbW_88TkyeP8_p31qHsrtS6PbjI/include -isystem /opt/facebook/snappy-RehFr1x9aaDGhVdf2Q0avturNagBDfDfo0XDikBq65U/include -isystem /opt/facebook/folly/include -isystem /opt/facebook/fmt-jbgZWgl9ZeHgzeb9I0aQv1Fl9vV25X4rqSmUr9iebPk/include -isystem /opt/facebook/fbthrift/include -isystem /opt/facebook/wangle/include -isystem /opt/facebook/fizz/include -isystem /opt/facebook/libsodium-dpxdMUeC3ZP7pYLJR5GciWzcq2i0SX9szlzDD0SU2zE/include -O2 -g -DNDEBUG -fPIC   -std=c++17 -MD -MT CMakeFiles/fb303.dir/fb303/detail/QuantileStatWrappers.cpp.o -MF CMakeFiles/fb303.dir/fb303/detail/QuantileStatWrappers.cpp.o.d -o CMakeFiles/fb303.dir/fb303/detail/QuantileStatWrappers.cpp.o -c /tmp/fbcode_builder_getdeps-ZhomeZtesterZfbopenrZbuildZfbcode_builder-root/repos/github.com-facebookincubator-fb303.git/fb303/detail/QuantileStatWrappers.cpp
In file included from /tmp/fbcode_builder_getdeps-ZhomeZtesterZfbopenrZbuildZfbcode_builder-root/repos/github.com-facebookincubator-fb303.git/fb303/detail/QuantileStatWrappers.h:109,
                 from /tmp/fbcode_builder_getdeps-ZhomeZtesterZfbopenrZbuildZfbcode_builder-root/repos/github.com-facebookincubator-fb303.git/fb303/detail/QuantileStatWrappers.cpp:18:
/tmp/fbcode_builder_getdeps-ZhomeZtesterZfbopenrZbuildZfbcode_builder-root/repos/github.com-facebookincubator-fb303.git/fb303/detail/QuantileStatWrappers-inl.h: In member function ‘void facebook::fb303::detail::DynamicQuantileStatWrapper<N>::addValue(double, std::chrono::_V2::steady_clock::time_point, Args&& ...)’:
/tmp/fbcode_builder_getdeps-ZhomeZtesterZfbopenrZbuildZfbcode_builder-root/repos/github.com-facebookincubator-fb303.git/fb303/detail/QuantileStatWrappers-inl.h:60:37: error: ‘make_hazard_pointer’ is not a member of ‘folly’
   folly::hazptr_holder<> h = folly::make_hazard_pointer<>();
                                     ^~~~~~~~~~~~~~~~~~~
/tmp/fbcode_builder_getdeps-ZhomeZtesterZfbopenrZbuildZfbcode_builder-root/repos/github.com-facebookincubator-fb303.git/fb303/detail/QuantileStatWrappers-inl.h:60:57: error: expected primary-expression before ‘>’ token
   folly::hazptr_holder<> h = folly::make_hazard_pointer<>();
                                                         ^

Usage was introduced, but function not declared in open sourced folly

commit 1f2d757b0a9511fe9cf7f8734c0d86e5451c3d52
Author: Maged Michael <magedmichael@fb.com>
Date:   Thu May 27 19:57:52 2021 -0700

    hazptr: Change hazard pointer construction to be consistent with WG21 P1121

    Summary:
    Change the constructors for hazptr_holder and add the function make_hazard_pointer to be consistent with [WG21 P1121](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1121r3.pdf).

diff --git a/fb303/detail/QuantileStatWrappers-inl.h b/fb303/detail/QuantileStatWrappers-inl.h
index 77314b22..bc16cb4e 100644
--- a/fb303/detail/QuantileStatWrappers-inl.h
+++ b/fb303/detail/QuantileStatWrappers-inl.h
@@ -57,7 +57,7 @@ void DynamicQuantileStatWrapper<N>::addValue(
     Args&&... subkeys) {
   const SubkeyArray subkeyArray{{std::forward<Args>(subkeys)...}};

-  folly::hazptr_holder<> h;
+  folly::hazptr_holder<> h = folly::make_hazard_pointer<>();
   auto mapPtr = h.protect(stats_);
Mizuchi commented 3 years ago

Thanks for reporting this. It's a known issue that we are actively investigating. It's mentioned in another project as well: https://github.com/facebook/openr/issues/100