google / s2geometry

Computational geometry and spatial indexing on the sphere
http://s2geometry.io/
Apache License 2.0
2.29k stars 302 forks source link

Cannot build with cmake -DGTEST_ROOT=/usr/src/gtest -DCMAKE_PREFIX_PATH=/path/to/absl/install -DCMAKE_CXX_STANDARD=11 .. #255

Closed Jiboxiake closed 2 years ago

Jiboxiake commented 2 years ago

I tried to run this command but it keeps throwing

CMake Error at CMakeLists.txt:70 (find_package):
  By not providing "Findabsl.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "absl", but
  CMake did not find one.

  Could not find a package configuration file provided by "absl" with any of
  the following names:

    abslConfig.cmake
    absl-config.cmake

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

I have followed the steps pointed to by the link to install abseil except I couldn't build with /temporary/build/abseil-cpp but only with /build/abseil-cpp. I don't know if this is related.

jmr commented 2 years ago

What are the exact command lines you used to configure/compile/install absl/s2?

Jiboxiake commented 2 years ago

For S2 it is exactly the same as the one from the readme. For Absl, first I want to point out your setup page https://s2geometry.io/about/platforms never mentioned anything about that. So I first followed the steps from https://abseil.io/docs/cpp/quickstart-cmake . I tried to follow the link S2 has on the build section but I have no clue what they are trying to do there. Are they trying to install GoogleTest and S2 and compile them? It seems like they never mentioned. So in short, I followed the instructions on your Github page and followed the abseil cmake setup.

jmr commented 2 years ago

You need to replace /path/to/absl/install with the path that you actually used to install absl -- whatever you used for CMAKE_INSTALL_PREFIX with absl.

Don't look at https://s2geometry.io/about/platforms; it hasn't been updated to talk about absl.

https://github.com/google/s2geometry/blob/master/README.md#building has the s2 side of things. https://abseil.io/docs/cpp/tools/cmake-installs is for absl.

craigds commented 2 years ago

I also struggled with the build instructions; with no background for what googletest or abseil are or why they're required it's quite confusing.

In case it helps point you in the right direction, I finally managed to write this Dockerfile which builds a python wheel of our fork of s2-py, including installing and building abseil and s2geometry: https://github.com/koordinates/s2-py/blob/master/Dockerfile

Jiboxiake commented 2 years ago

Thank you all! That helps.