[Buildroot] [PATCH 1/1] package/mongodb: fix build with glibc >= 2.34
Yann E. MORIN
yann.morin.1998 at free.fr
Sat Nov 13 09:32:37 UTC 2021
Fabrice, All,
On 2021-11-13 09:35 +0100, Fabrice Fontaine spake thusly:
> 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 at gmail.com>
Applied to master, thanks.
Regards,
Yann E. MORIN.
> ---
> ...-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 at 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 at 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 at buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
More information about the buildroot
mailing list