diff --git a/pkgs/servers/nosql/mongodb/4.4.nix b/pkgs/servers/nosql/mongodb/4.4.nix index 7dd74e24fc48..9db11e21619b 100644 --- a/pkgs/servers/nosql/mongodb/4.4.nix +++ b/pkgs/servers/nosql/mongodb/4.4.nix @@ -10,5 +10,6 @@ buildMongoDB { sha256 = "sha256-ebg3R6P+tjRvizDzsl7mZzhTfqIaRJPfHBu0IfRvtS8="; patches = [ ./forget-build-dependencies-4-4.patch + ./fix-build-with-boost-1.79-4_4.patch ] ++ lib.optionals stdenv.isDarwin [ ./asio-no-experimental-string-view-4-4.patch ]; } diff --git a/pkgs/servers/nosql/mongodb/5.0.nix b/pkgs/servers/nosql/mongodb/5.0.nix index 6bb2294cfffa..cd25525f4fe6 100644 --- a/pkgs/servers/nosql/mongodb/5.0.nix +++ b/pkgs/servers/nosql/mongodb/5.0.nix @@ -21,5 +21,7 @@ buildMongoDB { patches = [ ./forget-build-dependencies-4-4.patch ./asio-no-experimental-string-view-4-4.patch + ./fix-build-with-boost-1.79-5_0.patch + ./fix-gcc-Wno-exceptions-5.0.patch ]; } diff --git a/pkgs/servers/nosql/mongodb/fix-build-with-boost-1.79-4_4.patch b/pkgs/servers/nosql/mongodb/fix-build-with-boost-1.79-4_4.patch new file mode 100644 index 000000000000..fe1eb4aa3609 --- /dev/null +++ b/pkgs/servers/nosql/mongodb/fix-build-with-boost-1.79-4_4.patch @@ -0,0 +1,91 @@ +From 9a4c7b33e49cdf121ff9dee858539568d009fc27 Mon Sep 17 00:00:00 2001 +From: Et7f3 +Date: Tue, 19 Jul 2022 22:11:11 +0200 +Subject: [PATCH] build: Upgrade boost to 1.79.0 + +We can see in src/third_party/boost-1.70.0/boost/version.hpp that vendored +version of boost is BOOST_LIB_VERSION "1_70" + +We can also see the doc desbribe 2 headers to use filesystems lib: One is +src/third_party/boost/boost/filesystem/fstream.hpp that contains (175-177) + typedef basic_ifstream ifstream; + typedef basic_ofstream ofstream; + typedef basic_fstream fstream; + +So this mean they mostly forgot to include a header and include-what-you-use +would catch this error. + +In upstream they fixed in a simmilar way +https://github.com/mongodb/mongo/commit/13389dc222fc372442be8c147e09685bb9a26a3a +--- + src/mongo/db/storage/storage_repair_observer.cpp | 1 + + src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp | 1 + + src/mongo/shell/shell_utils_extended.cpp | 1 + + src/mongo/util/processinfo_linux.cpp | 2 +- + src/mongo/util/stacktrace_threads.cpp | 1 + + 5 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/mongo/db/storage/storage_repair_observer.cpp b/src/mongo/db/storage/storage_repair_observer.cpp +index 22b76a6a39c..453f48229cd 100644 +--- a/src/mongo/db/storage/storage_repair_observer.cpp ++++ b/src/mongo/db/storage/storage_repair_observer.cpp +@@ -42,6 +42,7 @@ + #endif + + #include ++#include + + #include "mongo/db/dbhelpers.h" + #include "mongo/db/operation_context.h" +diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp +index 85121941458..7464022fb28 100644 +--- a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp ++++ b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp +@@ -37,6 +37,7 @@ + + #include + #include ++#include + + #include "mongo/base/simple_string_data_comparator.h" + #include "mongo/bson/bsonobjbuilder.h" +diff --git a/src/mongo/shell/shell_utils_extended.cpp b/src/mongo/shell/shell_utils_extended.cpp +index 8cd7f035f1d..cd672eb513f 100644 +--- a/src/mongo/shell/shell_utils_extended.cpp ++++ b/src/mongo/shell/shell_utils_extended.cpp +@@ -37,6 +37,7 @@ + #endif + + #include ++#include + #include + + #include "mongo/bson/bson_validate.h" +diff --git a/src/mongo/util/processinfo_linux.cpp b/src/mongo/util/processinfo_linux.cpp +index de4b84bca5a..7fa9d5d128e 100644 +--- a/src/mongo/util/processinfo_linux.cpp ++++ b/src/mongo/util/processinfo_linux.cpp +@@ -33,7 +33,7 @@ + + #include "processinfo.h" + +-#include ++#include + #include + #include + #include +diff --git a/src/mongo/util/stacktrace_threads.cpp b/src/mongo/util/stacktrace_threads.cpp +index 4667a261ab7..73a36015bd6 100644 +--- a/src/mongo/util/stacktrace_threads.cpp ++++ b/src/mongo/util/stacktrace_threads.cpp +@@ -36,6 +36,7 @@ + #include + #include + #include ++#include + #include + #include + #include +-- +2.32.1 (Apple Git-133) + diff --git a/pkgs/servers/nosql/mongodb/fix-build-with-boost-1.79-5_0.patch b/pkgs/servers/nosql/mongodb/fix-build-with-boost-1.79-5_0.patch new file mode 100644 index 000000000000..d00ed5e77d67 --- /dev/null +++ b/pkgs/servers/nosql/mongodb/fix-build-with-boost-1.79-5_0.patch @@ -0,0 +1,90 @@ +From fb846bdbd07cc3b8ada6179dccd974072c2b69da Mon Sep 17 00:00:00 2001 +From: Et7f3 +Date: Tue, 19 Jul 2022 22:01:56 +0200 +Subject: [PATCH] build: Upgrade boost to 1.79.0 + +We can see in src/third_party/boost/boost/version.hpp that vendored version of +boost is BOOST_LIB_VERSION "1_76" + +We can also see the doc desbribe 2 headers to use filesystems lib: One is +src/third_party/boost/boost/filesystem/fstream.hpp that contains (175-177) + typedef basic_ifstream ifstream; + typedef basic_ofstream ofstream; + typedef basic_fstream fstream; + +So this mean they mostly forgot to include a header and include-what-you-use +would catch this error. + +In upstream they fixed in a simmilar way +https://github.com/mongodb/mongo/commit/13389dc222fc372442be8c147e09685bb9a26a3a +--- + src/mongo/db/storage/storage_repair_observer.cpp | 1 + + src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp | 1 + + src/mongo/shell/shell_utils_extended.cpp | 1 + + src/mongo/util/processinfo_linux.cpp | 1 + + src/mongo/util/stacktrace_threads.cpp | 1 + + 5 files changed, 5 insertions(+) + +diff --git a/src/mongo/db/storage/storage_repair_observer.cpp b/src/mongo/db/storage/storage_repair_observer.cpp +index 22b76a6a39c..453f48229cd 100644 +--- a/src/mongo/db/storage/storage_repair_observer.cpp ++++ b/src/mongo/db/storage/storage_repair_observer.cpp +@@ -42,6 +42,7 @@ + #endif + + #include ++#include + + #include "mongo/db/dbhelpers.h" + #include "mongo/db/operation_context.h" +diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp +index 07fabadd634..2924a2c74af 100644 +--- a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp ++++ b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp +@@ -37,6 +37,7 @@ + + #include + #include ++#include + + #include "mongo/base/simple_string_data_comparator.h" + #include "mongo/bson/bsonobjbuilder.h" +diff --git a/src/mongo/shell/shell_utils_extended.cpp b/src/mongo/shell/shell_utils_extended.cpp +index fbdddc1318d..e37d4c93a11 100644 +--- a/src/mongo/shell/shell_utils_extended.cpp ++++ b/src/mongo/shell/shell_utils_extended.cpp +@@ -37,6 +37,7 @@ + #endif + + #include ++#include + #include + #include + +diff --git a/src/mongo/util/processinfo_linux.cpp b/src/mongo/util/processinfo_linux.cpp +index eae0e9b7764..d5cd40f6039 100644 +--- a/src/mongo/util/processinfo_linux.cpp ++++ b/src/mongo/util/processinfo_linux.cpp +@@ -52,6 +52,7 @@ + #endif + + #include ++#include + #include + #include + #include +diff --git a/src/mongo/util/stacktrace_threads.cpp b/src/mongo/util/stacktrace_threads.cpp +index d2ee29d24b4..d485fa22367 100644 +--- a/src/mongo/util/stacktrace_threads.cpp ++++ b/src/mongo/util/stacktrace_threads.cpp +@@ -36,6 +36,7 @@ + #include + #include + #include ++#include + #include + #include + #include +-- +2.32.1 (Apple Git-133) + diff --git a/pkgs/servers/nosql/mongodb/fix-gcc-Wno-exceptions-5.0.patch b/pkgs/servers/nosql/mongodb/fix-gcc-Wno-exceptions-5.0.patch new file mode 100644 index 000000000000..b8803911968b --- /dev/null +++ b/pkgs/servers/nosql/mongodb/fix-gcc-Wno-exceptions-5.0.patch @@ -0,0 +1,44 @@ +From e78b2bf6eaa0c43bd76dbb841add167b443d2bb0 Mon Sep 17 00:00:00 2001 +From: Mark Benvenuto +Date: Mon, 21 Jun 2021 11:36:56 -0400 +Subject: [PATCH] SERVER-57688 Fix debug gcc 11 and clang 12 builds on Fedora + 34 + +--- + SConstruct | 4 ---- + src/mongo/db/query/plan_summary_stats.h | 4 +++- + src/mongo/util/shim_boost_assert.cpp | 1 + + 3 files changed, 4 insertions(+), 5 deletions(-) + +diff --git a/SConstruct b/SConstruct +index 25fd4a248d0c..23cff6f9da53 100644 +--- a/SConstruct ++++ b/SConstruct +@@ -3108,10 +3108,6 @@ def doConfigure(myenv): + # harmful to capture unused variables we are suppressing for now with a plan to fix later. + AddToCCFLAGSIfSupported(myenv, "-Wno-unused-lambda-capture") + +- # This warning was added in clang-5 and incorrectly flags our implementation of +- # exceptionToStatus(). See https://bugs.llvm.org/show_bug.cgi?id=34804 +- AddToCCFLAGSIfSupported(myenv, "-Wno-exceptions") +- + # Enable sized deallocation support. + AddToCXXFLAGSIfSupported(myenv, '-fsized-deallocation') + +diff --git a/src/mongo/db/query/plan_summary_stats.h b/src/mongo/db/query/plan_summary_stats.h +index 58677ab20d25..cfaa2053d16f 100644 +--- a/src/mongo/db/query/plan_summary_stats.h ++++ b/src/mongo/db/query/plan_summary_stats.h +@@ -29,9 +29,11 @@ + + #pragma once + +-#include "mongo/util/container_size_helper.h" ++#include + #include + ++#include "mongo/util/container_size_helper.h" ++ + namespace mongo { + + /** diff --git a/pkgs/servers/nosql/mongodb/mongodb.nix b/pkgs/servers/nosql/mongodb/mongodb.nix index 28795890069d..82837e87d1a6 100644 --- a/pkgs/servers/nosql/mongodb/mongodb.nix +++ b/pkgs/servers/nosql/mongodb/mongodb.nix @@ -70,8 +70,16 @@ in stdenv.mkDerivation rec { # fix environment variable reading substituteInPlace SConstruct \ --replace "env = Environment(" "env = Environment(ENV = os.environ," + '' + lib.optionalString (versionAtLeast version "4.4" && versionOlder version "4.6") '' + # Fix debug gcc 11 and clang 12 builds on Fedora + # https://github.com/mongodb/mongo/commit/e78b2bf6eaa0c43bd76dbb841add167b443d2bb0.patch + substituteInPlace src/mongo/db/query/plan_summary_stats.h --replace '#include ' '#include + #include ' + substituteInPlace src/mongo/db/exec/plan_stats.h --replace '#include ' '#include + #include ' '' + lib.optionalString stdenv.isDarwin '' substituteInPlace src/third_party/mozjs-${variants.mozjsVersion}/extract/js/src/jsmath.cpp --replace '${variants.mozjsReplace}' 0 + '' + lib.optionalString (stdenv.isDarwin && versionOlder version "3.6") '' substituteInPlace src/third_party/s2/s1angle.cc --replace drem remainder substituteInPlace src/third_party/s2/s1interval.cc --replace drem remainder substituteInPlace src/third_party/s2/s2cap.cc --replace drem remainder diff --git a/pkgs/servers/nosql/mongodb/v3_6.nix b/pkgs/servers/nosql/mongodb/v3_6.nix index 4fc9e3ea9062..9a6379fac440 100644 --- a/pkgs/servers/nosql/mongodb/v3_6.nix +++ b/pkgs/servers/nosql/mongodb/v3_6.nix @@ -1,4 +1,4 @@ -{ stdenv, callPackage, lib, sasl, boost, Security, CoreFoundation, cctools }: +{ stdenv, callPackage, fetchpatch, lib, sasl, boost, Security, CoreFoundation, cctools }: let buildMongoDB = callPackage ./mongodb.nix { @@ -12,5 +12,11 @@ in buildMongoDB { version = "3.6.23"; sha256 = "sha256-EJpIerW4zcGJvHfqJ65fG8yNsLRlUnRkvYfC+jkoFJ4="; patches = [ ./forget-build-dependencies.patch ] - ++ lib.optionals stdenv.isDarwin [ ./asio-no-experimental-string-view.patch ]; + ++ lib.optionals stdenv.isDarwin [ + (fetchpatch { + name = "fix double link of isNamedError."; + url = "https://github.com/mongodb/mongo/commit/9c6751b9765d269b667324bb2efe1ca76a916d20.patch"; + sha256 = "sha256-4mcafqhBh7039ocEI9d/gXWck51X68PqtWtz4dapwwI="; + }) + ]; } diff --git a/pkgs/servers/nosql/mongodb/v4_0.nix b/pkgs/servers/nosql/mongodb/v4_0.nix index 9d28a9185ba1..1235123c94a2 100644 --- a/pkgs/servers/nosql/mongodb/v4_0.nix +++ b/pkgs/servers/nosql/mongodb/v4_0.nix @@ -21,5 +21,11 @@ in buildMongoDB { sha256 = "sha256-RvfCP462RG+ZVjcb23DgCuxCdfPl2/UgH8N7FgCghGI="; }) ] - ++ lib.optionals stdenv.isDarwin [ ./asio-no-experimental-string-view.patch ]; + ++ lib.optionals stdenv.isDarwin [ + (fetchpatch { + name = "fix double link of isNamedError."; + url = "https://github.com/mongodb/mongo/commit/9c6751b9765d269b667324bb2efe1ca76a916d20.patch"; + sha256 = "sha256-4mcafqhBh7039ocEI9d/gXWck51X68PqtWtz4dapwwI="; + }) + ]; }