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

fbthrift: update to 2022.08.08.00, fix build with gcc and on older OS #15736

Merged
merged 1 commit into from Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 22 additions & 16 deletions devel/fbthrift/Portfile
Expand Up @@ -8,11 +8,11 @@ PortGroup openssl 1.0
PortGroup legacysupport 1.1
PortGroup compiler_blacklist_versions 1.0

github.setup facebook fbthrift 2022.06.06.00 v
revision 2
checksums rmd160 e6dffb2a31570580d68f8d20ea6bf66d7ef2c5a7 \
sha256 add554f5f4139f5fe16502a279f3b1233e3f30e56efa387728d59a10dcf6a053 \
size 8057825
github.setup facebook fbthrift 2022.08.08.00 v
revision 0
checksums rmd160 96f437cae0bfe52c4be7df6b04d09076906021c9 \
sha256 6b5165b4f5115f3537b9b5843f2dec21cd4836e6d69d8562dcdfae13ca8ff322 \
size 8500146

categories devel
license Apache-2
Expand All @@ -24,16 +24,6 @@ long_description {*}${description}

github.tarball_from archive

platform darwin {
if {${os.major} < 16} {
known_fail yes
pre-fetch {
ui_error "${subport} requires macOS 10.12 or later"
return -code error "incompatible macOS version"
}
}
}

set port_libfmt libfmt9
cmake.module_path-append \
${prefix}/lib/${port_libfmt}/cmake
Expand All @@ -46,6 +36,8 @@ depends_lib-append port:mstch \
port:fizz \
port:${port_libfmt}

patchfiles patch-cpp2.diff

# Fix error: invalid output constraint '=@ccc' in asm
compiler.blacklist-append \
{clang < 1200}
Expand All @@ -55,4 +47,18 @@ compiler.cxx_standard 2017
cmake.generator Ninja

legacysupport.newest_darwin_requires_legacy 19
legacysupport.use_mp_libcxx yes

if {[string match *clang* ${configure.compiler}]} {
# Don’t use libcxx with gcc.
legacysupport.use_mp_libcxx yes
}

platform darwin {
# https://kumasento.github.io/2020-06-12-glog-gflags-and-c-abi/
if {${os.major} < 16} {
configure.cxxflags-append -D_GLIBCXX_USE_CXX11_ABI=0
}
if {[string match *gcc* ${configure.compiler}]} {
configure.ldflags-append -latomic
}
}
45 changes: 45 additions & 0 deletions devel/fbthrift/files/patch-cpp2.diff
@@ -0,0 +1,45 @@
--- thrift/lib/cpp2/server/Cpp2ConnContext.cpp.orig 2022-08-08 09:08:18.000000000 +0700
+++ thrift/lib/cpp2/server/Cpp2ConnContext.cpp 2022-08-15 12:40:56.000000000 +0700
@@ -22,6 +22,14 @@
#include <sys/ucred.h> // @manual
#endif

+#if !defined(SOL_LOCAL) && defined(__APPLE__)
+#define SOL_LOCAL 0
+#endif
+
+#if !defined(LOCAL_PEEREPID) && defined(__APPLE__)
+#define LOCAL_PEEREPID 0x003 // retrieve eff. peer pid
+#endif
+
namespace {

#ifndef _WIN32


# ParallelConcurrencyController.h:65:40: error: static assertion failed
# static_assert(std::atomic<Counters>::is_always_lock_free);
--- thrift/lib/cpp2/server/ParallelConcurrencyController.h.orig 2022-08-08 09:08:18.000000000 +0700
+++ thrift/lib/cpp2/server/ParallelConcurrencyController.h 2022-08-15 21:39:26.000000000 +0700
@@ -55,12 +55,21 @@
private:
struct Counters {
constexpr Counters() noexcept = default;
+#if defined(__ppc__)
+ // Number of requests that are being executed
+ // by the executor
+ uint16_t requestInExecution{0};
+ // Number of requests that sit in the queue waiting
+ // to be dequeued by the ConcurrencyController
+ uint16_t pendingDequeCalls{0};
+#else // Everything else besides ppc32
// Number of requests that are being executed
// by the executor
uint32_t requestInExecution{0};
// Number of requests that sit in the queue waiting
// to be dequeued by the ConcurrencyController
uint32_t pendingDequeCalls{0};
+#endif
};
static_assert(std::atomic<Counters>::is_always_lock_free);