gmarcais/Jellyfish

build failure with gcc-12

emollier opened this issue · 2 comments

Greetings,

with the recent introduction of Gcc 12 in Debian experimental, Matthias Klose noticed in Debian Bug#1012953 that Jellyfish fails to build from source using g++-12. Relevant part of the build log looks to be:

g++ -DHAVE_CONFIG_H -I.  -Wall -Wnon-virtual-dtor -I. -I./include  -DJSON_IS_AMALGAMATION=1 -Wdate-time -D_FORTIFY_SOURCE=2   -Werror -I./unit_tests/gtest/include -I./unit_tests -I./include -Wno-unused-variable -std=c++11 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wno-nonnull -c -o unit_tests/bin_test_all-test_misc.o `test -f 'unit_tests/test_misc.cc' || echo './'`unit_tests/test_misc.cc
In file included from unit_tests/test_misc.cc:6:
unit_tests/test_misc.cc: In member function ‘virtual void {anonymous}::BinarySearchFirst_Int_Test::TestBody()’:
unit_tests/test_misc.cc:73:68: error: ‘std::binder2nd<_Operation> std::bind2nd(const _Operation&, const _Tp&) [with _Operation = less<int>; _Tp = int]’ is deprecated: use 'std::bind' instead [-Werror=deprecated-declarations]
   73 |                                                        std::bind2nd(std::less<int>(), i)));
      |                                                        ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
./unit_tests/gtest/gtest.h:19418:52: note: in definition of macro ‘GTEST_ASSERT_’
19418 |   if (const ::testing::AssertionResult gtest_ar = (expression)) \
      |                                                    ^~~~~~~~~~
./unit_tests/gtest/gtest.h:19503:3: note: in expansion of macro ‘GTEST_PRED_FORMAT2_’
19503 |   GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
      |   ^~~~~~~~~~~~~~~~~~~
./unit_tests/gtest/gtest.h:19748:3: note: in expansion of macro ‘EXPECT_PRED_FORMAT2’
19748 |   EXPECT_PRED_FORMAT2(::testing::internal:: \
      |   ^~~~~~~~~~~~~~~~~~~
unit_tests/test_misc.cc:72:5: note: in expansion of macro ‘EXPECT_EQ’
   72 |     EXPECT_EQ(i, *jellyfish::binary_search_first_false(jellyfish::pointer_integer<int>(0), jellyfish::pointer_integer<int>(size),
      |     ^~~~~~~~~
In file included from /usr/include/c++/12/bits/stl_function.h:1438,
                 from /usr/include/c++/12/functional:49,
                 from unit_tests/test_misc.cc:4:
/usr/include/c++/12/backward/binders.h:172:5: note: declared here
  172 |     bind2nd(const _Operation& __fn, const _Tp& __x)
      |     ^~~~~~~

If I trust the porting guide of Gcc 12, this might be a case of:

The std::unary_function and std::binary_function base classes can often be completely removed, or the typedefs for result_type and argument types can be defined directly in your class.

But I don't know how to translate that into a fix for the moment.

For information,
Étienne.

That should be fixed in the develop branch. Can you give it a try?

Hi gmarcais,

Thank you for your work on this, I tested the develop branch in debian built with gcc-12, and I confirm the software: builds successfully, passes unit tests, and passes our own test suite "autopkgtest".

Have a nice day, :)
Étienne.