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

Build failure: or-tools #256266

Closed
vincentbernat opened this issue Sep 20, 2023 · 2 comments
Closed

Build failure: or-tools #256266

vincentbernat opened this issue Sep 20, 2023 · 2 comments
Labels
0.kind: build failure A package fails to build

Comments

@vincentbernat
Copy link
Member

Steps To Reproduce

Steps to reproduce the behavior:

  1. build or-tools

Build log

error: builder for '/nix/store/2xbxzl34x3pa1008qap8lxnc4kk9akcq-or-tools-9.4.drv' failed with exit code 2;
       last 25 log lines:
       >                  from /build/source/ortools/lp_data/lp_parser.cc:14:
       > /build/source/ortools/graph/iterators.h:105:19: warning: 'template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator' is deprecated [-Wdeprecated-declarations]
       >   105 |     : public std::iterator<std::input_iterator_tag, IntegerType> {
       >       |                   ^~~~~~~~
       > In file included from /nix/store/n8dryz4xf7ln028j37zapgzg4j47p743-gcc-12.3.0/include/c++/12.3.0/string:45,
       >                  from /build/source/ortools/lp_data/lp_parser.h:79:
       > /nix/store/n8dryz4xf7ln028j37zapgzg4j47p743-gcc-12.3.0/include/c++/12.3.0/bits/stl_iterator_base_types.h:127:34: note: declared here
       >   127 |     struct _GLIBCXX17_DEPRECATED iterator
       >       |                                  ^~~~~~~~
       > /build/source/ortools/lp_data/lp_parser.cc: In member function 'bool operations_research::glop::{anonymous}::LPParser::ParseConstraint(operations_research::glop::{anonymous}::StringPiece)':
       > /build/source/ortools/lp_data/lp_parser.cc:190:63: error: 'using StringPiece = using StringPiece = using string_view = using string_view = class std::basic_string_view<char>' {aka 'class std::basic_string_view<char>'} has no member named 'as_string'
       >   190 |       ::operations_research::glop::ParseConstraint(constraint.as_string());
       >       |                                                               ^~~~~~~~~
       > /build/source/ortools/lp_data/lp_parser.cc: In function 'absl::lts_20210324::StatusOr<operations_research::glop::ParsedConstraint> operations_research::glop::ParseConstraint(absl::lts_20210324::string_view)':
       > /build/source/ortools/lp_data/lp_parser.cc:419:60: error: 'using StringPiece = using StringPiece = using string_view = using string_view = class std::basic_string_view<char>' {aka 'class std::basic_string_view<char>'} has no member named 'as_string'
       >   419 |           "End of input was expected, found: ", constraint.as_string()));
       >       |                                                            ^~~~~~~~~
       > make[2]: *** [ortools/lp_data/CMakeFiles/ortools_lp_data.dir/build.make:118: ortools/lp_data/CMakeFiles/ortools_lp_data.dir/lp_parser.cc.o] Error 1
       > make[2]: *** Waiting for unfinished jobs....
       > make[1]: *** [CMakeFiles/Makefile2:1553: ortools/lp_data/CMakeFiles/ortools_lp_data.dir/all] Error 2
       > make[1]: *** Waiting for unfinished jobs....
       > [ 34%] Building CXX object ortools/port/CMakeFiles/ortools_port.dir/file.cc.o
       > [ 34%] Building CXX object ortools/port/CMakeFiles/ortools_port.dir/sysinfo.cc.o
       > [ 34%] Built target ortools_port
       > make: *** [Makefile:146: all] Error 2
       For full logs, run 'nix log /nix/store/2xbxzl34x3pa1008qap8lxnc4kk9akcq-or-tools-9.4.drv'.

Additional context

I have tried to update to 9.7 which should fixes the issue. Unfortunately, it requires pybind11_protobuf which is not packaged yet.

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 6.5.0-1-amd64, Debian GNU/Linux, noversion`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.17.0`
 - channels(bernat): `"home-manager, nixpkgs-22.05pre340506.5c37ad87222"`
 - nixpkgs: `/home/bernat/.nix-defexpr/channels/nixpkgs`
@vincentbernat vincentbernat added the 0.kind: build failure A package fails to build label Sep 20, 2023
@lopsided98
Copy link
Contributor

I've been working on fixing/updating or-tools, but it isn't easy. pybind11_protobuf lacks a fully functional CMake build system (it primarily uses Bazel). Previously, it couldn't find system installations of its dependencies, but I fixed that in pybind/pybind11_protobuf#128.

I then discovered that the CMake build didn't support installing the package, so I started working on fixing that here: https://github.com/lopsided98/pybind11_protobuf/commits/cmake-install. This mostly works, and should be enough to get the package working in nixpkgs, but there is one issue preventing me from submitting it upstream. pybind11_protobuf relies on a header (proto_api.h) that is not installed by protobuf (upstream refuses to fix this because it's "deprecated": protocolbuffers/protobuf#9464). To work around this, pybind11_protobuf takes the header from protobuf_SOURCE_DIR, which works fine if I point protobuf_SOURCE_DIR at a Nix store path. The problem arises when pybind11_protobuf is built as an external project as part of the or-tools build (which we don't care about but have to support to submit this upstream), CMake complains because protobuf_SOURCE_DIR is in the build directory:

CMake Error in build/_deps/pybind11_protobuf-src/CMakeLists.txt:
  Target "pybind11_wrapped_proto_caster" INTERFACE_INCLUDE_DIRECTORIES
  property contains path:

    "/home/runner/work/or-tools/or-tools/build/_deps/protobuf-src"

  which is prefixed in the build directory.

There is no way to disable this check, so I'm not sure how to proceed. Even after this is fixed, or-tools will still need a patch to support a system installation of pybind11_protobuf.

I could just apply a bunch of non-upstreamable patches in nixpkgs, but I'm not fond of that approach. As a stopgap, I plan to make Python support optional and update to 9.7 with Python support marked as broken.

hzeller added a commit to hzeller/nixpkgs that referenced this issue Oct 1, 2023
Fixes NixOS#256266
Don't use non-existent member function on string_view.
(StringPiece and string_view are almost the same looks like they
are typedef'd to the same string_view. StringPiece used to have
a as_string() member)
@wegank wegank closed this as completed in ae3ea8c Oct 1, 2023
@lopsided98
Copy link
Contributor

It still fails to cross-compile. It seems to be using the wrong Abseil version (a version that includes abseil/abseil-cpp@6acb60c):

/build/source/ortools/base/logging.cc:1272:30: error: expected initializer before 'EXCLUSIVE_LOCKS_REQUIRED'
 1272 | void LogMessage::SendToLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~
/build/source/ortools/base/logging.cc:1396:31: error: expected initializer before 'EXCLUSIVE_LOCKS_REQUIRED'
 1396 | void LogMessage::SendToSink() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~
/build/source/ortools/base/logging.cc:1409:37: error: expected initializer before 'EXCLUSIVE_LOCKS_REQUIRED'
 1409 | void LogMessage::SendToSinkAndLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~
/build/source/ortools/base/logging.cc:1415:36: error: expected initializer before 'EXCLUSIVE_LOCKS_REQUIRED'
 1415 | void LogMessage::SaveOrSendToLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~~
/build/source/ortools/base/logging.cc:1429:40: error: expected initializer before 'EXCLUSIVE_LOCKS_REQUIRED'
 1429 | void LogMessage::WriteToStringAndLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
      |                                        ^~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [ortools/base/CMakeFiles/ortools_base.dir/build.make:132: ortools/base/CMakeFiles/ortools_base.dir/logging.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1293: ortools/base/CMakeFiles/ortools_base.dir/all] Error 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: build failure A package fails to build
Projects
None yet
Development

No branches or pull requests

2 participants