google / googletest

GoogleTest - Google Testing and Mocking Framework
https://google.github.io/googletest/
BSD 3-Clause "New" or "Revised" License
34.51k stars 10.09k forks source link

[Bug]: Undefined symbol to `testing::internal::PrintTo` for `std::u8string` #4528

Closed HenryAWE closed 4 months ago

HenryAWE commented 5 months ago

Describe the issue

If I used the library provided by the system package manager like pacman of Arch Linux, I will get a link error complaining about the PrintTo for std::u8string is undefined. But if I use the FetchContent to build the same version (v1.14.0) of GoogleTest for my project, this error disappears.

Steps to reproduce the problem

https://github.com/HenryAWE/PapilioCharontis/blob/7f9014c4051b1f635b843dbcab56be220c121163/CMakeLists.txt

Compiled with -Dpapilio_build_unit_test=1

What version of GoogleTest are you using?

v1.14.0

What operating system and version are you using?

Arch Linux

What compiler and version are you using?

GCC 13.2

What build system are you using?

CMake 3.29.2

Additional context

No response

derekmauro commented 4 months ago

I didn't try this and we don't support pre-compiled libraries from package managers. However, I would guess that the problem is related to C++20. u8string is only available in C++20, and I bet the package you are linking against isn't built with C++20 support.