Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev-cpp/clucene: fix removed std::binary_function in c++17 #30547

Closed
wants to merge 1 commit into from
Closed

dev-cpp/clucene: fix removed std::binary_function in c++17 #30547

wants to merge 1 commit into from

Conversation

LinuxUserGD
Copy link
Contributor

@LinuxUserGD LinuxUserGD commented Apr 10, 2023

dev-cpp/clucene: fix removed std::binary_function in c++17

Compilation fails with Clang (should be a warning with GCC):

In file included from /var/tmp/portage/dev-cpp/clucene-2.3.3.4-r8/work/clucene-core-2.3.3.4/src/contribs-lib/CLucene/highlighter/WeightedTerm.cpp:17:
In file included from /var/tmp/portage/dev-cpp/clucene-2.3.3.4-r8/work/clucene-core-2.3.3.4/src/core/CLucene/_ApiHeader.h:19:
In file included from /var/tmp/portage/dev-cpp/clucene-2.3.3.4-r8/work/clucene-core-2.3.3.4/src/core/CLucene/util/_VoidMap.h:18:
In file included from /var/tmp/portage/dev-cpp/clucene-2.3.3.4-r8/work/clucene-core-2.3.3.4/src/core/CLucene/util/VoidMap.h:10:
/var/tmp/portage/dev-cpp/clucene-2.3.3.4-r8/work/clucene-core-2.3.3.4/src/core/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>
                                                 ~~~~~~~~~~^~~~~~~~~~~~~~~~
                                                           __binary_function
/var/tmp/portage/dev-cpp/clucene-2.3.3.4-r8/work/clucene-core-2.3.3.4/src/shared/CLucene/SharedHeader.h:109:33: note: expanded from macro 'CL_NS_STD'
   #define CL_NS_STD(func) std::func
                           ~~~~~^

The patch replaces binary_function with typedefs.
Closes: https://bugs.gentoo.org/869170

@gentoo-bot gentoo-bot added maintainer-needed There is at least one affected package with no maintainer. Review it if you can. assigned PR successfully assigned to the package maintainer(s). no bug found No Bug/Closes found in the commits. no signoff One or more commits do not indicate GCO sign-off. labels Apr 10, 2023
@gentoo-repo-qa-bot
Copy link
Collaborator

Pull request CI report

Report generated at: 2023-04-10 22:48 UTC
Newest commit scanned: 20d8a16
Status: ✅ good

There are existing issues already. Please look into the report to make sure none of them affect the packages in question:
https://qa-reports.gentoo.org/output/gentoo-ci/c6e68bfccc/output.html

@LinuxUserGD LinuxUserGD changed the title dev-cpp/clucene: fix removed std::binary_function in c++17 [please reassign] dev-cpp/clucene: fix removed std::binary_function in c++17 Apr 10, 2023
@LinuxUserGD LinuxUserGD changed the title [please reassign] dev-cpp/clucene: fix removed std::binary_function in c++17 dev-cpp/clucene: fix removed std::binary_function in c++17 [please reassign] Apr 10, 2023
@gentoo-bot gentoo-bot changed the title dev-cpp/clucene: fix removed std::binary_function in c++17 [please reassign] dev-cpp/clucene: fix removed std::binary_function in c++17 Apr 10, 2023
@gentoo-bot gentoo-bot added maintainer-needed There is at least one affected package with no maintainer. Review it if you can. assigned PR successfully assigned to the package maintainer(s). no bug found No Bug/Closes found in the commits. and removed assigned PR successfully assigned to the package maintainer(s). maintainer-needed There is at least one affected package with no maintainer. Review it if you can. no bug found No Bug/Closes found in the commits. no signoff One or more commits do not indicate GCO sign-off. labels Apr 10, 2023
@gentoo-repo-qa-bot
Copy link
Collaborator

Pull request CI report

Report generated at: 2023-04-10 23:13 UTC
Newest commit scanned: 141e3b5
Status: ✅ good

There are existing issues already. Please look into the report to make sure none of them affect the packages in question:
https://qa-reports.gentoo.org/output/gentoo-ci/5f1ab01a87/output.html

@gentoo-repo-qa-bot
Copy link
Collaborator

Pull request CI report

Report generated at: 2023-04-10 23:53 UTC
Newest commit scanned: 70ca36f
Status: ✅ good

There are existing issues already. Please look into the report to make sure none of them affect the packages in question:
https://qa-reports.gentoo.org/output/gentoo-ci/cb3a28c4b4/output.html

@gentoo-repo-qa-bot
Copy link
Collaborator

Pull request CI report

Report generated at: 2023-04-11 01:08 UTC
Newest commit scanned: a37fa1f
Status: ✅ good

There are existing issues already. Please look into the report to make sure none of them affect the packages in question:
https://qa-reports.gentoo.org/output/gentoo-ci/fc47190d6e/output.html

@gentoo-repo-qa-bot
Copy link
Collaborator

Pull request CI report

Report generated at: 2023-04-11 18:18 UTC
Newest commit scanned: 0c51375
Status: ✅ good

There are existing issues already. Please look into the report to make sure none of them affect the packages in question:
https://qa-reports.gentoo.org/output/gentoo-ci/0d56a05c25/output.html

@LinuxUserGD LinuxUserGD changed the title dev-cpp/clucene: fix removed std::binary_function in c++17 [please reassign] dev-cpp/clucene: fix removed std::binary_function in c++17 Apr 15, 2023
@gentoo-bot gentoo-bot changed the title [please reassign] dev-cpp/clucene: fix removed std::binary_function in c++17 dev-cpp/clucene: fix removed std::binary_function in c++17 Apr 15, 2023
@gentoo-bot
Copy link

Pull Request assignment

Submitter: @LinuxUserGD
Areas affected: ebuilds
Packages affected: dev-cpp/clucene

dev-cpp/clucene: @gentoo/proxy-maint (maintainer needed)

Linked bugs

Bugs linked: 869170


In order to force reassignment and/or bug reference scan, please append [please reassign] to the pull request title.

Docs: Code of ConductCopyright policy (expl.) ● DevmanualGitHub PRsProxy-maint guide

@gentoo-bot gentoo-bot added maintainer-needed There is at least one affected package with no maintainer. Review it if you can. assigned PR successfully assigned to the package maintainer(s). and removed assigned PR successfully assigned to the package maintainer(s). maintainer-needed There is at least one affected package with no maintainer. Review it if you can. no bug found No Bug/Closes found in the commits. labels Apr 15, 2023
@gentoo-bot gentoo-bot added the bug linked Bug/Closes found in footer, and cross-linked with the PR. label Apr 15, 2023
@gentoo-repo-qa-bot
Copy link
Collaborator

Pull request CI report

Report generated at: 2023-04-15 17:23 UTC
Newest commit scanned: 62b7221
Status: ✅ good

There are existing issues already. Please look into the report to make sure none of them affect the packages in question:
https://qa-reports.gentoo.org/output/gentoo-ci/de2a491ebb/output.html

Copy link
Member

@juippis juippis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't compile this it seems,

FAILED: src/shared/CMakeFiles/clucene-shared.dir/CLucene/util/StringBuffer.o
/usr/bin/x86_64-pc-linux-gnu-g++ -DMAKE_CLUCENE_SHARED_LIB -Dclucene_shared_EXPORTS -I/var/tmp/portage/dev-cpp/clucene-2.3.3.4-r9/work/clucene-core-2.3.3.4/src/shared -I/var/tmp/portage/dev-cpp/clucene-2.3.3.4-r9/work/clucene-2.3.3.4_build/src/shared -I/var/tmp/portage/dev-cpp/    clucene-2.3.3.4-r9/work/clucene-core-2.3.3.4/src/core -I/var/tmp/portage/dev-cpp/clucene-2.3.3.4-r9/work/clucene-core-2.3.3.4/src/ext  -march=native -O2 -pipe -frecord-gcc-switches -fPIC -ansi -fvisibility=hidden -fvisibility-inlines-hidden -fPIC    -D_REENTRANT -D_UCS2 -          D_UNICODE -MD -MT src/shared/CMakeFiles/clucene-shared.dir/CLucene/util/StringBuffer.o -MF src/shared/CMakeFiles/clucene-shared.dir/CLucene/util/StringBuffer.o.d -o src/shared/CMakeFiles/clucene-shared.dir/CLucene/util/StringBuffer.o -c /var/tmp/portage/dev-cpp/clucene-2.3.3.4-r9/ work/clucene-core-2.3.3.4/src/shared/CLucene/util/StringBuffer.cpp
In file included from /var/tmp/portage/dev-cpp/clucene-2.3.3.4-r9/work/clucene-core-2.3.3.4/src/core/CLucene/util/VoidMap.h:10,
                 from /var/tmp/portage/dev-cpp/clucene-2.3.3.4-r9/work/clucene-core-2.3.3.4/src/core/CLucene/util/_VoidMap.h:18,
                 from /var/tmp/portage/dev-cpp/clucene-2.3.3.4-r9/work/clucene-core-2.3.3.4/src/core/CLucene/_ApiHeader.h:19,
                 from /var/tmp/portage/dev-cpp/clucene-2.3.3.4-r9/work/clucene-core-2.3.3.4/src/shared/CLucene/util/StringBuffer.cpp:7:
/var/tmp/portage/dev-cpp/clucene-2.3.3.4-r9/work/clucene-core-2.3.3.4/src/core/CLucene/util/Equators.h:28:23: error: expected nested-name-specifier before 'first_argument_type'
   28 |                 using first_argument_type       = const int32_t*;
      |                       ^~~~~~~~~~~~~~~~~~~ 
/var/tmp/portage/dev-cpp/clucene-2.3.3.4-r9/work/clucene-core-2.3.3.4/src/core/CLucene/util/Equators.h:29:23: error: expected nested-name-specifier before 'second_argument_type'
   29 |                 using second_argument_type      = const int32_t*;
      |                       ^~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-cpp/clucene-2.3.3.4-r9/work/clucene-core-2.3.3.4/src/core/CLucene/util/Equators.h:30:23: error: expected nested-name-specifier before 'result_type'
   30 |                 using result_type               = bool;
      |                       ^~~~~~~~~~~ 
/var/tmp/portage/dev-cpp/clucene-2.3.3.4-r9/work/clucene-core-2.3.3.4/src/core/CLucene/util/Equators.h:37:23: error: expected nested-name-specifier before 'first_argument_type'
   37 |                 using first_argument_type       = const char*;
      |                       ^~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-cpp/clucene-2.3.3.4-r9/work/clucene-core-2.3.3.4/src/core/CLucene/util/Equators.h:38:23: error: expected nested-name-specifier before 'second_argument_type'
   38 |                 using second_argument_type      = const char*;
      |                       ^~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-cpp/clucene-2.3.3.4-r9/work/clucene-core-2.3.3.4/src/core/CLucene/util/Equators.h:39:23: error: expected nested-name-specifier before 'result_type'
   39 |                 using result_type               = bool;
      |                       ^~~~~~~~~~~
/var/tmp/portage/dev-cpp/clucene-2.3.3.4-r9/work/clucene-core-2.3.3.4/src/core/CLucene/util/Equators.h:46:23: error: expected nested-name-specifier before 'first_argument_type'
   46 |                 using first_argument_type       = const wchar_t*;
      |                       ^~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-cpp/clucene-2.3.3.4-r9/work/clucene-core-2.3.3.4/src/core/CLucene/util/Equators.h:47:23: error: expected nested-name-specifier before 'second_argument_type'
   47 |                 using second_argument_type      = const wchar_t*;
      |                       ^~~~~~~~~~~~~~~~~~~~ 
/var/tmp/portage/dev-cpp/clucene-2.3.3.4-r9/work/clucene-core-2.3.3.4/src/core/CLucene/util/Equators.h:48:23: error: expected nested-name-specifier before 'result_type'
   48 |                 using result_type               = bool;
      |                       ^~~~~~~~~~~
/var/tmp/portage/dev-cpp/clucene-2.3.3.4-r9/work/clucene-core-2.3.3.4/src/core/CLucene/util/Equators.h:63:23: error: expected nested-name-specifier before 'first_argument_type'
   63 |                 using first_argument_type       = const void*;
      |                       ^~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-cpp/clucene-2.3.3.4-r9/work/clucene-core-2.3.3.4/src/core/CLucene/util/Equators.h:64:23: error: expected nested-name-specifier before 'second_argument_type'
   64 |                 using second_argument_type      = const void*;
      |                       ^~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-cpp/clucene-2.3.3.4-r9/work/clucene-core-2.3.3.4/src/core/CLucene/util/Equators.h:65:23: error: expected nested-name-specifier before 'result_type'
   65 |                 using result_type               = bool;
      |                       ^~~~~~~~~~~

and there are tons of errors.

@thesamesam
Copy link
Member

I need soap for this anyway as I don't know if it'll break ABI.

@the-horo
Copy link
Contributor

/usr/bin/x86_64-pc-linux-gnu-g++ /*snip*/ -ansi /*snip*/
And from g++ man:

-ansi
In C mode, this is equivalent to -std=c90. In C++ mode, it is equivalent to -std=c++98.

using first_argument_type = int32_t; is a c++ 11 feature. If we want to keep the features provided by std::binary_function though the codebase doesn't use them, but they may be used by other programs depending on the library, we would have to use old typedef. To make the change to the patch there is sed -i -e 's/using \(\w*_type\)\s*=\s*\(.*\);/typedef \2 \1;/' patch-file for a shortcut.

The -ansi logic only applies to g++, this is why the original patch fails when compiling with g++ but works fine when compiling with clang++. From ${W}/CMakeLists.txt:

SET(ENABLE_ANSI_MODE OFF)
IF(CMAKE_COMPILER_IS_GNUCXX)
  SET(ENABLE_ANSI_MODE ON)
  
  #exceptions:
  IF(MINGW OR CYGWIN)
    SET(ENABLE_ANSI_MODE OFF)
  ENDIF(MINGW OR CYGWIN)
ENDIF(CMAKE_COMPILER_IS_GNUCXX)

OPTION(ENABLE_ANSI_MODE
  "compile with -ansi flag"
  ${ENABLE_ANSI_MODE})

If this is true another solution would be to force c++98 for clang as well, which seems to work fine (no patch needed).

@the-horo
Copy link
Contributor

What I overlooked in the -std=c++98 solution is that the bug that this PR closes is about exposing invalid c++17 code in the header files, which will obviously require a patch to fix. It still sounds like a good idea, however, to have the ebuild add -std=c++98 to have some parity between gcc and clang users.

Closes: https://bugs.gentoo.org/869170
Signed-off-by: LinuxUserGD <hugegameartgd@gmail.com>
@thesamesam
Copy link
Member

Thanks. I've decided to just go with it, given it's terribly broken anyway.

@gentoo-repo-qa-bot
Copy link
Collaborator

Pull request CI report

Report generated at: 2023-06-28 21:20 UTC
Newest commit scanned: f38a7e7
Status: ✅ good

There are existing issues already. Please look into the report to make sure none of them affect the packages in question:
https://qa-reports.gentoo.org/output/gentoo-ci/7f2120fbd7/output.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assigned PR successfully assigned to the package maintainer(s). bug linked Bug/Closes found in footer, and cross-linked with the PR. maintainer-needed There is at least one affected package with no maintainer. Review it if you can.
Projects
None yet
6 participants