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

s2loop_test: Build fails with recent versions of abseil #357

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

s2loop_test: Build fails with recent versions of abseil #357

benstadin opened this issue Mar 21, 2024 · 5 comments

Comments

@benstadin
Copy link

EXPECT_THAT(error.text(), testing::HasSubstr(snippet));

S2 fails to build with recent versions of abseil at places where HasSubstr ist used. Replacing the string_view with a string works (as a workaround):
EXPECT_THAT(error.text(), testing::HasSubstr(std::string(snippet)));

@jmr
Copy link
Member

jmr commented Mar 22, 2024

Please include the error you're getting.

Is absl::string_view == std::string_view for you?

@benstadin
Copy link
Author

Yes. Abseil is built from source using the current LTS version (git tag 20240116.1)

In file included from /root/s2geometry/googletest/googlemock/include/gmock/gmock-spec-builders.h:75,
                 from /root/s2geometry/googletest/googlemock/include/gmock/gmock-generated-function-mockers.h:47,
                 from /root/s2geometry/googletest/googlemock/include/gmock/gmock-function-mocker.h:39,
                 from /root/s2geometry/googletest/googlemock/include/gmock/gmock.h:61,
                 from /root/s2geometry/src/s2/s2error_test.cc:22:
/root/s2geometry/googletest/googlemock/include/gmock/gmock-matchers.h: In instantiation of 'bool testing::internal::HasSubstrMatcher<StringType>::MatchAndExplain(const MatcheeStringType&, testing::MatchResultListener*) const [with MatcheeStringType = std::basic_string_view<char>; StringType = std::__cxx11::basic_string<char>]':
/root/s2geometry/googletest/googletest/include/gtest/gtest-matchers.h:484:35:   required from 'bool testing::PolymorphicMatcher<Impl>::MonomorphicImpl<T>::MatchAndExplain(T, testing::MatchResultListener*) const [with T = const std::basic_string_view<char>&; Impl = testing::internal::HasSubstrMatcher<std::__cxx11::basic_string<char> >]'
/root/s2geometry/googletest/googletest/include/gtest/gtest-matchers.h:483:18:   required from here
/root/s2geometry/googletest/googlemock/include/gmock/gmock-matchers.h:760:23: error: invalid initialization of reference of type 'const std::__cxx11::basic_string<char>&' from expression of type 'const std::basic_string_view<char>'
  760 |     const StringType& s2(s);
      |                       ^~

@jmr jmr changed the title Build fails with recent versions of abseil s2loop_test: Build fails with recent versions of abseil Mar 22, 2024
@jmr
Copy link
Member

jmr commented Mar 22, 2024

Same commands to compile as #356 ?

Which googletest? Does this one work with 1.14.0?

@benstadin
Copy link
Author

benstadin commented Mar 22, 2024

Yes, same commands. Cmake actually fails with more recent versions of gtest. So this was build with 1.10.0.

The error I get with 1.14.0 versions of test is (as far as I can remember, all recent versions show the same error, and 1.11.0 showed either this error when running cmake or the same error as with v1.10.0 when compiling):

root@9c6c06ec56a8:~/tmp/s2geometry/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" ..
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The following features have been disabled:

 * SHARED_LIBS, builds shared libraries instead of static.
 * PYTHON, provides python interface to S2
 * S2_USE_SYSTEM_INCLUDES, Silence warnings in s2 headers by marking them as SYSTEM includes.

-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found OpenSSL: /usr/lib/aarch64-linux-gnu/libcrypto.so (found version "3.0.2")  
GOOGLETEST_ROOT: /root/tmp/s2geometry/googletest
CMake Warning at googletest/googlemock/CMakeLists.txt:40 (project):
  VERSION keyword not followed by a value or was followed by a value that
  expanded to nothing.


CMake Warning at googletest/googletest/CMakeLists.txt:50 (project):
  VERSION keyword not followed by a value or was followed by a value that
  expanded to nothing.


-- Found Python3: /usr/bin/python3.10 (found version "3.10.12") found components: Interpreter 
CMake Error at googletest/googletest/CMakeLists.txt:124 (set_target_properties):
  set_target_properties called with incorrect number of arguments.


CMake Error at googletest/googletest/CMakeLists.txt:142 (set_target_properties):
  set_target_properties called with incorrect number of arguments.


CMake Error at googletest/googlemock/CMakeLists.txt:98 (set_target_properties):
  set_target_properties called with incorrect number of arguments.


CMake Error at googletest/googlemock/CMakeLists.txt:101 (set_target_properties):
  set_target_properties called with incorrect number of arguments.


-- Configuring incomplete, errors occurred!
See also "/root/tmp/s2geometry/build/CMakeFiles/CMakeOutput.log".

@jmr
Copy link
Member

jmr commented Mar 27, 2024

The error I get with 1.14.0 versions of test is

CMake Warning at googletest/googlemock/CMakeLists.txt:40 (project):
  VERSION keyword not followed by a value or was followed by a value that
 expanded to nothing.

What's around line 40 for you? I have:

    10  
    11  set(GOOGLETEST_VERSION 1.14.0)
    12  
...
    40  # Language "C" is required for find_package(Threads).
    41  cmake_minimum_required(VERSION 3.13)
    42  project(gmock VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C)

What's your cmake version? I have 3.28.1.

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