Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-85779

Build failure with C++20 due to use of unary_function in boost

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 7.0.5
    • Component/s: None
    • None
    • Build
    • ALL
    • Hide
      % 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<T, std::size_t> {};
                                 ~~~~~^~~~~~~~~~~~~~
                                      __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<_Arg, _Result>;
      ^
      Show
      % 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<T, std::size_t> {};                            ~~~~~^~~~~~~~~~~~~~                                 __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<_Arg, _Result>; ^

      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

            Assignee:
            Unassigned Unassigned
            Reporter:
            ryandesign Ryan Schmidt
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: