I have a standard lib mismatch: "undefined symbol: public: class std::Cr::basic_string"

1,658 views
Skip to first unread message

Điền Đô

unread,
Oct 3, 2023, 11:38:27 AM10/3/23
to discuss-webrtc
Hi guys.
I got a common linking error.
It seems, i was linking a library that was compiled against a different version of c++ than the one i was using with the executable.
(I am using clang, c++17 and c++20 compilers. I use Qt creator and VS2022)
In my search results(library I am using), I know that "libc++ llvm-clang" is the default library for builds.
It is represented as " std::__1::  " ( __1  is the inline namespace that libc++ uses)
###
In the Pic, I am getting the error:
undefined symbol: public: class std::Cr::basic_string<char, struct std::Cr::char_traits<char>,
class std::Cr::allocator<char>> & __cdecl std::Cr::basic_string<char, struct std::Cr::char_traits<char>,
class std::Cr::allocator<char>>::append(char const *, unsigned __int64),......
###
std::Cr::  is the inline namespace the library is using.
Does anyone know about  std::Cr::  ?
There are no specific results for my case.
Any suggestions for me?
Thank you:))

386472029_1496144647805297_5469474548847982861_n.png385551507_1058984101709874_4623142292990698750_n.png

Điền Đô

unread,
Oct 3, 2023, 11:41:26 AM10/3/23
to discuss-webrtc

Any help, I sincerely appreciate it 😁 😁 😁


Vào lúc 22:38:27 UTC+7 ngày Thứ Ba, 3 tháng 10, 2023, Điền Đô đã viết:

V I

unread,
Oct 3, 2023, 10:06:36 PM10/3/23
to discuss...@googlegroups.com
it's Google's custom libc++ (Cr stands for Chrome I believe). You either need to force it to use the regular libc++  when building libwebrtc (use_custom_libcxx=false), which is probably broken in some way, or link your app with that custom libc++

--
This list falls under the WebRTC Code of Conduct - https://webrtc.org/support/code-of-conduct.
---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/44af9f49-504d-4541-8df7-c67f3f778863n%40googlegroups.com.

Điền Đô

unread,
Oct 4, 2023, 3:33:17 AM10/4/23
to discuss-webrtc
Hi:))

i followed your suggestion, i rebuilt webrtc with command: 
gn gen out/libc++ --args="is_debug=true use_custom_libcxx=false

and I got some warnings about using is_pod, as you saw in the picture. And I had build failure.
I also get the suggestion as shown in the Pic,  define _SILENCE_CXX20_IS_POD_DEPRECATION_WARNING or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.
384541898_199688843140543_5242875807882208254_n.png


I did so but without success :((
I rebuilt with the options the error message suggests, the command is as follows:
gn gen out/libc++ --args="is_debug=true use_custom_libcxx=false _SILENCE_CXX20_IS_POD_DEPRECATION_WARNING=true"
gn gen out/libc++ --args="is_debug=true use_custom_libcxx=false _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS=true"

What is the correct command for this case?

386466556_700455095129673_6763677983515639705_n.png


Thanks for watching:))
Vào lúc 09:06:36 UTC+7 ngày Thứ Tư, 4 tháng 10, 2023, V I đã viết:

tudor....@gmail.com

unread,
Feb 23, 2024, 9:38:15 AM2/23/24
to discuss-webrtc
I'm having the same issue when trying to link an app against libwebrtc.a

> or link your app with that custom libc++

Where can I find the custom libc++?

Khun V

unread,
Feb 24, 2024, 8:05:13 AM2/24/24
to discuss...@googlegroups.com
It doesn't really exist as a library (I mean .a/.lib file). You need to add all the object files from ${WEBRTC_ROOT}/out/obj/buildtools/third_party/libc++/libc++ and ${WEBRTC_ROOT}/out/obj/buildtools/third_party/libc++abi/libc++abi to the build

tudor....@gmail.com

unread,
Feb 25, 2024, 10:49:40 AM2/25/24
to discuss-webrtc
@Khun V Thank you, that helped!

Now when I'm building my own app, I have lots of errors like this one

undefined reference to `rtc::Thread::SetName(std::basic_string_view<char, std::char_traits<char> >, void const*)'

Which I guess is related to the fact that the compiler does not generate the signature needed for the call to the appropriate method:

rtc::Thread::SetName(std::__Cr::basic_string_view<char, std::__Cr::char_traits<char> >, void const*)

So clearly not using the std::__Cr::basic_string_view.

I guess my (#include <string> etc.) includes should point to the custom libstdc++ includes. But how do I do this?
Reply all
Reply to author
Forward
0 new messages