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

Mismatch C++ requirements abseil/protobuf/or-tools on gentoo #3939

Closed
andreili opened this issue Oct 7, 2023 · 23 comments
Closed

Mismatch C++ requirements abseil/protobuf/or-tools on gentoo #3939

andreili opened this issue Oct 7, 2023 · 23 comments
Assignees
Milestone

Comments

@andreili
Copy link

andreili commented Oct 7, 2023

Version: main / v9.7 / v9.6 / v9.5 / v9.4
Language: C++
OS: Gentoo Linux
Abseil-cpp library: v20230125.3-r1 / v20230802.0 / v20230802.1

I see a wall of error on BOP solver with invalid cast: https://pastebin.com/dypXALX0 ("error: no match for ‘operator=’ (operand types are ‘std::string’ {aka ‘std::__cxx11::basic_string’} and ‘absl::lts_20230125::string_view’)").
I check it with all specified version of both library - this is stable error...

Full compilation log - on pastebin link.

@lperron
Copy link
Collaborator

lperron commented Oct 7, 2023

Are you compiling with c++17 enabled?

@Mizux Mizux self-assigned this Oct 7, 2023
@Mizux
Copy link
Collaborator

Mizux commented Oct 7, 2023

Do you have the ebuild used to compile abseil-cpp i.e. was it built using -std=c++17 ?

@andreili
Copy link
Author

andreili commented Oct 7, 2023

@Mizux @lperron
Hm, abseil-cpp ebuild using C++14 for re2, qtwebengine and etc libraries - gentoo/gentoo#32281
I change local version of ebuild for abseil-cpp for C++17 and or-tools package build failed with other errors...

FAILED: ortools/constraint_solver/CMakeFiles/ortools_constraint_solver.dir/routing_decision_builders.cc.o 
/usr/bin/x86_64-pc-linux-gnu-g++ -DOR_TOOLS_AS_DYNAMIC_LIB -DUSE_BOP -DUSE_CBC -DUSE_CLP -DUSE_GLOP -DUSE_LP_PARSER -DUSE_PDLP -I/var/tmp/portage/dev-cpp/or-tools-9.7/work/or-tools-9.7 -I/var/tmp/portage/dev-cpp/or-tools-9.7/work/or-tools-9.7_build  -O3 -pipe -march=native -std=c++17 -fPIC -fwrapv -MD -MT ortools/constraint_solver/CMakeFiles/ortools_constraint_solver.dir/routing_decision_builders.cc.o -MF ortools/constraint_solver/CMakeFiles/ortools_constraint_solver.dir/routing_decision_builders.cc.o.d -o ortools/constraint_solver/CMakeFiles/ortools_constraint_solver.dir/routing_decision_builders.cc.o -c /var/tmp/portage/dev-cpp/or-tools-9.7/work/or-tools-9.7/ortools/constraint_solver/routing_decision_builders.cc
In file included from /var/tmp/portage/dev-cpp/or-tools-9.7/work/or-tools-9.7/ortools/graph/graph.h:174,
                 from /var/tmp/portage/dev-cpp/or-tools-9.7/work/or-tools-9.7/ortools/constraint_solver/routing.h:188,
                 from /var/tmp/portage/dev-cpp/or-tools-9.7/work/or-tools-9.7/ortools/constraint_solver/routing_decision_builders.h:24,
                 from /var/tmp/portage/dev-cpp/or-tools-9.7/work/or-tools-9.7/ortools/constraint_solver/routing_decision_builders.cc:14:
/var/tmp/portage/dev-cpp/or-tools-9.7/work/or-tools-9.7/ortools/graph/iterators.h:106:19: warning: ‘template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator’ is deprecated [-Wdeprecated-declarations]
  106 |     : public std::iterator<std::input_iterator_tag, IntegerType> {
      |                   ^~~~~~~~
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/stl_algobase.h:65,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/vector:62,
                 from /var/tmp/portage/dev-cpp/or-tools-9.7/work/or-tools-9.7/ortools/constraint_solver/routing_decision_builders.h:19:
/usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/stl_iterator_base_types.h:127:34: note: declared here
  127 |     struct _GLIBCXX17_DEPRECATED iterator
      |                                  ^~~~~~~~
In file included from /usr/include/absl/log/internal/strip.h:24,
                 from /usr/include/absl/log/internal/check_op.h:37,
                 from /usr/include/absl/log/internal/check_impl.h:19,
                 from /usr/include/absl/log/check.h:37,
                 from /var/tmp/portage/dev-cpp/or-tools-9.7/work/or-tools-9.7/ortools/base/logging.h:23,
                 from /var/tmp/portage/dev-cpp/or-tools-9.7/work/or-tools-9.7/ortools/constraint_solver/constraint_solver.h:93,
                 from /var/tmp/portage/dev-cpp/or-tools-9.7/work/or-tools-9.7/ortools/constraint_solver/routing_decision_builders.h:23:
/usr/include/absl/log/internal/log_message.h: In instantiation of ‘absl::lts_20230802::log_internal::LogMessage& absl::lts_20230802::log_internal::LogMessage::operator<<(const T&) [with T = operations_research::sat::CpSolverResponse; typename std::enable_if<(! absl::lts_20230802::strings_internal::HasAbslStringify<T>::value), int>::type <anonymous> = 0]’:
/var/tmp/portage/dev-cpp/or-tools-9.7/work/or-tools-9.7/ortools/constraint_solver/routing_lp_scheduling.h:592:16:   required from here
/usr/include/absl/log/internal/log_message.h:301:17: error: no match for ‘operator<<’ (operand types are ‘std::ostream’ {aka ‘std::basic_ostream<char>’} and ‘const operations_research::sat::CpSolverResponse’)
  301 |   view.stream() << log_internal::NullGuard<T>().Guard(v);
      |   ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@lperron
Copy link
Collaborator

lperron commented Oct 7, 2023 via email

@andreili
Copy link
Author

andreili commented Oct 7, 2023

@lperron
Protobuf is compiled with default version of C++, without "-std=..." option. Default it's a C++11?
For protobuf, using autotools and "./configure" script for configuration. For or-tools and abseil-cpp - CMake.

@lperron
Copy link
Collaborator

lperron commented Oct 7, 2023 via email

@andreili
Copy link
Author

andreili commented Oct 7, 2023

@lperron
... only in few options don't sets...
On ebuild, I see next configuration command for protobuf, with depedency ignoring flag:

/var/tmp/portage/dev-libs/protobuf-21.9/work/protobuf-21.9/configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --datarootdir=/usr/share --disable-dependency-tracking --disable-silent-rules --disable-static --docdir=/usr/share/doc/protobuf-21.9 --htmldir=/usr/share/doc/protobuf-21.9/html --with-sysroot=/ --libdir=/usr/lib64 --disable-static --with-zlib

@lperron
Copy link
Collaborator

lperron commented Oct 7, 2023 via email

@lperron lperron changed the title Compilation failed with GCC-13.2 Mismatch C++ requirements abseil/protobuf/or-tools on gentoo Oct 8, 2023
@Mizux
Copy link
Collaborator

Mizux commented Oct 10, 2023

IIRC Protobuf use abseil-cpp since v22 so you must upgrade your Protobuf version accordingly (seems you are using the 21.9)...
note: main currently use Protobuf v24.4 (we always try to use the latest available version of our deps (kind of rolling release library))

Protobuf=v24.4
abseil-cpp=20230802.0

ref: https://github.com/protocolbuffers/protobuf/releases/tag/v22.0

ps: this issue is similar to conda-forge/or-tools-feedstock#47 where you could find useful information IMHO

@andreili
Copy link
Author

@Mizux abseil-cpp force compiled with C++14 features.
abseil-cpp: 20230802.0
re2: 0.2023.09.01
protobuf: 23.3-r2
or-tools: latest from git
With default options for Abseil-cpp (C++14), I see incompatibles conversion for string_view's.
With custom ebuild for Abseil-cpp (C++17) - I see another invalid conversions:

   79 |   std::string result = absl::StrCat("CutData rhs=", rhs, "\n");
      |                        ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
...
/usr/include/absl/strings/str_cat.h:468:8: error: invalid ‘static_cast’ from type ‘const absl::lts_20230802::int128’ to type ‘const absl::lts_20230802::AlphaNum&’
  468 |        static_cast<const AlphaNum&>(args).Piece()...});
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/absl/strings/str_cat.h:466:37: error: could not convert ‘{(& a)->absl::lts_20230802::AlphaNum::Piece(), (& b)->absl::lts_20230802::AlphaNum::Piece(), (& c)->absl::lts_20230802::AlphaNum::Piece(), (& d)->absl::lts_20230802::AlphaNum::Piece(), (& e)->absl::lts_20230802::AlphaNum::Piece(), <expression error>}’ from ‘<brace-enclosed initializer list>’ to ‘std::initializer_list<std::basic_string_view<char> >’
  466 |   return strings_internal::CatPieces(
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
      |                                     |
      |                                     <brace-enclosed initializer list>
  467 |       {a.Piece(), b.Piece(), c.Piece(), d.Piece(), e.Piece(),
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  468 |        static_cast<const AlphaNum&>(args).Piece()...});
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@jtremesay
Copy link

With custom ebuild for Abseil-cpp (C++17) - I see another invalid conversions:

I have the same error on archlinux

abseil-cpp: 20230802, compiled with -DCMAKE_CXX_STANDARD=17 (cf PKGBUILD)
re2: 20230901, compiled with make as indicated in the doc (cf PKGPUILD)
or-tools: 9.7 (cf PKGBUILD. PKGBUILD is for v9.6 but I have the error with both versions)
gcc: gcc (GCC) 13.2.1 20230801

FYI, I don't have the error if I build or-tools with -DBUILD_DEPS=ON. But since Arch already provides the libs, I want to make it work with -DBUILD_DEPS=OFF.

[ 78%] Building CXX object ortools/sat/CMakeFiles/ortools_sat.dir/linear_propagation.cc.o
/home/jtremesay/projects/kfpgafactory/arch/or-tools/src/or-tools-9.7/ortools/sat/cuts.cc: In member function ‘std::string operations_research::sat::CutData::DebugString() const’:
/home/jtremesay/projects/kfpgafactory/arch/or-tools/src/or-tools-9.7/ortools/sat/cuts.cc:79:36: error: no matching function for call to ‘StrCat(const char [13], const absl::lts_20230802::int128&, const char [2])’
   79 |   std::string result = absl::StrCat("CutData rhs=", rhs, "\n");
      |                        ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/absl/container/internal/layout.h:176,
                 from /usr/include/absl/container/internal/btree.h:67,
                 from /usr/include/absl/container/btree_map.h:56,
                 from /home/jtremesay/projects/kfpgafactory/arch/or-tools/src/or-tools-9.7/ortools/sat/cuts.h:27:
/usr/include/absl/strings/str_cat.h:463:41: note: candidate: ‘template<class ... AV> std::string absl::lts_20230802::StrCat(const AlphaNum&, const AlphaNum&, const AlphaNum&, const AlphaNum&, const AlphaNum&, const AV& ...)’
  463 | ABSL_MUST_USE_RESULT inline std::string StrCat(
      |                                         ^~~~~~
/usr/include/absl/strings/str_cat.h:463:41: note:   template argument deduction/substitution failed:
/home/jtremesay/projects/kfpgafactory/arch/or-tools/src/or-tools-9.7/ortools/sat/cuts.cc:79:36: note:   candidate expects at least 5 arguments, 3 provided
   79 |   std::string result = absl::StrCat("CutData rhs=", rhs, "\n");
      |                        ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/absl/strings/str_cat.h:449:41: note: candidate: ‘std::string absl::lts_20230802::StrCat()’
  449 | ABSL_MUST_USE_RESULT inline std::string StrCat() { return std::string(); }
      |                                         ^~~~~~
/usr/include/absl/strings/str_cat.h:449:41: note:   candidate expects 0 arguments, 3 provided
/usr/include/absl/strings/str_cat.h:451:41: note: candidate: ‘std::string absl::lts_20230802::StrCat(const AlphaNum&)’
  451 | ABSL_MUST_USE_RESULT inline std::string StrCat(const AlphaNum& a) {
      |                                         ^~~~~~
/usr/include/absl/strings/str_cat.h:451:41: note:   candidate expects 1 argument, 3 provided
/usr/include/absl/strings/str_cat.h:455:34: note: candidate: ‘std::string absl::lts_20230802::StrCat(const AlphaNum&, const AlphaNum&)’
  455 | ABSL_MUST_USE_RESULT std::string StrCat(const AlphaNum& a, const AlphaNum& b);
      |                                  ^~~~~~
/usr/include/absl/strings/str_cat.h:455:34: note:   candidate expects 2 arguments, 3 provided
/usr/include/absl/strings/str_cat.h:456:34: note: candidate: ‘std::string absl::lts_20230802::StrCat(const AlphaNum&, const AlphaNum&, const AlphaNum&)’
  456 | ABSL_MUST_USE_RESULT std::string StrCat(const AlphaNum& a, const AlphaNum& b,
      |                                  ^~~~~~
/usr/include/absl/strings/str_cat.h:456:76: note:   no known conversion for argument 2 from ‘const absl::lts_20230802::int128’ to ‘const absl::lts_20230802::AlphaNum&’
  456 | ABSL_MUST_USE_RESULT std::string StrCat(const AlphaNum& a, const AlphaNum& b,
      |                                                            ~~~~~~~~~~~~~~~~^
/usr/include/absl/strings/str_cat.h:458:34: note: candidate: ‘std::string absl::lts_20230802::StrCat(const AlphaNum&, const AlphaNum&, const AlphaNum&, const AlphaNum&)’
  458 | ABSL_MUST_USE_RESULT std::string StrCat(const AlphaNum& a, const AlphaNum& b,
      |                                  ^~~~~~
/usr/include/absl/strings/str_cat.h:458:34: note:   candidate expects 4 arguments, 3 provided
/usr/include/absl/strings/str_cat.h: In instantiation of ‘std::string absl::lts_20230802::StrCat(const AlphaNum&, const AlphaNum&, const AlphaNum&, const AlphaNum&, const AlphaNum&, const AV& ...) [with AV = {int128, char [8], int, char [6], int, char [6], int}; std::string = std::__cxx11::basic_string<char>]’:
/home/jtremesay/projects/kfpgafactory/arch/or-tools/src/or-tools-9.7/ortools/sat/cuts.cc:2006:22:   required from here
/usr/include/absl/strings/str_cat.h:468:8: error: invalid ‘static_cast’ from type ‘const absl::lts_20230802::int128’ to type ‘const absl::lts_20230802::AlphaNum&’
  468 |        static_cast<const AlphaNum&>(args).Piece()...});
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/absl/strings/str_cat.h:466:37: error: could not convert ‘{(& a)->absl::lts_20230802::AlphaNum::Piece(), (& b)->absl::lts_20230802::AlphaNum::Piece(), (& c)->absl::lts_20230802::AlphaNum::Piece(), (& d)->absl::lts_20230802::AlphaNum::Piece(), (& e)->absl::lts_20230802::AlphaNum::Piece(), <expression error>}’ from ‘<brace-enclosed initializer list>’ to ‘std::initializer_list<std::basic_string_view<char> >’
  466 |   return strings_internal::CatPieces(
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
      |                                     |
      |                                     <brace-enclosed initializer list>
  467 |       {a.Piece(), b.Piece(), c.Piece(), d.Piece(), e.Piece(),
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  468 |        static_cast<const AlphaNum&>(args).Piece()...});
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@lperron
Copy link
Collaborator

lperron commented Oct 21, 2023 via email

@andreili
Copy link
Author

andreili commented Oct 22, 2023

@lperron
I compile all dependenciec with C++17 (protobuf, re2, abseil-cpp) - and get this error. Configuration command:

cmake -C /var/tmp/portage/dev-cpp/or-tools-9999/work/or-tools-9999_build/gentoo_common_config.cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_PREFIX=/usr/ -DUSE_SCIP=OFF -DBUILD_FLATZINC=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=/var/tmp/portage/dev-cpp/or-tools-9999/work/or-tools-9999_build/gentoo_toolchain.cmake /var/tmp/portage/dev-cpp/or-tools-9999/work/or-tools-9999

"gentoo_*.cmake" files owerride a paths and toolchain parameters only.
Error string with compilation command:

/usr/bin/x86_64-pc-linux-gnu-g++ -DOR_TOOLS_AS_DYNAMIC_LIB -DPROTOBUF_USE_DLLS -DUSE_BOP -DUSE_CBC -DUSE_CLP -DUSE_GLOP -DUSE_LP_PARSER -DUSE_PDLP -I/var/tmp/portage/dev-cpp/or-tools-9999/work/or-tools-9999 -I/var/tmp/portage/dev-cpp/or-tools-9999/work/or-tools-9999_build -isystem /usr/include/coin  -O3 -pipe -march=raptorlake -mabm -mno-cldemote -mno-kl -mno-sgx -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=48 --param=l2-cache-size=24576 -std=c++17 -fPIC -fwrapv -MD -MT ortools/sat/CMakeFiles/ortools_sat.dir/cuts.cc.o -MF ortools/sat/CMakeFiles/ortools_sat.dir/cuts.cc.o.d -o ortools/sat/CMakeFiles/ortools_sat.dir/cuts.cc.o -c /var/tmp/portage/dev-cpp/or-tools-9999/work/or-tools-9999/ortools/sat/cuts.cc
In file included from /var/tmp/portage/dev-cpp/or-tools-9999/work/or-tools-9999/ortools/sat/integer.h:43,
                 from /var/tmp/portage/dev-cpp/or-tools-9999/work/or-tools-9999/ortools/sat/implied_bounds.h:31,
                 from /var/tmp/portage/dev-cpp/or-tools-9999/work/or-tools-9999/ortools/sat/cuts.h:35,
                 from /var/tmp/portage/dev-cpp/or-tools-9999/work/or-tools-9999/ortools/sat/cuts.cc:14:
/var/tmp/portage/dev-cpp/or-tools-9999/work/or-tools-9999/ortools/graph/iterators.h:106:19: warning: ‘template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator’ is deprecated [-Wdeprecated-declarations]
  106 |     : public std::iterator<std::input_iterator_tag, IntegerType> {
      |                   ^~~~~~~~
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/stl_algobase.h:65,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/algorithm:60,
                 from /var/tmp/portage/dev-cpp/or-tools-9999/work/or-tools-9999/ortools/sat/cuts.h:19:
/usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/stl_iterator_base_types.h:127:34: note: declared here
  127 |     struct _GLIBCXX17_DEPRECATED iterator
      |                                  ^~~~~~~~
/var/tmp/portage/dev-cpp/or-tools-9999/work/or-tools-9999/ortools/sat/cuts.cc: In member function ‘std::string operations_research::sat::CutData::DebugString() const’:
/var/tmp/portage/dev-cpp/or-tools-9999/work/or-tools-9999/ortools/sat/cuts.cc:79:36: error: no matching function for call to ‘StrCat(const char [13], const absl::lts_20230802::int128&, const char [2])’
   79 |   std::string result = absl::StrCat("CutData rhs=", rhs, "\n");
      |                        ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/absl/container/internal/layout.h:176,
                 from /usr/include/absl/container/internal/btree.h:67,
                 from /usr/include/absl/container/btree_map.h:56,
                 from /var/tmp/portage/dev-cpp/or-tools-9999/work/or-tools-9999/ortools/sat/cuts.h:27:
/usr/include/absl/strings/str_cat.h:463:41: note: candidate: ‘template<class ... AV> std::string absl::lts_20230802::StrCat(const AlphaNum&, const AlphaNum&, const AlphaNum&, const AlphaNum&, const AlphaNum&, const AV& ...)’

@lperron
Copy link
Collaborator

lperron commented Oct 22, 2023 via email

@andreili
Copy link
Author

andreili commented Oct 22, 2023

@lperron head of this branch - emerge fetch latest version from github on every build...
And save error with v9.7

@lperron
Copy link
Collaborator

lperron commented Oct 22, 2023 via email

@andreili
Copy link
Author

@lperron Hash, used for build - 1d696f9

@jtremesay
Copy link

I cannot. OR-Tools needs to be compiled with C++17

From what I see in the generated Makefiles, C++17 is used.

But to be sure, I recompiled it with

$ cmake -B build -DCMAKE_CXX_STANDARD=17 -DUSE_SCIP=OFF 
$ cmake --build build

Same error.

@lperron
Copy link
Collaborator

lperron commented Oct 23, 2023 via email

@Mizux
Copy link
Collaborator

Mizux commented Oct 23, 2023

@jtremesay We have a workflow to test or-tools build using distro deps and it's based on archlinux base image ;)

see: https://github.com/google/or-tools/actions/workflows/amd64_linux_cmake_system_deps.yml
src: https://github.com/google/or-tools/blob/stable/.github/workflows/amd64_linux_cmake_system_deps.yml

which call the Makefile (orchestrate docker cli commands) located in cmake/ dir

@echo -e "\t\t${BOLD}system_deps${RESET} (archlinux with all deps from pacman)"

Dockerfile here:
https://github.com/google/or-tools/tree/main/cmake/docker/system_deps

@jtremesay
Copy link

@Mizux

I had missed the step that say "Or-tools releases are locked with abseil releases and protobuf releases. They must be kept in sync.".

After checking, or-tools v9.7 needs abseil-cpp v20230125 but Arch provides v20230802. I managed to build my package using the main branch.

Thanks for the help!

@andreili
Copy link
Author

Ok.
I install required versions of protobuf - and all done. Thx...
And will waiting toget latest versions into gentoo repo - I create a custom ebuilds for this.

@lperron
Copy link
Collaborator

lperron commented Oct 24, 2023 via email

@Mizux Mizux added this to the v9.9 milestone Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants