Skip to content

CMake: install target not working: fails: file INSTALL cannot find absl-config.cmake #1025

Closed

Description

I tried building and installing the source code from git (I tried both master and tags/v7.0-beta1 with the same error) on Mac OS, installing as dependencies only wget/cmake (using homebrew).

Configuring, building and even testing using the standard CMake workflow

mkdir build && cd build
cmake ..
make -j8

work fine (except for tons of warnings regarding the deprecated "register" keyword and some .cc-files without symbols).

However, running make install (or, equivalently, cmake --build . --target install) fails because the file build/abseil-cpp-src/CMake/absl-config.cmake is missing.
I tried to run

find build | grep absl-config

too see whether the file is present somewhere else, but there appears to be no such file in the build directory.

-- Installing: /usr/local/lib/cmake/protobuf/protobuf-module.cmake
-- Installing: /usr/local/lib/cmake/protobuf/protobuf-options.cmake
-- Installing: /usr/local/lib/cmake/protobuf/protobuf-config.cmake
-- Installing: /usr/local/lib/cmake/protobuf/protobuf-config-version.cmake
-- Installing: /usr/local/lib/cmake/absl/absl-targets.cmake
-- Installing: /usr/local/lib/cmake/absl/absl-targets-release.cmake
CMake Error at abseil-cpp-build/cmake_install.cmake:55 (file):
  file INSTALL cannot find
  "/Users/me/Source/or-tools/build/abseil-cpp-src/CMake/absl-config.cmake".
Call Stack (most recent call first):
  external/cmake_install.cmake:41 (include)
  cmake_install.cmake:103 (include)

If I manually add an empty file in its place, the install goes through without error. However, as expected, I cannot use ortools in my cmake project with an empty absl-config.cmake file installed:

find_package(ortools CONFIG REQUIRED)

yields the following error:

CMake Error at CMakeLists.txt:12 (find_package):
  Found package configuration file:

    /usr/local/lib/cmake/ortools/ortoolsConfig.cmake

  but it set ortools_FOUND to FALSE so package "ortools" is considered to be
  NOT FOUND.  Reason given by package:

  The following imported targets are referenced, but are missing:
  absl::absl_base absl::absl_container absl::absl_hash absl::absl_memory
  absl::absl_meta absl::absl_str_format absl::absl_strings
  absl::absl_synchronization absl::absl_types

I then proceeded to find absl-config.cmake in /patches (in the source directory).
This file seems to contain a syntax error at least in tags/v7.0-beta1 (missing closing parenthesis).
I guess something was supposed to copy that file to the build directory where install expects it; I did that manually, retried the install, and it worked.

I still had no luck consuming ortools cmake config files in my cmake project, still with the same error message as before.
Adding a
find_package(absl CONFIG REQUIRED)
before that fixed this issue, so that configuring, building and linking (in my own CMake project) against ortools::ortools now works.

Was I doing something wrong here, like missing a "patching" step when running cmake? Then that should maybe be included somewhere in the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions