Trouble building/linking C++ console app with WebRTC source

2,002 views
Skip to first unread message

Bryan Dickson

unread,
Apr 18, 2019, 2:32:33 AM4/18/19
to discuss-webrtc

Help! I'm trying to link a simple console app (Visual Studio 2017, C++) to WebRTC.

So far I've built WebRTC the source per their instructions, using build commands (recommended by Sourcey):

gn gen out/x64/Debug --args="is_debug=true rtc_include_tests=false target_cpu=\"x64\""

ninja -C out\x64\Debug

My VS 2017 Project has the following settings:

C/C++/General/Additional Include Directories:

webrtc\src 
webrtc\src\third_party\abseil-cpp

Linker/General/Additional Library Directories:

webrtc\src\out\x64\Debug;
webrtc\src\out\x64\Debug\obj;
webrtc\src\out\x64\Debug\obj\rtc_base;

Linker/Input/Additional Dependencies:

ws2_32.lib rtc_base.lib rtc_p2p.lib webrtc.lib winmm.lib dmoguids.lib wmcodecdspuuid.lib amstrmid.lib msdmo.lib crypt32.lib iphlpapi.lib secur32.lib Strmiids.lib

I'm sure my VS config could use some work, but for now, I'm getting the following linker error:

Severity Code Description Project File Line Suppression State Error LNK1136 invalid or corrupt file StreamingHostWin webrtc\src\out\x64\Debug\obj\rtc_base\rtc_base.lib 1

Any help/pointers would be greatly appreciated!

JD Arnold

unread,
Apr 24, 2019, 12:17:09 PM4/24/19
to discuss-webrtc
Yeah, that config line isn't right. You can't use the builtin compiler/linker if you are going to use MSVC, because the library it generates isn't compatible with MSVC. You need to add "is_clang=false" to the gn gen line, obviously running it from the MSVC command line of your choice. Here's my full line:

n gen out/release --args="is_debug=false target_winuwp_version=\"8.1\" target_cpu=\"x64\" target_winuwp_family=\"desktop\" use_rtti=true is_clang=false rtc_build_tools=false rtc_include_tests=false rtc_build_examples=false"

Bryan Dickson

unread,
Apr 24, 2019, 10:56:51 PM4/24/19
to discuss...@googlegroups.com
Thanks!  I'll give this a try.  Assuming debug will work this way as well (reversing debug flags)?

--

---
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/54482f76-1c2a-4e2a-b29a-83ea26aa7288%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

bryan.c...@gmail.com

unread,
Apr 25, 2019, 12:09:23 AM4/25/19
to discuss-webrtc
So far, I'm getting the following errors after compiling webrtc with your suggestions (but debug = true):

Severity Code Description Project File Line Suppression State
Error (active) E1574 static assertion failed with ".data() and .size() are private" StreamingHostWin webrtc\src\rtc_base\type_traits.h 70
Error (active) E2512 the argument to a feature-test macro must be a simple identifier StreamingHostWin webrtc\src\third_party\abseil-cpp\absl\base\attributes.h 508
Error (active) E2512 the argument to a feature-test macro must be a simple identifier StreamingHostWin webrtc\src\third_party\abseil-cpp\absl\base\attributes.h 532
Error (active) E2512 the argument to a feature-test macro must be a simple identifier StreamingHostWin webrtc\src\third_party\abseil-cpp\absl\base\attributes.h 601
Error (active) E1574 static assertion failed with "Not compliant with std::is_trivially_copy_assignable; Standard: true, Implementation: false" StreamingHostWin webrtc\src\third_party\abseil-cpp\absl\meta\type_traits.h 338
Error LNK2019 unresolved external symbol __imp_timeGetTime referenced in function "__int64 __cdecl rtc::SystemTimeNanos(void)" (?SystemTimeNanos@rtc@@YA_JXZ) StreamingHostWin StreamingHostWinRTC\webrtc.lib(time_utils.obj) 1
Error LNK2019 unresolved external symbol SystemFunction036 referenced in function CRYPTO_sysrand StreamingHostWin StreamingHostWinRTC\webrtc.lib(windows.obj) 1
Error LNK2019 unresolved external symbol __imp_OpenProcessToken referenced in function "bool __cdecl rtc::GetCurrentProcessIntegrityLevel(int *)" (?GetCurrentProcessIntegrityLevel@rtc@@YA_NPEAH@Z) StreamingHostWin StreamingHostWinRTC\webrtc.lib(win32.obj) 1
Error LNK2019 unresolved external symbol __imp_GetSidSubAuthority referenced in function "bool __cdecl rtc::GetCurrentProcessIntegrityLevel(int *)" (?GetCurrentProcessIntegrityLevel@rtc@@YA_NPEAH@Z) StreamingHostWin StreamingHostWinRTC\webrtc.lib(win32.obj) 1
Error LNK2019 unresolved external symbol __imp_GetSidSubAuthorityCount referenced in function "bool __cdecl rtc::GetCurrentProcessIntegrityLevel(int *)" (?GetCurrentProcessIntegrityLevel@rtc@@YA_NPEAH@Z) StreamingHostWin StreamingHostWinRTC\webrtc.lib(win32.obj) 1
Error LNK2019 unresolved external symbol __imp_GetTokenInformation referenced in function "bool __cdecl rtc::GetCurrentProcessIntegrityLevel(int *)" (?GetCurrentProcessIntegrityLevel@rtc@@YA_NPEAH@Z) StreamingHostWin StreamingHostWinRTC\webrtc.lib(win32.obj) 1
Error LNK1120 6 unresolved externals StreamingHostWin StreamingHostWinRTC\x64\Debug\StreamingHostWin.exe 1

k.le...@holo-light.com

unread,
Apr 25, 2019, 3:28:52 AM4/25/19
to discuss-webrtc
Try linking against advapi32 if you're not doing that yet; OpenProcessToken and GetSidSubAuthority are defined in there.

bryan.c...@gmail.com

unread,
Apr 25, 2019, 12:15:21 PM4/25/19
to discuss-webrtc
That did it (program links and runs), thank you! 
Reply all
Reply to author
Forward
Message has been deleted
0 new messages