google/s2geometry

Can't compile with the new version of abseil

ehsandu15 opened this issue · 6 comments

Environment information

System info

Linux pop-os 5.17.15-76051715-generic #202206141358165591911622.04~1db9e34 SMP PREEMPT Wed Jun 22 19 x86_64 x86_64 x86_64 GNU/Linux

CPU: inte i7-12700K @ 5.1GHz 20 threads

GPU: RTX 3070 Ti

Abseil compilation details

Abseil version: 20211102.0

First installed gtest from source at /usr/local/gtest, the generated make file using the following command in abseil directory:

cmake -S . -B build -DCMAKE_PREFIX_PATH=/usr/local/gtest -DCMAKE_INSTALL_PREFIX=/usr/local/absl -DABSL_ENABLE_INSTALL=ON -DABSL_USE_EXTERNAL_GOOGLETEST=ON -DABSL_FIND_GOOGLETEST=ON -DCMAKE_CXX_STANDARD=17 -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DABSL_BUILD_TESTING=ON

Then I ran all the tests(after compilation) and it passed, after that I did:

sudo make install

which installed abseil in /usr/local/absl

S2geometry compilation

I downloaded the 0.10.0 version from releases and generated the make file using:

cmake -DGTEST_ROOT=/usr/src/gtest -DCMAKE_PREFIX_PATH=/usr/local/absl -DCMAKE_CXX_STANDARD=17 ..

then after trying to compile I get the following linking error:

image

Hi,
I'm facing similar issue. The version fo abseil is 20210324.2.

[ 42%] Building CXX object CMakeFiles/s2.dir/src/s2/s2edge_crossings.cc.o
/gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/bin/c++ -DABSL_MIN_LOG_LEVEL=1 -Ds2_EXPORTS -I/tmp/guix-build-s2geometry-0.10.0.drv-0/source/src -O2 -g -DNDEBUG -fPIC   -Wno-attributes -Wno-deprecated-declarations -std=c++11 -MD -MT CMakeFiles/s2.dir/src/s2/s2edge_crossings.cc.o -MF CMakeFiles/s2.dir/src/s2/s2edge_crossings.cc.o.d -o CMakeFiles/s2.dir/src/s2/s2edge_crossings.cc.o -c /tmp/guix-build-s2geometry-0.10.0.drv-0/source/src/s2/s2edge_crossings.cc
In file included from /tmp/guix-build-s2geometry-0.10.0.drv-0/source/src/s2/s2closest_cell_query.h:30,
                 from /tmp/guix-build-s2geometry-0.10.0.drv-0/source/src/s2/s2closest_cell_query.cc:18:
/tmp/guix-build-s2geometry-0.10.0.drv-0/source/src/s2/s2closest_cell_query_base.h: In member function ‘size_t S2ClosestCellQueryBase<Distance>::LabelledCellHash::operator()(S2ClosestCellQueryBase<Distance>::LabelledCell) const’:
/tmp/guix-build-s2geometry-0.10.0.drv-0/source/src/s2/s2closest_cell_query_base.h:333:20: error: ‘HashOf’ is not a member of ‘absl’
  333 |       return absl::HashOf(x.cell_id.id(), x.label);
      |                    ^~~~~~
[ 43%] Building CXX object CMakeFiles/s2.dir/src/s2/s2edge_distances.cc.o
/gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/bin/c++ -DABSL_MIN_LOG_LEVEL=1 -Ds2_EXPORTS -I/tmp/guix-build-s2geometry-0.10.0.drv-0/source/src -O2 -g -DNDEBUG -fPIC   -Wno-attributes -Wno-deprecated-declarations -std=c++11 -MD -MT CMakeFiles/s2.dir/src/s2/s2edge_distances.cc.o -MF CMakeFiles/s2.dir/src/s2/s2edge_distances.cc.o.d -o CMakeFiles/s2.dir/src/s2/s2edge_distances.cc.o -c /tmp/guix-build-s2geometry-0.10.0.drv-0/source/src/s2/s2edge_distances.cc
[ 44%] Building CXX object CMakeFiles/s2.dir/src/s2/s2edge_tessellator.cc.o
/gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/bin/c++ -DABSL_MIN_LOG_LEVEL=1 -Ds2_EXPORTS -I/tmp/guix-build-s2geometry-0.10.0.drv-0/source/src -O2 -g -DNDEBUG -fPIC   -Wno-attributes -Wno-deprecated-declarations -std=c++11 -MD -MT CMakeFiles/s2.dir/src/s2/s2edge_tessellator.cc.o -MF CMakeFiles/s2.dir/src/s2/s2edge_tessellator.cc.o.d -o CMakeFiles/s2.dir/src/s2/s2edge_tessellator.cc.o -c /tmp/guix-build-s2geometry-0.10.0.drv-0/source/src/s2/s2edge_tessellator.cc
[ 45%] Building CXX object CMakeFiles/s2.dir/src/s2/s2furthest_edge_query.cc.o
/gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/bin/c++ -DABSL_MIN_LOG_LEVEL=1 -Ds2_EXPORTS -I/tmp/guix-build-s2geometry-0.10.0.drv-0/source/src -O2 -g -DNDEBUG -fPIC   -Wno-attributes -Wno-deprecated-declarations -std=c++11 -MD -MT CMakeFiles/s2.dir/src/s2/s2furthest_edge_query.cc.o -MF CMakeFiles/s2.dir/src/s2/s2furthest_edge_query.cc.o.d -o CMakeFiles/s2.dir/src/s2/s2furthest_edge_query.cc.o -c /tmp/guix-build-s2geometry-0.10.0.drv-0/source/src/s2/s2furthest_edge_query.cc
make[2]: *** [CMakeFiles/s2.dir/build.make:499: CMakeFiles/s2.dir/src/s2/s2closest_cell_query.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/tmp/guix-build-s2geometry-0.10.0.drv-0/build'
make[1]: *** [CMakeFiles/Makefile2:86: CMakeFiles/s2.dir/all] Error 2
make[1]: Leaving directory '/tmp/guix-build-s2geometry-0.10.0.drv-0/build'
make: *** [Makefile:139: all] Error 2
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "make" arguments: ("-j" "16") exit-status: 2 term-signal: #f stop-signal: #f>
jmr commented

Can you try with a head s2geometry and abseil-cpp?

FWIW, I've tried compiling the tests with:

  • s2geometry head
  • abseil 20230125.0 last release pre-installed using conda (conda-forge)
  • googletest 1.12 (source)
  • g++ 11
  • Ubuntu 20.04.5 LTS
  • using C++17 standard

It went mostly fine, except one error:

In file included from /home/vagrant/Git/github/others/s2geometry/src/s2/s2point.h:24,
                 from /home/vagrant/Git/github/others/s2geometry/src/s2/value_lexicon_test.cc:28:
/home/vagrant/mambaforge/envs/s2geometry_dev/include/absl/hash/hash.h: In function ‘size_t absl::lts_20230125::HashOf(const Types& ...)’:
/home/vagrant/mambaforge/envs/s2geometry_dev/include/absl/hash/hash.h:266:16: error: ‘Hash’ is not a member of ‘absl’; did you mean ‘absl::hash_internal::Hash’?
  266 |   return absl::Hash<decltype(tuple)>{}(tuple);
      |                ^~~~
In file included from /home/vagrant/Git/github/others/s2geometry/src/s2/value_lexicon_test.cc:18:
/home/vagrant/Git/github/others/s2geometry/src/s2/value_lexicon.h:35:8: note: ‘absl::hash_internal::Hash’ declared here
   35 | struct Hash;
      |        ^~~~

Removing the lines below fixed it:

namespace absl {
namespace hash_internal {
template <typename T>
struct Hash;
} // namespace hash_internal
} // namespace absl

Then all the tests succeeded.

I haven't tried using absl built from source, though. I see in the README that "Currently, Abseil must always be installed from source." Is it really mandatory? For more context: I'm maintaining s2geometry packages on conda-forge (feedstock), where it is recommended to build against the pre-built dependencies. Apart from the error above, It looks like it could be supported? Is there any reason why absl::hash_internal::Hash is redefined here?

jmr commented

Is there any reason why absl::hash_internal::Hash is redefined here?

Some automated tool did that because it thought the right file wasn't included. That has already been removed and will be reflected when I do the next code push. (Soon.) You can also send a PR if you want to delete it now.

Is it really mandatory?

We don't currently have support for adding abseil-cpp as a subdir, or anything like that. The wording should probably be changed to "somehow install" or something like that.

That has already been removed and will be reflected when I do the next code push. (Soon.) You can also send a PR if you want to delete it now.

No rush for me, I can wait your next code push. Thanks!

jmr commented

This was removed in 30f7072.