Skip to content

[bug?] non posix version of gtest pulled on linux #20089

Description

@MK8BK

Describe the bug

I don't know if this is the right place to ask for help, if not please redirect me quickly.

Linux 6.19.14-108.fc42.x86_64,
Intel i7-9750H,
Fedora 42 workstation.

I am brand new to conan.
I have been trying for half a day to setup gtest with conan.
I have this small test project to try and understand what the problem is.
I have three files: CMakeLists.txt, conanfile.txt and gtester.cpp.

# CMakeLists.txt
cmake_minimum_required(VERSION 3.23)
project(conan_gtest CXX)
set(CMAKE_CXX_STANDARD 20)

find_package(GTest REQUIRED)

add_executable(gtester gtester.cpp)

# as specified on the conancenter page for gtest 1.17.0
target_link_libraries(gtester PRIVATE gtest::gtest)
[requires]
gtest/1.17.0

[generators]
CMakeDeps
CMakeToolchain

[layout]
cmake_layout
#include <gtest/gtest.h>

// Demonstrate some basic assertions.
TEST(HelloTest, BasicAssertions) {
  // Expect two strings not to be equal.
  EXPECT_STRNE("hello", "world");
  // Expect equality.
  EXPECT_EQ(7 * 6, 42);
}
~/conan_gtest$ conan profile detect

detect_api: Found cc=gcc-15.2.1
detect_api: gcc>=5, using the major as version
detect_api: gcc C++ standard library: libstdc++11

Detected profile:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=15
os=Linux

WARN: This profile is a guess of your environment, please check it.
WARN: The output of this command is not guaranteed to be stable and can change in future Conan versions.
WARN: Use your own profile files for stability.
Saving detected profile to ~/.conan2/profiles/default
# to build from source, you need cmake>=3.23 and conan
~/conan_gtest$ conan install . --output-folder=build --build=missing
[...]
conanfile.txt: Generating aggregated env files
conanfile.txt: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh']
Install finished successfully
~/conan_gtest$ cmake --preset conan-release
[...]
-- Build files have been written to: ~/conan_gtest/build/build/Release
~/conan_gtest$ cmake --build --preset conan-release
[ 50%] Building CXX object CMakeFiles/gtester.dir/gtester.cpp.o
[100%] Linking CXX executable gtester
/usr/bin/ld: ~/.conan2/p/b/gtest50e39ca0414fc/p/lib/libgtest.a(gtest-all.cc.o): in function `testing::internal::RE::~RE()':
gtest-all.cc:(.text+0x410d): undefined reference to `regfreeA'
/usr/bin/ld: gtest-all.cc:(.text+0x4116): undefined reference to `regfreeA'
/usr/bin/ld: ~/.conan2/p/b/gtest50e39ca0414fc/p/lib/libgtest.a(gtest-all.cc.o): in function `testing::internal::RE::FullMatch(char const*, testing::internal::RE const&)':
gtest-all.cc:(.text+0x415a): undefined reference to `regexecA'
/usr/bin/ld: ~/.conan2/p/b/gtest50e39ca0414fc/p/lib/libgtest.a(gtest-all.cc.o): in function `testing::internal::RE::PartialMatch(char const*, testing::internal::RE const&)':
gtest-all.cc:(.text+0x419a): undefined reference to `regexecA'
/usr/bin/ld: ~/.conan2/p/b/gtest50e39ca0414fc/p/lib/libgtest.a(gtest-all.cc.o): in function `testing::internal::RE::Init(char const*)':
gtest-all.cc:(.text+0x255e7): undefined reference to `regcompA'
/usr/bin/ld: gtest-all.cc:(.text+0x2560b): undefined reference to `regcompA'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/gtester.dir/build.make:105: gtester] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:87: CMakeFiles/gtester.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2

Even with AI, I could not find the root cause of the problem. I tried to delete the .conan2 folder
and retry the same commands, changed the gtest version to 1.16.0 (oldest supported version).
It seems as though a non posix version of gtest is installed each time, judging by the
presence of regcompA instead of regcomp for posix systems.

WHAT DO????

How to reproduce it

No response

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions