You are not logged in.
I'm building unit test for my personal library on Arch Linux, which can be found here. The logic of the CMakeLists.txt is to use system library if the GoogleTest version is 1.14.0, otherwise it will fetch the library from GitHub and build it from source. This project has been successfully compiled and tested on Windows and Ubuntu 2204 by GitHub Actions.
The problem is, if I build the GoogleTest v1.14.0 (which is same as the version installed by pacman) using C++20 and other default compile options from source, there is no link error.
But If I use the GoogleTest v1.14.0 installed by pacman, this error occurs. The linker says some internal functions of GoogleTest are undefined.
Log:
[1/1] Linking CXX executable test/test_utf_codepoint
FAILED: test/test_utf_codepoint test/test_utf_codepoint[1]_tests.cmake /home/awe/devel/PapilioCharontis/build/test/test_utf_codepoint[1]_tests.cmake
: && /usr/bin/c++ test/CMakeFiles/test_utf_codepoint.dir/test_utf_codepoint.cpp.o -o test/test_utf_codepoint libpapilio.a /usr/lib/libgtest_main.so.1.14.0 /usr/lib/libgtest.so.1.14.0 && cd /home/awe/devel/PapilioCharontis/build/test && /usr/bin/cmake -D TEST_TARGET=test_utf_codepoint -D TEST_EXECUTABLE=/home/awe/devel/PapilioCharontis/build/test/test_utf_codepoint -D TEST_EXECUTOR= -D TEST_WORKING_DIR=/home/awe/devel/PapilioCharontis/build/test -D TEST_EXTRA_ARGS= -D TEST_PROPERTIES= -D TEST_PREFIX= -D TEST_SUFFIX= -D TEST_FILTER= -D NO_PRETTY_TYPES=FALSE -D NO_PRETTY_VALUES=FALSE -D TEST_LIST=test_utf_codepoint_TESTS -D CTEST_FILE=/home/awe/devel/PapilioCharontis/build/test/test_utf_codepoint[1]_tests.cmake -D TEST_DISCOVERY_TIMEOUT=5 -D TEST_XML_OUTPUT_DIR= -P /usr/share/cmake/Modules/GoogleTestAddTests.cmake
/usr/bin/ld: test/CMakeFiles/test_utf_codepoint.dir/test_utf_codepoint.cpp.o: in function `testing::internal::PrintTo(std::__cxx11::basic_string<char8_t, std::char_traits<char8_t>, std::allocator<char8_t> > const&, std::ostream*)':
test_utf_codepoint.cpp:(.text._ZN7testing8internal7PrintToERKNSt7__cxx1112basic_stringIDuSt11char_traitsIDuESaIDuEEEPSo[_ZN7testing8internal7PrintToERKNSt7__cxx1112basic_stringIDuSt11char_traitsIDuESaIDuEEEPSo]+0x1f): undefined reference to `testing::internal::PrintU8StringTo(std::__cxx11::basic_string<char8_t, std::char_traits<char8_t>, std::allocator<char8_t> > const&, std::ostream*)'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Last edited by HenryAWE (2024-05-07 13:51:43)
Offline
Can you produce the issue using a PKGBUILD in a clean chroot?
Offline