0

The CMake build of google-cloud-cpp fails with this error:

$ cmake -H. -Bcmake-out
-- The CXX compiler identification is GNU 9.3.0
-- The C compiler identification is GNU 9.3.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at google/cloud/storage/CMakeLists.txt:17 (find_package):
  Could not find a package configuration file provided by
  "google_cloud_cpp_common" with any of the following names:

    google_cloud_cpp_commonConfig.cmake
    google_cloud_cpp_common-config.cmake

  Add the installation prefix of "google_cloud_cpp_common" to
  CMAKE_PREFIX_PATH or set "google_cloud_cpp_common_DIR" to a directory
  containing one of the above files.  If "google_cloud_cpp_common" provides a
  separate development package or SDK, be sure it has been installed.


-- Configuring incomplete, errors occurred!
Kevin
  • 16,549
  • 8
  • 60
  • 74
mortymacs
  • 3,456
  • 3
  • 27
  • 53
  • Is this the [repo](https://github.com/googleapis/google-cloud-cpp) you are trying to compile? – Kevin Mar 20 '20 at 15:45
  • @squareskittles https://github.com/googleapis/google-cloud-cpp yes – mortymacs Mar 20 '20 at 15:48
  • Ok, that repo has specific instructions for building on different environments (Mac, Linux, etc), did you follow those instructions? Specifically, `cmake -Hsuper -Bcmake-out`. Note, the *source* directory should be `super`, did you run your command from the `super` directory? – Kevin Mar 20 '20 at 15:53
  • In the `INSTALL.md` file they mentioned something else: https://github.com/googleapis/google-cloud-cpp/blob/master/INSTALL.md#installing-google-cloud-cpp – mortymacs Mar 20 '20 at 15:57
  • 1
    Yes, but the note in the `INSTALL.md` file says those commands **only** apply "*If all the dependencies of google-cloud-cpp are installed and provide CMake support files*". It appears you have *not* installed all of the dependencies. However, the same file has instructions for installing *specific* missing dependencies for each environment (Linux, Mac, etc.), so you probably need to *install* the missing `google_cloud_cpp_common`. – Kevin Mar 20 '20 at 16:00
  • Thank you so much, it works by `cmake -Hsuper -Bcmake-out`. – mortymacs Mar 20 '20 at 16:06
  • 1
    Glad it works! Added a response to more clearly explain things. – Kevin Mar 20 '20 at 16:16

1 Answers1

4

The CMake command:

cmake -H. -Bcmake-out

will only work well after you have installed all of the google-cloud-cpp dependencies. From the INSTALL.md file:

If all the dependencies of google-cloud-cpp are installed and provide CMake support files, then compiling and installing the libraries requires two commands:

cmake -H. -Bcmake-out
cmake --build cmake-out --target install

Unfortunately getting your system to this state may require multiple steps, the following sections describe how to install google-cloud-cpp on several platforms.

It goes on to describe how to install each of the dependencies individually, for several platforms. This is a painful process, but an easier approach is use the suggested CMake super-build, described in the main README.md file. This will download and build all of the google-cloud-cpp dependencies for you. Try the CMake super-build command instead:

cmake -Hsuper -Bcmake-out
Community
  • 1
  • 1
Kevin
  • 16,549
  • 8
  • 60
  • 74