Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 869170 - dev-cpp/clucene-2.3.3.4-r8: Exposes deprecated/removed std::binary_function in public headers
Summary: dev-cpp/clucene-2.3.3.4-r8: Exposes deprecated/removed std::binary_function i...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords: PATCH, PullRequest
Depends on:
Blocks: systemwide-clang 853298
  Show dependency tree
 
Reported: 2022-09-08 11:02 UTC by Manuel Nickschas
Modified: 2023-06-28 21:14 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge.info (emerge.info.xz,6.76 KB, application/x-xz)
2022-09-08 12:34 UTC, Manuel Nickschas
Details
remoe-binary-function.patch (remove-binary-function.patch,2.87 KB, patch)
2023-03-24 09:22 UTC, Manuel Nickschas
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Manuel Nickschas 2022-09-08 11:02:55 UTC
dev-cpp/clucence-2.3.3.4-r8 exposes several uses of std::binary_function in util/Equators.h. std::binary_function was deprecated in C++11 and finally removed from the standard in C++17 [1].

While current versions of GCC/libstdc++ still seem to be providing this deprecated/removed template, Clang-15/libcxx no longer do, and thus packages using Clucene fail, for example libreoffice:

-----8<------------------------------------------------------
In file included from /var/tmp/portage/app-office/libreoffice-7.3.5.2/work/libreoffice-7.3.5.2/helpcompiler/source/LuceneHelper.cxx:10:
In file included from /var/tmp/portage/app-office/libreoffice-7.3.5.2/work/libreoffice-7.3.5.2/helpcompiler/source/LuceneHelper.hxx:17:
In file included from /usr/include/CLucene.h:12:
In file included from /usr/include/CLucene/index/IndexReader.h:12:
In file included from /usr/include/CLucene/util/VoidList.h:10:
/usr/include/CLucene/util/Equators.h:25:53: error: no template named 'binary_function' in namespace 'std'; did you mean '__binary_function'?
        class CLUCENE_INLINE_EXPORT Int32:public CL_NS_STD(binary_function)<const int32_t*,const int32_t*,bool>
                                                 ~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/CLucene/SharedHeader.h:109:33: note: expanded from macro 'CL_NS_STD'
   #define CL_NS_STD(func) std::func
                           ~~~~~^
/usr/include/c++/v1/__functional/binary_function.h:49:1: note: '__binary_function' declared here
using __binary_function = __binary_function_keep_layout_base<_Arg1, _Arg2, _Result>;
^
-----8<------------------------------------------------------

While the package probably still builds fine with current versions of GCC, I would expect GCC to follow suit at some point and no longer provide things removed from C++17, so I think this should be fixed even though I'm using a highly experimental, unsupported setup.

[1] https://en.cppreference.com/w/cpp/utility/functional/binary_function

Reproducible: Always

Steps to Reproduce:
1. Switch to Clang-15 with libcxx as build toolchain
2. Try to build app-office/libreoffice

Actual Results:  
Clucene headers can no longer be used with Clang-15 and libcxx.

Expected Results:  
Clucene should be usable with Clang-15 and libcxx.
Comment 1 Manuel Nickschas 2022-09-08 12:34:13 UTC
Created attachment 803950 [details]
emerge.info
Comment 2 Manuel Nickschas 2023-03-24 09:22:00 UTC
Created attachment 858825 [details, diff]
remoe-binary-function.patch

With clang-16, Clucene itself no longer builds for the same reason of using std::binary_function, most likely because the default language standard was bumped to C++17. So it's no longer just about exposing deprecated language features in public headers.

Attached patch fixes the issues for me. It's my understanding that std::binary_function (and std::unary_function, for that matter) can just be removed in modern versions of C++.
Comment 3 hugegameartgd 2023-04-10 23:16:47 UTC
Same error with clang-17, see https://github.com/gentoo/gentoo/pull/30547
Comment 4 Seryoga Leshii 2023-05-06 12:13:59 UTC
As a workaround, you can add -D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES or -stdlib=libstdc++ to CXXFLAGS while building clucene.
Comment 5 Alec Ari 2023-05-20 05:32:11 UTC
(In reply to Seryoga Leshii from comment #4)
> As a workaround, you can add -D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES or
> -stdlib=libstdc++ to CXXFLAGS while building clucene.

Thank you! This got inkscape working for me too with clang 16 :D
Comment 6 Larry the Git Cow gentoo-dev 2023-06-28 21:14:36 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1ba9c12d6ed1d6054c055bea8480e2d0132ae8eb

commit 1ba9c12d6ed1d6054c055bea8480e2d0132ae8eb
Author:     LinuxUserGD <hugegameartgd@gmail.com>
AuthorDate: 2023-04-10 22:01:01 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-06-28 21:13:55 +0000

    dev-cpp/clucene: fix removed std::binary_function in c++17
    
    Closes: https://bugs.gentoo.org/853298
    Closes: https://bugs.gentoo.org/869170
    Signed-off-by: LinuxUserGD <hugegameartgd@gmail.com>
    Closes: https://github.com/gentoo/gentoo/pull/30547
    Signed-off-by: Sam James <sam@gentoo.org>

 ...2.3.3.4-r8.ebuild => clucene-2.3.3.4-r9.ebuild} |   1 +
 .../clucene-2.3.3.4-fix-binary-function.patch      | 199 +++++++++++++++++++++
 2 files changed, 200 insertions(+)