M gnu/local.mk => gnu/local.mk +3 -0
@@ 967,7 967,10 @@ dist_patch_DATA = \
%D%/packages/patches/abcl-fix-build-xml.patch \
%D%/packages/patches/ableton-link-system-libraries-debian.patch \
%D%/packages/patches/abiword-explictly-cast-bools.patch \
+ %D%/packages/patches/abseil-cpp-20200923.3-adjust-sysinfo.patch \
+ %D%/packages/patches/abseil-cpp-20200923.3-duration-test.patch \
%D%/packages/patches/abseil-cpp-20220623.1-no-kepsilon-i686.patch \
+ %D%/packages/patches/abseil-cpp-fix-strerror_test.patch \
%D%/packages/patches/adb-add-libraries.patch \
%D%/packages/patches/adb-libssl_11-compatibility.patch \
%D%/packages/patches/accountsservice-extensions.patch \
M gnu/packages/cpp.scm => gnu/packages/cpp.scm +59 -41
@@ 48,7 48,6 @@
;;; Copyright © 2025 Nicolas Graves <ngraves@ngraves.fr>
;;; Copyright © 2025 Romain Garbage <romain.garbage@inria.fr>
;;; Copyright © 2024, 2025 Janneke Nieuwenhuizen <janneke@gnu.org>
-;;; Copyright © 2025 Andreas Enge <andreas@enge.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ 2042,12 2041,13 @@ other values of screen objects, by setting their values as the tween starting
point and then, after each tween step, plugging back the result.")
(license license:expat)))
-;; This one is not used by itself anymore, but as inheritance base for
-;; abseil-cpp-cxxstd11, which is an input to grpc and python-grpcio.
-(define-public abseil-cpp-20220623
+(define-public abseil-cpp-20200923.3
+ ;; "guix refresh -l" shows no dependents of this package, but by input
+ ;; rewriting, grpc-1.16.1 depends on it;
+ ;; in turn this is an input to hyperledger-iroha and tensorflow.
(package
(name "abseil-cpp")
- (version "20220623.2")
+ (version "20200923.3")
(source (origin
(method git-fetch)
(uri (git-reference
@@ 2056,44 2056,39 @@ point and then, after each tween step, plugging back the result.")
(file-name (git-file-name name version))
(sha256
(base32
- "1cmchfcqp85yp5hc3i47xv3i14v0f2wd5h2jblvcjjmjyhji1bwr"))
+ "1p4djhm1f011ficbjjxx3n8428p8481p20j4glpaawnpsi362hkl"))
(patches
- (search-patches "abseil-cpp-20220623.1-no-kepsilon-i686.patch"))))
+ (search-patches "abseil-cpp-fix-strerror_test.patch"
+ "abseil-cpp-20200923.3-adjust-sysinfo.patch"
+ "abseil-cpp-20200923.3-duration-test.patch"))))
(build-system cmake-build-system)
(arguments
- `(#:configure-flags
- ;; This convoluted approach of deleting a flag of a list to which
- ;; it was added in the first place is a remainder of inheritance;
- ;; when undoing the inheritance it ensured that the derivation
- ;; did not change.
- (cons* "-DABSL_BUILD_TESTING=ON"
- (delete "-DABSL_RUN_TESTS=ON"
- (list
- "-DBUILD_SHARED_LIBS=ON"
- "-DABSL_RUN_TESTS=ON"
- "-DABSL_USE_EXTERNAL_GOOGLETEST=ON"
- ;; Needed, else we get errors like:
- ;; ld: CMakeFiles/absl_periodic_sampler_test.dir/internal/periodic_sampler_test.cc.o:
- ;; undefined reference to symbol '_ZN7testing4Mock16UnregisterLockedEPNS_8internal25UntypedFunctionMockerBaseE'
- ;; ld: /gnu/store/...-googletest-1.10.0/lib/libgmock.so:
- ;; error adding symbols: DSO missing from command line
- ;; collect2: error: ld returned 1 exit status
- "-DCMAKE_EXE_LINKER_FLAGS=-lgtest -lpthread -lgmock")))
- #:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'fix-max
- (lambda _
- (substitute* "absl/debugging/failure_signal_handler.cc"
- (("std::max\\(SIGSTKSZ, 65536\\)")
- "std::max<size_t>(SIGSTKSZ, 65536)"))))
- (add-before 'configure 'remove-gtest-check
- ;; The CMakeLists fails to find our googletest for some reason, but
- ;; it works nonetheless.
- (lambda _
- (substitute* "CMakeLists.txt"
- (("check_target\\(gtest\\)") "")
- (("check_target\\(gtest_main\\)") "")
- (("check_target\\(gmock\\)") "")))))))
+ `(#:configure-flags (list "-DBUILD_SHARED_LIBS=ON"
+ "-DABSL_RUN_TESTS=ON"
+ "-DABSL_USE_EXTERNAL_GOOGLETEST=ON"
+ ;; Needed, else we get errors like:
+ ;;
+ ;; ld: CMakeFiles/absl_periodic_sampler_test.dir/internal/periodic_sampler_test.cc.o:
+ ;; undefined reference to symbol '_ZN7testing4Mock16UnregisterLockedEPNS_8internal25UntypedFunctionMockerBaseE'
+ ;; ld: /gnu/store/...-googletest-1.10.0/lib/libgmock.so:
+ ;; error adding symbols: DSO missing from command line
+ ;; collect2: error: ld returned 1 exit status
+ "-DCMAKE_EXE_LINKER_FLAGS=-lgtest -lpthread -lgmock")
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'fix-max
+ (lambda _
+ (substitute* "absl/debugging/failure_signal_handler.cc"
+ (("std::max\\(SIGSTKSZ, 65536\\)")
+ "std::max<size_t>(SIGSTKSZ, 65536)"))))
+ (add-before 'configure 'remove-gtest-check
+ ;; The CMakeLists fails to find our googletest for some reason, but
+ ;; it works nonetheless.
+ (lambda _
+ (substitute* "CMakeLists.txt"
+ (("check_target\\(gtest\\)") "")
+ (("check_target\\(gtest_main\\)") "")
+ (("check_target\\(gmock\\)") "")))))))
(native-inputs
(list googletest))
(home-page "https://abseil.io")
@@ 2101,7 2096,30 @@ point and then, after each tween step, plugging back the result.")
(description "Abseil is a collection of C++ library code designed to
augment the C++ standard library. The Abseil library code is collected from
Google's C++ code base.")
- (license license:asl2.0)))
+ (license license:asl2.0)))
+
+(define-public abseil-cpp-20220623
+ (let ((base abseil-cpp-20200923.3))
+ (package
+ (inherit base)
+ (name "abseil-cpp")
+ (version "20220623.2")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/abseil/abseil-cpp")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1cmchfcqp85yp5hc3i47xv3i14v0f2wd5h2jblvcjjmjyhji1bwr"))
+ (patches
+ (search-patches "abseil-cpp-20220623.1-no-kepsilon-i686.patch"))))
+ (arguments
+ (substitute-keyword-arguments (package-arguments base)
+ ((#:configure-flags flags)
+ `(cons* "-DABSL_BUILD_TESTING=ON"
+ (delete "-DABSL_RUN_TESTS=ON" ,flags))))))))
(define-public abseil-cpp
(let ((base abseil-cpp-20220623))
A gnu/packages/patches/abseil-cpp-20200923.3-adjust-sysinfo.patch => gnu/packages/patches/abseil-cpp-20200923.3-adjust-sysinfo.patch +60 -0
@@ 0,0 1,60 @@
+https://sources.debian.org/data/main/a/abseil/0~20200923.3-2/debian/patches/cpu-frequency.diff
+This patch is taken from Debian instead of the upstream URL because the
+upstream URL contains far more changes than occur in this patch.
+
+It was then modified to also work for armhf.
+
+From: Benjamin Barenblat <bbaren@google.com>
+Subject: Ignore missing CPU frequency on more architectures
+Forwarded: yes
+Applied-Upstream: https://github.com/abseil/abseil-cpp/commit/1918ad2ae38aa32c74b558b322479a8efdd76363
+
+Linux on MIPS, PA-RISC, RISC-V, and SystemZ doesn’t expose the nominal CPU
+frequency via /sys, so don’t worry if `NominalCPUFrequency` returns 1.0 on those
+platforms.
+
+Some POWER machines expose the CPU frequency; others do not. Since we can’t
+predict which type of machine the tests will run on, simply disable testing for
+`NominalCPUFrequency` on POWER.
+
+The author works at Google. Upstream applied this patch as Piper revision
+347079873 and exported it to GitHub; the Applied-Upstream URL above points to
+the exported commit.
+
+--- a/absl/base/internal/sysinfo_test.cc
++++ b/absl/base/internal/sysinfo_test.cc
+@@ -37,17 +37,28 @@ TEST(SysinfoTest, NumCPUs) {
+ << "NumCPUs() should not have the default value of 0";
+ }
+
++// Ensure that NominalCPUFrequency returns a reasonable value, or 1.00 on
++// platforms where the CPU frequency is not available through sysfs.
++//
++// POWER is particularly problematic here; some Linux kernels expose the CPU
++// frequency, while others do not. Since we can't predict a priori what a given
++// machine is going to do, just disable this test on POWER on Linux.
++#if !(defined(__linux) && (defined(__ppc64__) || defined(__PPC64__)))
+ TEST(SysinfoTest, NominalCPUFrequency) {
+-#if !(defined(__aarch64__) && defined(__linux__)) && !defined(__EMSCRIPTEN__)
+- EXPECT_GE(NominalCPUFrequency(), 1000.0)
+- << "NominalCPUFrequency() did not return a reasonable value";
+-#else
+- // Aarch64 cannot read the CPU frequency from sysfs, so we get back 1.0.
+- // Emscripten does not have a sysfs to read from at all.
++ // Linux only exposes the CPU frequency on certain architectures, and
++ // Emscripten doesn't expose it at all.
++#if defined(__linux__) && \
++ (defined(__aarch64__) || defined(__hppa__) || defined(__mips__) || \
++ defined(__arm__) || defined(__riscv) || defined(__s390x__)) || \
++ defined(__EMSCRIPTEN__)
+ EXPECT_EQ(NominalCPUFrequency(), 1.0)
+ << "CPU frequency detection was fixed! Please update unittest.";
++#else
++ EXPECT_GE(NominalCPUFrequency(), 1000.0)
++ << "NominalCPUFrequency() did not return a reasonable value";
+ #endif
+ }
++#endif
+
+ TEST(SysinfoTest, GetTID) {
+ EXPECT_EQ(GetTID(), GetTID()); // Basic compile and equality test.
A gnu/packages/patches/abseil-cpp-20200923.3-duration-test.patch => gnu/packages/patches/abseil-cpp-20200923.3-duration-test.patch +86 -0
@@ 0,0 1,86 @@
+This patch is taken from upstream and helps the test pass on all architectures.
+
+The adjustment to absl/numeric/internal/bits.h was removed since the file
+didn't appear in the git checkout.
+
+From b0735979d778a768caee207f01f327535cbd2140 Mon Sep 17 00:00:00 2001
+From: Abseil Team <absl-team@google.com>
+Date: Tue, 2 Mar 2021 14:28:07 -0800
+Subject: [PATCH] Export of internal Abseil changes
+
+--
+a74bdb72c3a6983e08a805938dd0e20e97d55bba by Abseil Team <absl-team@google.com>:
+
+Fix typo: calcualte -> calculate
+
+PiperOrigin-RevId: 360515509
+
+--
+3ddf8ac194e81a13e9de095e59dd061c1beacfe3 by Benjamin Barenblat <bbaren@google.com>:
+
+Make tests tolerant of FMA contraction
+
+Weaken Duration.ToDoubleSecondsCheckEdgeCases and
+Duration.ToDoubleSecondsCheckRandom to make them less sensitive to fused
+multiply/add contraction.
+
+PiperOrigin-RevId: 360297653
+GitOrigin-RevId: a74bdb72c3a6983e08a805938dd0e20e97d55bba
+Change-Id: I0c55383bc13040ea77511c4130d142368103dc57
+---
+ absl/numeric/internal/bits.h | 2 +-
+ absl/time/duration_test.cc | 18 +++++++++++-------
+ 2 files changed, 12 insertions(+), 8 deletions(-)
+
+diff --git a/absl/time/duration_test.cc b/absl/time/duration_test.cc
+index 4d85a2c4f45..fb28fa987f6 100644
+--- a/absl/time/duration_test.cc
++++ b/absl/time/duration_test.cc
+@@ -1369,10 +1369,13 @@ TEST(Duration, SmallConversions) {
+ EXPECT_THAT(ToTimeval(absl::Nanoseconds(2000)), TimevalMatcher(tv));
+ }
+
+-void VerifySameAsMul(double time_as_seconds, int* const misses) {
++void VerifyApproxSameAsMul(double time_as_seconds, int* const misses) {
+ auto direct_seconds = absl::Seconds(time_as_seconds);
+ auto mul_by_one_second = time_as_seconds * absl::Seconds(1);
+- if (direct_seconds != mul_by_one_second) {
++ // These are expected to differ by up to one tick due to fused multiply/add
++ // contraction.
++ if (absl::AbsDuration(direct_seconds - mul_by_one_second) >
++ absl::time_internal::MakeDuration(0, 1u)) {
+ if (*misses > 10) return;
+ ASSERT_LE(++(*misses), 10) << "Too many errors, not reporting more.";
+ EXPECT_EQ(direct_seconds, mul_by_one_second)
+@@ -1384,7 +1387,8 @@ void VerifySameAsMul(double time_as_seconds, int* const misses) {
+ // For a variety of interesting durations, we find the exact point
+ // where one double converts to that duration, and the very next double
+ // converts to the next duration. For both of those points, verify that
+-// Seconds(point) returns the same duration as point * Seconds(1.0)
++// Seconds(point) returns a duration near point * Seconds(1.0). (They may
++// not be exactly equal due to fused multiply/add contraction.)
+ TEST(Duration, ToDoubleSecondsCheckEdgeCases) {
+ constexpr uint32_t kTicksPerSecond = absl::time_internal::kTicksPerSecond;
+ constexpr auto duration_tick = absl::time_internal::MakeDuration(0, 1u);
+@@ -1423,8 +1427,8 @@ TEST(Duration, ToDoubleSecondsCheckEdgeCases) {
+ }
+ // Now low_edge is the highest double that converts to Duration d,
+ // and high_edge is the lowest double that converts to Duration after_d.
+- VerifySameAsMul(low_edge, &misses);
+- VerifySameAsMul(high_edge, &misses);
++ VerifyApproxSameAsMul(low_edge, &misses);
++ VerifyApproxSameAsMul(high_edge, &misses);
+ }
+ }
+ }
+@@ -1444,8 +1448,8 @@ TEST(Duration, ToDoubleSecondsCheckRandom) {
+ int misses = 0;
+ for (int i = 0; i < 1000000; ++i) {
+ double d = std::exp(uniform(gen));
+- VerifySameAsMul(d, &misses);
+- VerifySameAsMul(-d, &misses);
++ VerifyApproxSameAsMul(d, &misses);
++ VerifyApproxSameAsMul(-d, &misses);
+ }
+ }
+
A gnu/packages/patches/abseil-cpp-fix-strerror_test.patch => gnu/packages/patches/abseil-cpp-fix-strerror_test.patch +42 -0
@@ 0,0 1,42 @@
+From e2b1bab19a782cb62bb010d1c2925ab7314fb113 Mon Sep 17 00:00:00 2001
+diff --git a/absl/base/internal/strerror.cc b/absl/base/internal/strerror.cc
+index d66ba120..0d6226fd 100644
+--- a/absl/base/internal/strerror.cc
++++ b/absl/base/internal/strerror.cc
+@@ -51,7 +51,6 @@ const char* StrErrorAdaptor(int errnum, char* buf, size_t buflen) {
+ }
+
+ std::string StrErrorInternal(int errnum) {
+- absl::base_internal::ErrnoSaver errno_saver;
+ char buf[100];
+ const char* str = StrErrorAdaptor(errnum, buf, sizeof buf);
+ if (*str == '\0') {
+@@ -76,6 +75,7 @@ std::array<std::string, kSysNerr>* NewStrErrorTable() {
+ } // namespace
+
+ std::string StrError(int errnum) {
++ absl::base_internal::ErrnoSaver errno_saver;
+ static const auto* table = NewStrErrorTable();
+ if (errnum >= 0 && errnum < static_cast<int>(table->size())) {
+ return (*table)[errnum];
+diff --git a/absl/base/internal/strerror_test.cc b/absl/base/internal/strerror_test.cc
+index a53da97f..e32d5b5c 100644
+--- a/absl/base/internal/strerror_test.cc
++++ b/absl/base/internal/strerror_test.cc
+@@ -62,12 +62,14 @@ TEST(StrErrorTest, MultipleThreads) {
+ ++counter;
+ errno = ERANGE;
+ const std::string value = absl::base_internal::StrError(i);
++ // EXPECT_* could change errno. Stash it first.
++ int check_err = errno;
++ EXPECT_THAT(check_err, Eq(ERANGE));
+ // Only the GNU implementation is guaranteed to provide the
+ // string "Unknown error nnn". POSIX doesn't say anything.
+ if (!absl::StartsWith(value, "Unknown error ")) {
+- EXPECT_THAT(absl::base_internal::StrError(i), Eq(expected_strings[i]));
++ EXPECT_THAT(value, Eq(expected_strings[i]));
+ }
+- EXPECT_THAT(errno, Eq(ERANGE));
+ }
+ };
+