Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 869401

Summary: dev-libs/boost-1.80.0: fails to build with clang (container_hash/hash.hpp:132:33: error: no template named 'unary_function')
Product: Gentoo Linux Reporter: gresskar1
Component: Current packagesAssignee: David Seifert <soap>
Status: RESOLVED FIXED    
Severity: normal Keywords: PATCH
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 836220    
Attachments: emerge --info / emerge -pqv / build.log
boost-1.80-container_hash-unary_function.patch

Description gresskar1 2022-09-10 00:25:46 UTC
Created attachment 804325 [details]
emerge --info / emerge -pqv / build.log

dev-libs/boost-1.80.0: fails to build with clang:
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-10 00:34:21 UTC
In file included from libs/program_options/src/cmdline.cpp:11:
In file included from ./boost/program_options/detail/cmdline.hpp:14:
In file included from ./boost/program_options/options_description.hpp:13:
In file included from ./boost/program_options/value_semantic.hpp:12:
In file included from ./boost/any.hpp:20:
In file included from ./boost/type_index.hpp:29:
In file included from ./boost/type_index/stl_type_index.hpp:47:
./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
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-10 00:37:38 UTC
From: https://releases.llvm.org/15.0.0/projects/libcxx/docs/ReleaseNotes.html#deprecations-and-removals
"""
unary_function and binary_function are no longer available in C++17 and C++20. They can be re-enabled by defining _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION. They are also marked as [[deprecated]] in C++11 and later. To disable deprecation warnings you have to define _LIBCPP_DISABLE_DEPRECATION_WARNINGS. Note that this disables all deprecation warnings.
"""
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-10 00:37:59 UTC
It's cheesy but we might be able to append-cppflags -D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION in the ebuild for now.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-10 00:51:35 UTC
This got fixed upstream properly/finally in https://github.com/boostorg/container_hash/commit/4e11c855cb4c7813c75ff5a34f3d9e4fe7d800a0 but this doesn't seem to have made it into Boost 1.80.0.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-10 00:52:20 UTC
(In reply to Sam James from comment #4)
> This got fixed upstream properly/finally in
> https://github.com/boostorg/container_hash/commit/
> 4e11c855cb4c7813c75ff5a34f3d9e4fe7d800a0 but this doesn't seem to have made
> it into Boost 1.80.0.

The copy of container_hash in Boost 1.80 is substantially out of date.
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-10 02:39:08 UTC
Created attachment 804334 [details, diff]
boost-1.80-container_hash-unary_function.patch

I've attached a patch which Works For me but not going to commit it until had a chance to speak to soap as wonder if other gremlins lurking.
Comment 7 Larry the Git Cow gentoo-dev 2022-09-10 10:59:28 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=301f5e6332309bfe2bdc10aea941bbe0bd9a16cb

commit 301f5e6332309bfe2bdc10aea941bbe0bd9a16cb
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-09-10 10:57:58 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-09-10 10:57:58 +0000

    dev-libs/boost: fix build with libcxx
    
    No revbump as:
    1. Didn't build with libcxx anyway;
    2. Mixing libcxx and libstdc++ isn't supported (suppose built Boost
    with libstdc++ & tried to use libcxx in an application) so no
    need to worry about that case, although doubt things would work
    enough that you'd get to the point where this caused a problem.
    
    Closes: https://bugs.gentoo.org/869401
    Thanks-to: Peter Dimov <pdimov@gmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-libs/boost/boost-1.80.0.ebuild                 |  1 +
 .../boost/files/boost-1.80.0-unary-function.patch  | 27 ++++++++++++++++++++++
 2 files changed, 28 insertions(+)