...
Building mongodb 7.0.5 on macOS 14.2.1 with Xcode 15.2 fails because you appear to be using C++20 mode and your bundled boost uses std::unary_function which was removed from the language as of C++17. See https://github.com/boostorg/functional/pull/21
JIRAUSER1253549 commented on Tue, 30 Jan 2024 23:44:47 +0000: boost officially added this define to there configuration in boost >= 1.80.0, so we should add this as always defined in our build and/or upgrade boost: https://github.com/boostorg/config/commit/a7cfad38eae88cf72da8bffadd6098980f427ff7 ryandesign commented on Sat, 27 Jan 2024 00:23:46 +0000: Thank you, that suggestion does work around the bug. Can you make your build system apply that automatically so users don't have to specify it manually? I may be wrong about it affecting all macOS versions. What I meant is it is not dependent on the OS version; it's dependent on the compiler. The compilers in some versions of Xcode might not have this issue, but for example a user on macOS 13 could experience the problem if they upgrade to Xcode 15 (and recall that Apple loves pushing out updates to App Store apps automatically) or a user on any OS could experience the problem if they use a newer clang that they've installed separately. ryandesign commented on Fri, 26 Jan 2024 19:00:08 +0000: Thanks, I will try your suggestion. The issue affects all macOS versions. JIRAUSER1253549 commented on Fri, 26 Jan 2024 16:17:20 +0000: ryandesign Also note that macos 14 is not "supported" platform for mongodb 7.0, but it may still work, we just don't have test coverage for it yet JIRAUSER1253549 commented on Fri, 26 Jan 2024 16:10:41 +0000: ryandesign to workaround this issue, you can add the argument on the scons command line: CPPDEFINES=BOOST_NO_CXX98_FUNCTION_BASE This will cause boost to not try to use that function.
% tar xzf mongodb-src-r7.0.5.tar.gz % cd mongodb-src-r7.0.5 % python3.11 -m venv venv % venv/bin/python3.11 -m pip install -r etc/pip/compile-requirements.txt ... % venv/bin/python3.11 buildscripts/scons.py install-mongod --disable-warnings-as-errors=configure --disable-warnings-as-errors=source Checking required python packages... Requirements list: ... Resolved to these distributions: ... scons: Reading SConscript files ... scons: running with args /Users/me/mongodb-src-r7.0.5/venv/bin/python3.11 buildscripts/scons.py install-mongod --disable-warnings-as-errors=configure --disable-warnings-as-errors=source WARNING: The build_metrics tool might not work as intended due to a failed import: No module named 'jsonschema' scons version: 3.1.2 python version: 3 11 7 'final' 0 Mkdir("build/tmp_test_data") CC is gcc gcc found in $PATH at /usr/bin/gcc CXX is g++ g++ found in $PATH at /usr/bin/g++ Checking if dev env is valid... skipped Checking if C++ compiler "g++" is GCC... no Checking if C++ compiler "g++" is clang... yes Checking if C compiler "gcc" is clang... yes Detected a aarch64 processor Checking if target OS macOS is supported by the toolchain... yes Checking if C compiler is clang 12.0 (or Apple XCode 13.0) or newer...yes Checking if C++ compiler is clang 12.0 (or Apple XCode 13.0) or newer...yes Checking for sufficient macOS target version minimum... yes Checking whether the C compiler works... yes Checking whether the C++ compiler works... yes Checking that the C++ compiler can link a C++ program... yes Checking if C compiler supports -Wno-unused-local-typedefs... yes Checking if C compiler supports -Wno-unused-function... yes Checking if C compiler supports -Wno-unused-private-field... yes Checking if C compiler supports -Wno-deprecated-declarations... yes Checking if C compiler supports -Wno-tautological-constant-out-of-range-compare... yes Checking if C compiler supports -Wno-tautological-constant-compare... yes Checking if C compiler supports -Wno-tautological-unsigned-zero-compare... yes Checking if C compiler supports -Wno-tautological-unsigned-enum-zero-compare... yes Checking if C compiler supports -Wno-unused-const-variable... yes Checking if C compiler supports -Wno-unused-but-set-variable... yes Checking if C compiler supports -Wno-missing-braces... yes Checking if C compiler supports -Wno-inconsistent-missing-override... yes Checking if C compiler supports -Wno-potentially-evaluated-expression... yes Checking if C++ compiler supports -Wpessimizing-move... yes Checking if C++ compiler supports -Wno-maybe-uninitialized... no Checking if C++ compiler supports -Wno-undefined-var-template... yes Checking if C++ compiler supports -Wno-instantiation-after-specialization... yes Checking if C compiler supports -Wno-unused-lambda-capture... yes Checking if C++ compiler supports -fsized-deallocation... yes Checking if C++ compiler supports -Wno-defaulted-function-deleted... yes Checking if C++ compiler supports -Wunused-exception-parameter... yes Checking if C++ compiler supports -Wno-deprecated... yes Checking if C++ compiler supports -Wno-deprecated-builtins... yes Checking if -Wnon-virtual-dtor works reasonably... no Checking if C compiler supports -Wunguarded-availability... yes Checking if C compiler supports -fstack-protector-strong... yes Checking if we are using libstdc++... no Checking if C++ compiler supports -std=c++20... yes Checking if C compiler supports -std=c11... yes Checking for C++20... yes ... In file included from src/mongo/idl/cluster_server_parameter_op_observer.cpp:30: In file included from src/mongo/idl/cluster_server_parameter_op_observer.h:35: In file included from src/mongo/db/client.h:43: In file included from src/mongo/db/service_context.h:39: In file included from src/mongo/db/session/logical_session_id.h:32: In file included from src/third_party/boost/boost/functional/hash.hpp:6: src/third_party/boost/boost/container_hash/hash.hpp:132:33: error: no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'? struct hash_base : std::unary_function {}; ~~~~~^~~~~~~~~~~~~~ __unary_function /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here using __unary_function = __unary_function_keep_layout_base; ^