diff --git a/pkgs/by-name/fo/folly/fix-__type_pack_element.patch b/pkgs/by-name/fo/folly/fix-__type_pack_element.patch new file mode 100644 index 000000000000..8a43c6805b2a --- /dev/null +++ b/pkgs/by-name/fo/folly/fix-__type_pack_element.patch @@ -0,0 +1,34 @@ +From acccee8947977178f36d117cd9d3240cbdb5f018 Mon Sep 17 00:00:00 2001 +From: ihb2032 <1355790728@qq.com> +Date: Wed, 10 Sep 2025 17:31:41 +0800 +Subject: [PATCH] fix(folly): Replace `__type_pack_element` in + `ForeachTest.cpp` to support GCC 14 + +The use of the `__type_pack_element` compiler builtin directly in function signatures in `folly/container/test/ForeachTest.cpp` causes a build failure with GCC 14. This is because the builtin is not intended for use in contexts that affect name mangling. + +This commit resolves the issue by replacing the direct usage of `__type_pack_element_t` with `std::tuple_element_t`. This is a standards-compliant library trait that provides the same functionality and is safe to use in function signatures. + +This change ensures that `ForeachTest` continues to compile successfully with newer versions of GCC, maintaining compiler compatibility. + +Signed-off-by: lyd1992 + +Signed-off-by: ihb2032 <1355790728@qq.com> +--- + folly/container/test/ForeachTest.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/folly/container/test/ForeachTest.cpp b/folly/container/test/ForeachTest.cpp +index c055f26effe..3adec1a7371 100644 +--- a/folly/container/test/ForeachTest.cpp ++++ b/folly/container/test/ForeachTest.cpp +@@ -314,8 +314,8 @@ TEST(ForEach, FetchTestPreferIterator) { + template + struct LargeTuple {}; + template +-type_pack_element_t& get(LargeTuple&) { +- static type_pack_element_t elem; ++std::tuple_element_t>& get(LargeTuple&) { ++ static std::tuple_element_t> elem; + return elem; + } + namespace std { diff --git a/pkgs/by-name/fo/folly/fix-stdexcept-include.patch b/pkgs/by-name/fo/folly/fix-stdexcept-include.patch new file mode 100644 index 000000000000..c13632abf599 --- /dev/null +++ b/pkgs/by-name/fo/folly/fix-stdexcept-include.patch @@ -0,0 +1,22 @@ +From dc06cc3162afb148c19cd0931d8fe489d639217a Mon Sep 17 00:00:00 2001 +From: Uilian Ries +Date: Tue, 9 Sep 2025 16:48:26 +0200 +Subject: [PATCH] Add missing header for std::runtime_error + +Signed-off-by: Uilian Ries +--- + folly/hash/Checksum.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/folly/hash/Checksum.cpp b/folly/hash/Checksum.cpp +index 1d42d6a6e5f..aeafdb20b1b 100644 +--- a/folly/hash/Checksum.cpp ++++ b/folly/hash/Checksum.cpp +@@ -17,6 +17,7 @@ + #include + + #include ++#include + + #include + diff --git a/pkgs/by-name/fo/folly/package.nix b/pkgs/by-name/fo/folly/package.nix index 4673ffff784f..48a04df5ce1f 100644 --- a/pkgs/by-name/fo/folly/package.nix +++ b/pkgs/by-name/fo/folly/package.nix @@ -21,10 +21,10 @@ zstd, libiberty, libunwind, + darwinMinVersionHook, boost, fmt, - jemalloc, ctestCheckHook, @@ -41,7 +41,7 @@ stdenv.mkDerivation (finalAttrs: { pname = "folly"; - version = "2025.04.21.00"; + version = "2025.09.15.00"; # split outputs to reduce downstream closure sizes outputs = [ @@ -53,7 +53,7 @@ stdenv.mkDerivation (finalAttrs: { owner = "facebook"; repo = "folly"; tag = "v${finalAttrs.version}"; - hash = "sha256-P2saSFVRBWt5xjAWlKmcPJT9MFV9CXFmA18dIDCO84o="; + hash = "sha256-//gx081nMFXAcUgkHQToiFHhECfLW22Fl0eXEsObxUs="; }; nativeBuildInputs = [ @@ -77,16 +77,15 @@ stdenv.mkDerivation (finalAttrs: { zstd libiberty libunwind + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + (darwinMinVersionHook "13.3") ]; propagatedBuildInputs = [ # `folly-config.cmake` pulls these in. boost fmt - ] - ++ lib.optionals stdenv.hostPlatform.isLinux [ - # jemalloc headers are required in include/folly/portability/Malloc.h - jemalloc ]; nativeCheckInputs = [ @@ -140,6 +139,30 @@ stdenv.mkDerivation (finalAttrs: { url = "https://aur.archlinux.org/cgit/aur.git/plain/fix-cmake-find-glog.patch?h=folly&id=4b68f47338d4b20111e3ffa1291433120bb899f0"; hash = "sha256-QGNpS5UNEm+0PW9+agwUVILzpK9t020KXDGyP03OAwE="; }) + + # Fix an upstream regression with libstdc++. + # + # See: + # + # * + # * + # * + # * + ./fix-stdexcept-include.patch + + # Fix a GCC‐incompatible use of a private trait. + # + # Per Folly’s own documentation: + # + # /// Under gcc, the builtin is available but does not mangle. Therefore, this + # /// trait must not be used anywhere it might be subject to mangling, such as in + # /// a return-type expression. + # + # See: + # + # * + # * + ./fix-__type_pack_element.patch ]; # https://github.com/NixOS/nixpkgs/issues/144170 @@ -153,8 +176,7 @@ stdenv.mkDerivation (finalAttrs: { '@CMAKE_INSTALL_FULL_INCLUDEDIR@' ''; - disabledtests = [ - "concurrency_concurrent_hash_map_test.*/ConcurrentHashMapTest/*.StressTestReclamation" + disabledTests = [ "io_async_ssl_session_test.SSLSessionTest.BasicTest" "io_async_ssl_session_test.SSLSessionTest.NullSessionResumptionTest" "singleton_thread_local_test.SingletonThreadLocalDeathTest.Overload" @@ -171,17 +193,21 @@ stdenv.mkDerivation (finalAttrs: { "io_async_hh_wheel_timer_test.HHWheelTimerTest.NegativeTimeout" "io_async_hh_wheel_timer_test.HHWheelTimerTest.ReschedTest" "io_async_hh_wheel_timer_test.HHWheelTimerTest.SlowFast" + + # In file included from /build/source/folly/lang/test/BitsTest.cpp:17: + # In member function 'constexpr bool folly::get_bit_at_fn::operator()(const Uint*, std::size_t) const [with Uint = short unsigned int]', + # inlined from 'void folly::BitsAllUintsTest_GetBitAtLE_Test::TestBody() [with gtest_TypeParam_ = short unsigned int]' at /build/source/folly/lang/test/BitsTest.cpp:640:5: + # /build/source/folly/lang/Bits.h:494:10: warning: 'in' is used uninitialized [-Wuninitialized] + "lang_bits_test.BitsAllUintsTest/*.GetBitAtLE" ] ++ lib.optionals stdenv.hostPlatform.isLinux [ "concurrency_cache_locality_test.CacheLocality.BenchmarkSysfs" "concurrency_cache_locality_test.CacheLocality.LinuxActual" - "futures_future_test.Future.NoThrow" - "futures_retrying_test.RetryingTest.largeRetries" ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ - "buffered_atomic_test.BufferedAtomic.singleThreadUnguardedAccess" - "io_async_notification_queue_test.NotificationQueueTest.UseAfterFork" - "container_heap_vector_types_test.HeapVectorTypes.SimpleSetTes" + # No idea why these fail. + "logging_xlog_test.XlogTest.perFileCategoryHandling" + "futures_future_test.Future.makeFutureFromMoveOnlyException" ]; passthru = {