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

s2builderutil_lax_polygon_layer_test/googletest: build fails on Ubuntu 22.04 #356

Open
benstadin opened this issue Mar 21, 2024 · 6 comments

Comments

@benstadin
Copy link

One of the tests won't compile with the latest version on Ubuntu 22.04. Neither with the mentioned googletest version 1.10.0 nor the current 1.14.0 release. The error is in s2builderutil_lax_polygon_layer_test:

In file included from /root/googletest/googlemock/include/gmock/gmock-spec-builders.h:75,
from /root/googletest/googlemock/include/gmock/gmock-generated-function-mockers.h:47,
from /root/googletest/googlemock/include/gmock/gmock-function-mocker.h:39,
from /root/googletest/googlemock/include/gmock/gmock.h:61,
from /root/s2geometry/src/s2/s2builderutil_lax_polygon_layer_test.cc:26:
/root/googletest/googlemock/include/gmock/gmock-matchers.h: In instantiation of 'bool testing::internal::ElementsAreMatcherImpl::MatchAndExplain(Container, testing::MatchResultListener*) const [with Container = const IdSetLexicon::IdSet&]':
/root/googletest/googlemock/include/gmock/gmock-matchers.h:2747:8: required from here
/root/googletest/googlemock/include/gmock/gmock-matchers.h:2757:43: error: no type named 'const_iterator' in 'testing::internal::ElementsAreMatcherImpl<const IdSetLexicon::IdSet&>::StlContainer' {aka 'class IdSetLexicon::IdSet'}
2757 | typename StlContainer::const_iterator it = stl_container.begin();
| ^~
/root/googletest/googlemock/include/gmock/gmock-matchers.h:2757:43: error: no type named 'const_iterator' in 'testing::internal::ElementsAreMatcherImpl<const IdSetLexicon::IdSet&>::StlContainer' {aka 'class IdSetLexicon::IdSet'}
/root/s2geometry/src/s2/s2builderutil_snap_functions_test.cc: In function 'double GetS2CellIdMinVertexSeparation(int, absl::lts_20240116::flat_hash_set*)':

@jmr
Copy link
Member

jmr commented Mar 22, 2024

Let's wait until the "which code is it?" question from the other issues is resolved before worrying too much about this one.

@benstadin
Copy link
Author

This is on the master branch. Steps to reproduce (I'm using an Ubuntu 22.04 Docker Image):

git clone https://github.com/google/s2geometry.git
cd s2geometry
git clone https://github.com/google/googletest.git -b release-1.10.0
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX:PATH=/usr/local -DBUILD_SHARED_LIBS=OFF -Dabsl_DIR=/usr/local/lib -DGOOGLETEST_ROOT="/root/tmp/s2geometry/googletest" ..
make -j8

@jmr
Copy link
Member

jmr commented Mar 22, 2024

I'm actually using the Debian googletest-1.14.0-1, and it works. Do you get the same error message from 1.14.0?

@jmr jmr changed the title Building with tests fails on Ubuntu 22.04 s2builderutil_lax_polygon_layer_test/googletest: build fails on Ubuntu 22.04 Mar 22, 2024
@benstadin
Copy link
Author

benstadin commented Mar 22, 2024

I've answered that in the other issue (and sorry, I should have consolidated the issues into a single one). Though the build instructions from the readme won't work on Ubuntu 22.04 either way, because for whatever reason gmock is missing in the Ubuntu package (if I remember correctly the version there is otherwise 1.11.0). Even though gtest is found cmake complains right away that gmock isn't available when the system package is used.

@jmr
Copy link
Member

jmr commented Mar 23, 2024

Then the instructions about the required version number are probably wrong, as well as the package instructions for Ubunto. google-mock needs to be installed separately. Can you install google-mock and see if it works with 1.11 or 1.14?

@benstadin
Copy link
Author

benstadin commented Mar 23, 2024

The build fails at the same place with googletest and gmock installed via apt (the Ubuntu package version for both is 1.11.0-3). Since I get the same "wrong number of arguments" error on alpine 3.19 when using a recent googletest version as with ubuntu 22.04 I assume installing a different version on Ubuntu via apt from alternative sources would not make a difference.

sudo apt-get install cmake googletest libssl-dev libgmock-dev
git clone https://github.com/google/s2geometry.git
cd s2geometry
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX:PATH=/usr/local -DBUILD_SHARED_LIBS=OFF -Dabsl_DIR=/usr/local/lib -DGOOGLETEST_ROOT=/usr/src/googletest ..

make -j8

[...]

In file included from /usr/src/googletest/googlemock/include/gmock/gmock-spec-builders.h:75,
                 from /usr/src/googletest/googlemock/include/gmock/gmock-function-mocker.h:42,
                 from /usr/src/googletest/googlemock/include/gmock/gmock.h:61,
                 from /root/tmp3/s2geometry/src/s2/s2builderutil_lax_polygon_layer_test.cc:26:
/usr/src/googletest/googlemock/include/gmock/gmock-matchers.h: In instantiation of 'bool testing::internal::ElementsAreMatcherImpl<Container>::MatchAndExplain(Container, testing::MatchResultListener*) const [with Container = const IdSetLexicon::IdSet&]':
/usr/src/googletest/googlemock/include/gmock/gmock-matchers.h:3228:8:   required from here
/usr/src/googletest/googlemock/include/gmock/gmock-matchers.h:3238:43: error: no type named 'const_iterator' in 'testing::internal::ElementsAreMatcherImpl<const IdSetLexicon::IdSet&>::StlContainer' {aka 'class IdSetLexicon::IdSet'}
 3238 |     typename StlContainer::const_iterator it = stl_container.begin();
      |                                           ^~
/usr/src/googletest/googlemock/include/gmock/gmock-matchers.h:3238:43: error: no type named 'const_iterator' in 'testing::internal::ElementsAreMatcherImpl<const IdSetLexicon::IdSet&>::StlContainer' {aka 'class IdSetLexicon::IdSet'}

Edit: By the way, for testing the above I used a shell into blank docker container. This may be a quick way to reproduce the issue:
docker run -it ubuntu:22.04 /bin/bash

(build tools and git need to be installed still)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants