这是indexloc提供的服务,不要输入任何密码
Skip to content

[Bug]: gtest v1.17.0: GTest-config cmake contains invalid path to includes #25693

@leha-bot

Description

@leha-bot

Problem description

When I used the GTest in my C++/CMake project, I've got this error:

CMake Error in tests/CMakeLists.txt:
  Imported target "GTest::gtest_main" includes non-existent path                            

    "/data/data/com.termux/files/usr//data/data/com.termux/files/usr/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.
  * An install or uninstall procedure did not complete successfully. 
  *  The installation package was faulty and references files it does not provide.

I have read the GTestTargets.cmake , and found that the installation prefix had generated incorrectly (the CMAKE_INSTALL_INCLUDEDIR for some unknown reason was expanded into full path instead of something like "include"):

# The installation prefix configured by this project.
set(_IMPORT_PREFIX "/data/data/com.termux/files/usr")

# Create imported target GTest::gtest
add_library(GTest::gtest SHARED IMPORTED)
set_target_properties(GTest::gtest PROPERTIES
    INTERFACE_COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1"
    INTERFACE_COMPILE_FEATURES "cxx_std_17"
    INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}//data/data/com.termux/files/usr/include"
    INTERFACE_LINK_LIBRARIES "Threads::Threads"
    INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}//data/data/com.termux/files/usr/include"
)

The simplest project I have done contains just find_package(GTest REQUIRED) and any non-INTERFACE target which links the any GTest:: target in CMakeLists txt

What steps will reproduce the bug?

  1. touch 1.cpp && echo -e "cmake_minimum_required(VERSION 3.30)\nproject(test-gt)\nfind_package(GTest REQUIRED)\nadd_library(test-gt 1.cpp)\ntarget_link_libraries(test-gt GTest::gtest_main)" > CMakeLists.txt && cmake -S . -B build in any subdir

What is the expected behavior?

Successful configuration

System information

Termux Variables:
TERMUX_API_VERSION=0.50.1        
TERMUX_APK_RELEASE=F_DROID                                        
TERMUX_APP_PACKAGE_MANAGER=apt                                    
TERMUX_APP_PID=6785                                               
TERMUX_IS_DEBUGGABLE_BUILD=0                                      
TERMUX_MAIN_PACKAGE_FORMAT=debian                                 
TERMUX_VERSION=0.118.0                                            
TERMUX__USER_ID=0                                                 
Packages CPU architecture:
aarch64                                                           
Subscribed repositories:
# sources.list
deb https://mirrors.cqupt.edu.cn/termux/termux-main stable main
# x11-repo (sources.list.d/x11.list) 
deb https://mirrors.cqupt.edu.cn/termux/termux-x11 x11 main
# tur-repo (sources.list.d/tur.list)
deb https://tur.kcubeterm.com tur-packages tur tur-on-device tur-continuous
Updatable packages:                                               clang/stable 20.1.8-2 aarch64 [upgradable from: 20.1.8-1]
libcompiler-rt/stable 20.1.8-2 aarch64 [upgradable from: 20.1.8-1]
libllvm-static/stable 20.1.8-2 aarch64 [upgradable from: 20.1.8-1]
libllvm/stable 20.1.8-2 aarch64 [upgradable from: 20.1.8-1]
libpolly/stable 20.1.8-2 aarch64 [upgradable from: 20.1.8-1]
lld/stable 20.1.8-2 aarch64 [upgradable from: 20.1.8-1]
llvm-tools/stable 20.1.8-2 aarch64 [upgradable from: 20.1.8-1]
llvm/stable 20.1.8-2 aarch64 [upgradable from: 20.1.8-1]
llvmgold/stable 20.1.8-2 aarch64 [upgradable from: 20.1.8-1]
mlir/stable 20.1.8-2 aarch64 [upgradable from: 20.1.8-1]
termux-tools version:
1.45.0
Android version:
16
Kernel build information:
Linux localhost 6.1.124-android14-11-g8d713f9e8e7b-ab13202960 #1 SMP PREEMPT Wed Mar 12 13:40:07 UTC 2025 aarch64 Android
Device manufacturer:
Google
Device model:
Pixel 6
Supported ABIs:
SUPPORTED_ABIS: arm64-v8a,armeabi-v7a,armeabi                     SUPPORTED_32_BIT_ABIS: armeabi-v7a,armeabi                        SUPPORTED_64_BIT_ABIS: arm64-v8a                                  LD Variables:
LD_LIBRARY_PATH=                                                  LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec-ld-preload.so                                                         Installed termux plugins:
com.termux.widget versionCode:1000
com.termux.window versionCode:15
com.termux.x11 versionCode:14
com.termux.api versionCode:51

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug reportSomething is not working properly

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions