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

Regression: cmake fails when libgtest-dev is installed but libgmock-dev is not #2636

Closed
nurupo opened this issue Feb 3, 2024 · 0 comments · Fixed by #2637
Closed

Regression: cmake fails when libgtest-dev is installed but libgmock-dev is not #2636

nurupo opened this issue Feb 3, 2024 · 0 comments · Fixed by #2637
Assignees

Comments

@nurupo
Copy link
Member

nurupo commented Feb 3, 2024

v0.2.18 succeeds
$ sudo docker run -it --rm debian:bookworm /bin/bash
$ BRANCH=v0.2.18
$ apt-get update && apt-get install -y cmake g++ gcc git libgtest-dev libopus-dev libsodium-dev libvpx-dev pkg-config
$ git clone --recursive --branch $BRANCH https://github.com/TokTok/c-toxcore
$ cd c-toxcore
$ cmake -B_build
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.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
SOVERSION: 2.18.0
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.1") 
-- Supported C compiler features = c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17;c_std_23
-- Supported C++ compiler features = cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20;cxx_std_23
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Checking for one of the modules 'libsodium'
-- Checking for one of the modules 'opus'
-- Checking for one of the modules 'vpx'
-- Checking for one of the modules 'libconfig'
CMAKE_THREAD_LIBS_INIT: 
-- Checking for gtest
-- Looking for C++ include gtest/gtest.h
-- Looking for C++ include gtest/gtest.h - found
-- Found gtest: /usr/src/gtest
-- Performing Test HAVE_CXX_W
-- Performing Test HAVE_CXX_W - Success
-- Performing Test HAVE_CXX_W_NO_GLOBAL_CONSTRUCTORS
-- Performing Test HAVE_CXX_W_NO_GLOBAL_CONSTRUCTORS - Success
-- Performing Test HAVE_CXX_W_NO_ZERO_AS_NULL_POINTER_CONSTANT
-- Performing Test HAVE_CXX_W_NO_ZERO_AS_NULL_POINTER_CONSTANT - Success
CMake Warning at CMakeLists.txt:456 (message):
  Option BOOTSTRAP_DAEMON is enabled but required library LIBCONFIG was not
  found.


-- Configuring done
-- Generating done
-- Build files have been written to: /c-toxcore/_build
master fails
$ sudo docker run -it --rm debian:bookworm /bin/bash
$ BRANCH=master
$ apt-get update && apt-get install -y cmake g++ gcc git libgtest-dev libopus-dev libsodium-dev libvpx-dev pkg-config
$ git clone --recursive --branch $BRANCH https://github.com/TokTok/c-toxcore
$ cd c-toxcore
$ cmake -B_build
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.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
SOVERSION: 2.18.0
-- Found GTest: /usr/lib/x86_64-linux-gnu/cmake/GTest/GTestConfig.cmake (found version "1.12.1")  
-- Supported C compiler features = c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17;c_std_23
-- Supported C++ compiler features = cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20;cxx_std_23
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.1") 
-- Found Threads: TRUE  
-- Checking for one of the modules 'libsodium'
-- Checking for one of the modules 'opus'
-- Checking for one of the modules 'vpx'
-- Checking for one of the modules 'libconfig'
CMAKE_THREAD_LIBS_INIT: 
CMake Warning at CMakeLists.txt:590 (message):
  Option BOOTSTRAP_DAEMON is enabled but required library LIBCONFIG was not                                                                                       
  found.                                                                                                                                                          


-- Configuring done
CMake Error at CMakeLists.txt:522 (target_link_libraries):
  Target "unit_ring_buffer_test" links to:                                                                                                                        

    GTest::gmock                                                                                                                                                  

  but the target was not found.  Possible reasons include:                                                                                                        

    * There is a typo in the target name.                                                                                                                         
    * A find_package call is missing for an IMPORTED target.                                                                                                      
    * An ALIAS target is missing.                                                                                                                                 

Call Stack (most recent call first):                                                                                                                              
  CMakeLists.txt:531 (unit_test)                                                                                                                                  


CMake Error at CMakeLists.txt:522 (target_link_libraries):
  Target "unit_rtp_test" links to:                                                                                                                                

    GTest::gmock                                                                                                                                                  

  but the target was not found.  Possible reasons include:                                                                                                        

    * There is a typo in the target name.                                                                                                                         
    * A find_package call is missing for an IMPORTED target.                                                                                                      
    * An ALIAS target is missing.                                                                                                                                 

Call Stack (most recent call first):                                                                                                                              
  CMakeLists.txt:532 (unit_test)                                                                                                                                  


CMake Error at CMakeLists.txt:522 (target_link_libraries):
  Target "unit_DHT_test" links to:                                                                                                                                

    GTest::gmock                                                                                                                                                  

  but the target was not found.  Possible reasons include:                                                                                                        

    * There is a typo in the target name.                                                                                                                         
    * A find_package call is missing for an IMPORTED target.                                                                                                      
    * An ALIAS target is missing.                                                                                                                                 

Call Stack (most recent call first):                                                                                                                              
  CMakeLists.txt:533 (unit_test)                                                                                                                                  


CMake Error at CMakeLists.txt:522 (target_link_libraries):
  Target "unit_bin_pack_test" links to:                                                                                                                           

    GTest::gmock                                                                                                                                                  

  but the target was not found.  Possible reasons include:                                                                                                        

    * There is a typo in the target name.                                                                                                                         
    * A find_package call is missing for an IMPORTED target.                                                                                                      
    * An ALIAS target is missing.                                                                                                                                 

Call Stack (most recent call first):                                                                                                                              
  CMakeLists.txt:534 (unit_test)                                                                                                                                  


CMake Error at CMakeLists.txt:522 (target_link_libraries):
  Target "unit_crypto_core_test" links to:                                                                                                                        

    GTest::gmock                                                                                                                                                  

  but the target was not found.  Possible reasons include:                                                                                                        

    * There is a typo in the target name.                                                                                                                         
    * A find_package call is missing for an IMPORTED target.                                                                                                      
    * An ALIAS target is missing.                                                                                                                                 

Call Stack (most recent call first):                                                                                                                              
  CMakeLists.txt:535 (unit_test)                                                                                                                                  


CMake Error at CMakeLists.txt:522 (target_link_libraries):
  Target "unit_group_announce_test" links to:                                                                                                                     

    GTest::gmock                                                                                                                                                  

  but the target was not found.  Possible reasons include:                                                                                                        

    * There is a typo in the target name.                                                                                                                         
    * A find_package call is missing for an IMPORTED target.                                                                                                      
    * An ALIAS target is missing.                                                                                                                                 

Call Stack (most recent call first):                                                                                                                              
  CMakeLists.txt:536 (unit_test)                                                                                                                                  


CMake Error at CMakeLists.txt:522 (target_link_libraries):
  Target "unit_group_moderation_test" links to:                                                                                                                   

    GTest::gmock                                                                                                                                                  

  but the target was not found.  Possible reasons include:                                                                                                        

    * There is a typo in the target name.                                                                                                                         
    * A find_package call is missing for an IMPORTED target.                                                                                                      
    * An ALIAS target is missing.                                                                                                                                 

Call Stack (most recent call first):                                                                                                                              
  CMakeLists.txt:537 (unit_test)                                                                                                                                  


CMake Error at CMakeLists.txt:522 (target_link_libraries):
  Target "unit_list_test" links to:                                                                                                                               

    GTest::gmock                                                                                                                                                  

  but the target was not found.  Possible reasons include:                                                                                                        

    * There is a typo in the target name.                                                                                                                         
    * A find_package call is missing for an IMPORTED target.                                                                                                      
    * An ALIAS target is missing.                                                                                                                                 

Call Stack (most recent call first):                                                                                                                              
  CMakeLists.txt:538 (unit_test)                                                                                                                                  


CMake Error at CMakeLists.txt:522 (target_link_libraries):
  Target "unit_mem_test" links to:                                                                                                                                

    GTest::gmock                                                                                                                                                  

  but the target was not found.  Possible reasons include:                                                                                                        

    * There is a typo in the target name.                                                                                                                         
    * A find_package call is missing for an IMPORTED target.                                                                                                      
    * An ALIAS target is missing.                                                                                                                                 

Call Stack (most recent call first):                                                                                                                              
  CMakeLists.txt:539 (unit_test)                                                                                                                                  


CMake Error at CMakeLists.txt:522 (target_link_libraries):
  Target "unit_mono_time_test" links to:                                                                                                                          

    GTest::gmock                                                                                                                                                  

  but the target was not found.  Possible reasons include:                                                                                                        

    * There is a typo in the target name.                                                                                                                         
    * A find_package call is missing for an IMPORTED target.                                                                                                      
    * An ALIAS target is missing.                                                                                                                                 

Call Stack (most recent call first):                                                                                                                              
  CMakeLists.txt:540 (unit_test)                                                                                                                                  


CMake Error at CMakeLists.txt:522 (target_link_libraries):
  Target "unit_ping_array_test" links to:                                                                                                                         

    GTest::gmock                                                                                                                                                  

  but the target was not found.  Possible reasons include:                                                                                                        

    * There is a typo in the target name.                                                                                                                         
    * A find_package call is missing for an IMPORTED target.                                                                                                      
    * An ALIAS target is missing.                                                                                                                                 

Call Stack (most recent call first):                                                                                                                              
  CMakeLists.txt:541 (unit_test)                                                                                                                                  


CMake Error at CMakeLists.txt:522 (target_link_libraries):
  Target "unit_test_util_test" links to:                                                                                                                          

    GTest::gmock                                                                                                                                                  

  but the target was not found.  Possible reasons include:                                                                                                        

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  CMakeLists.txt:542 (unit_test)


CMake Error at CMakeLists.txt:522 (target_link_libraries):
  Target "unit_tox_test" links to:

    GTest::gmock

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  CMakeLists.txt:543 (unit_test)


CMake Error at CMakeLists.txt:522 (target_link_libraries):
  Target "unit_util_test" links to:

    GTest::gmock

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  CMakeLists.txt:544 (unit_test)


-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.
@nurupo nurupo self-assigned this Feb 3, 2024
@nurupo nurupo changed the title Regression: cmake fails when libgtest-dev is installed Regression: cmake fails when libgtest-dev is installed but libgmock-dev is not Feb 3, 2024
iphydf added a commit to iphydf/c-toxcore that referenced this issue Feb 3, 2024
We used to assume gtest installation includes gmock, but some users may
have only gtest and not gmock.

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

Successfully merging a pull request may close this issue.

1 participant