Opened 3 years ago

Closed 4 months ago

#67545 closed defect (fixed)

gnucash @5.0_1: error: no template named 'unary_function' in namespace 'std'

Reported by: tenzap Owned by: drkp (Dan Ports)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc:
Port: gnucash

Description

Gnucash 5.0 doesn't build anymore on macOS 10.11 (el capitan) I'm stuck on El Capitan because my device can't be upgraded, so it would be great if gnucash 5.0 could build on 10.11

Error:

[ 23%] Generating ../../../share/guile/site/2.2/gnucash/qif-import/qif-objects.scm
cd /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_gnome_gnucash/gnucash/work/build/gnucash/import-export/qif-imp && /opt/local/bin/cmake -E create_symlink /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_gnome_gnucash/gnucash/work/gnucash-5.0/gnucash/import-export/qif-imp/qif-objects.scm /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_gnome_gnucash/gnucash/work/build/share/guile/site/2.2/gnucash/qif-import/qif-objects.scm
In file included from /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_gnome_gnucash/gnucash/work/gnucash-5.0/libgnucash/engine/test-core/test-engine-stuff.cpp:39:
In file included from /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_gnome_gnucash/gnucash/work/gnucash-5.0/libgnucash/engine/kvp-frame.hpp:87:
In file included from /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_gnome_gnucash/gnucash/work/gnucash-5.0/libgnucash/engine/kvp-value.hpp:30:
In file included from /opt/local/libexec/boost/1.71/include/boost/variant.hpp:17:
In file included from /opt/local/libexec/boost/1.71/include/boost/variant/variant.hpp:21:
In file included from /opt/local/libexec/boost/1.71/include/boost/type_index.hpp:29:
In file included from /opt/local/libexec/boost/1.71/include/boost/type_index/stl_type_index.hpp:47:
/opt/local/libexec/boost/1.71/include/boost/container_hash/hash.hpp:130: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
/opt/local/libexec/llvm-16/bin/../include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here
using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
^

You might also have a look at the logs on the officialn builders

Change History (5)

comment:1 Changed 3 years ago by tenzap

Version: → 2.8.1

comment:2 Changed 3 years ago by jmroot (Joshua Root)

Owner: set to drkp
Status: new → assigned

comment:3 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Summary: gnucash @5.0_1: doesn't build on macos 10.11 and other → gnucash @5.0_1: error: no template named 'unary_function' in namespace 'std'

The Portfile sets compiler.cxx_standard 2017 and I see -std=c++17 in the log.

The Internet tells me std::unary_function is deprecated in C++11 and removed in C++17.

So this is not a situation of El Capitan being too old. On the contrary, it's a situation where the compiler we're using to support those old systems (Clang 16 in this case) is so new that it has removed support for unary_function which boost, which gnucash depends on, uses. I think the Xcode clang versions we're using on newer macOS versions already support C++17 but aren't new enough that they removed unary_function, but they will start failing too once we update to newer versions of Xcode.

gnucash is using boost 1.71 which is old. The ​upstream PR about this issue has been merged so it should either be fixed in the latest boost or the next boost to be released; gnucash could switch to newer boost.

comment:4 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

The port was updated to 5.3 last week but this problem remains on High Sierra and earlier.

comment:5 Changed 4 months ago by drkp (Dan Ports)

Resolution: → fixed
Status: assigned → closed

I believe this is fixed now because this error comes from boost171 and gnucash now uses boost176, which has patches for clang16/C++17 that provide std::unary_function unconditionally.

Note: See TracTickets for help on using tickets.