Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
To: buildroot@buildroot.org
Cc: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Subject: [Buildroot] [PATCH 1/1] package/mongodb: fix build with glibc >= 2.34
Date: Sat, 13 Nov 2021 09:35:57 +0100	[thread overview]
Message-ID: <20211113083557.17685-1-fontaine.fabrice@gmail.com> (raw)

Fix the following build failure with glibc >= 2.34:

In file included from /home/giuliobenetti/autobuild/run/instance-0/output-1/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/signal.h:328,
                 from /home/giuliobenetti/autobuild/run/instance-0/output-1/host/arm-buildroot-linux-gnueabihf/include/c++/11.2.0/csignal:42,
                 from src/mongo/stdx/thread.h:33,
                 from src/mongo/db/client.h:46,
                 from src/mongo/db/operation_context.h:36,
                 from src/mongo/db/pipeline/variables.h:32,
                 from src/mongo/db/pipeline/dependencies.h:37,
                 from src/mongo/db/matcher/expression.h:38,
                 from src/mongo/db/matcher/expression_parser.h:34,
                 from src/mongo/db/pipeline/document_source_list_sessions.cpp:34:
src/mongo/stdx/thread.h:107:56: error: call to non-'constexpr' function 'long int sysconf(int)'
  107 |         std::max(kMongoMinSignalStackSize, std::size_t{MINSIGSTKSZ});
      |

Fixes:
 - http://autobuild.buildroot.org/results/6be8efb96547f8ec6e9b776abae8c1b51501e9ed

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 ...-MINSIGSTKSZ-is-no-longer-a-constant.patch | 49 +++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 package/mongodb/0003-SERVER-59459-With-glibc-2-34-MINSIGSTKSZ-is-no-longer-a-constant.patch

diff --git a/package/mongodb/0003-SERVER-59459-With-glibc-2-34-MINSIGSTKSZ-is-no-longer-a-constant.patch b/package/mongodb/0003-SERVER-59459-With-glibc-2-34-MINSIGSTKSZ-is-no-longer-a-constant.patch
new file mode 100644
index 0000000000..02b35c6e4f
--- /dev/null
+++ b/package/mongodb/0003-SERVER-59459-With-glibc-2-34-MINSIGSTKSZ-is-no-longer-a-constant.patch
@@ -0,0 +1,49 @@
+From ef08d0dbc99db8c4620512e92bfb3154282eb5d3 Mon Sep 17 00:00:00 2001
+From: Andrew Morrow <acm@mongodb.com>
+Date: Wed, 15 Sep 2021 15:23:42 -0400
+Subject: [PATCH] SERVER-59459 With glibc-2.34, MINSIGSTKSZ is no longer a
+ constant
+
+[Retrieved (and backported) from:
+https://github.com/mongodb/mongo/commit/ef08d0dbc99db8c4620512e92bfb3154282eb5d3]
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ src/mongo/stdx/thread.h | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/src/mongo/stdx/thread.h b/src/mongo/stdx/thread.h
+index 7b15bb561bd9..6f1e16cdeb36 100644
+--- a/src/mongo/stdx/thread.h
++++ b/src/mongo/stdx/thread.h
+@@ -76,11 +76,19 @@ class SigAltStackController {
+     }
+ 
+ private:
++    static size_t _getStackSize() {
++        // It would be nice for this to be a constexpr, but
++        // MINSIGSTKSZ became a macro that invoked `sysconf` in glibc
++        // 2.34.
++        static const std::size_t kMinSigStkSz = MINSIGSTKSZ;
++        return std::max(kMongoMinSignalStackSize, kMinSigStkSz);
++    }
++
+     void _install() const {
+         stack_t ss;
+         ss.ss_sp = _stackStorage.get();
+         ss.ss_flags = 0;
+-        ss.ss_size = kStackSize;
++        ss.ss_size = _getStackSize();
+         if (sigaltstack(&ss, nullptr)) {
+             abort();
+         }
+@@ -107,9 +115,7 @@ class SigAltStackController {
+     //   ( https://jira.mongodb.org/secure/attachment/233569/233569_stacktrace-writeup.txt )
+     static constexpr std::size_t kMongoMinSignalStackSize = std::size_t{64} << 10;
+ 
+-    static constexpr std::size_t kStackSize =
+-        std::max(kMongoMinSignalStackSize, std::size_t{MINSIGSTKSZ});
+-    std::unique_ptr<std::byte[]> _stackStorage = std::make_unique<std::byte[]>(kStackSize);
++    std::unique_ptr<std::byte[]> _stackStorage = std::make_unique<std::byte[]>(_getStackSize());
+ 
+ #else   // !MONGO_HAS_SIGALTSTACK
+     auto makeInstallGuard() const {
-- 
2.33.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

             reply	other threads:[~2021-11-13  8:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-13  8:35 Fabrice Fontaine [this message]
2021-11-13  9:32 ` [Buildroot] [PATCH 1/1] package/mongodb: fix build with glibc >= 2.34 Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211113083557.17685-1-fontaine.fabrice@gmail.com \
    --to=fontaine.fabrice@gmail.com \
    --cc=buildroot@buildroot.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox