WebRTC編譯(VS2017)

寫一篇文章記錄一下WebRTC的VS2017編譯,這裏記錄的是網上沒有搜索到的信息,作爲對實踐編譯過程的補充

修改vs的並行編譯工作數量爲1

因爲webrtc多達900多個項目,彼此之間存在複雜的依賴關係,並行編譯會破壞這種依賴關係,可能是ninja構建系統的依賴關係設計並不完全兼容VS2017的工作方式吧

)描述
選擇工具>選項打開選項頁,再選擇環境>項目和解決方案->生成並運行,設置最大並行項目生成數爲1.

編譯video_replay項目失敗

FAILED: video_replay.exe video_replay.exe.pdb
ninja -t msvc -e environment.x64 -- ..\..\third_party\llvm-build\Release+Asserts\bin\lld-link.exe /nologo "-libpath:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\lib\x64" "-libpath:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64" "-libpath:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "-libpath:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64" "-libpath:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64" /OUT:./video_replay.exe /PDB:./video_replay.exe.pdb @./video_replay.exe.rsp
lld-link : error : undefined symbol: public: static class webrtc::Call * __cdecl webrtc::Call::Create(struct webrtc::CallConfig const &)
>>> referenced by .\..\..\video\video_replay.cc:384
>>>               obj/video/video_replay/video_replay.obj:(public: static void __cdecl webrtc::RtpReplayer::Replay(class std::__1::basic_string<char, struct std::__1::char_traits<char>, class std::__1::allocator<char>> const &, class std::__1::basic_string<char, struct std::__1::char_traits<char>, class std::__1::allocator<char>> const &))
>>> referenced by .\..\..\test\call_test.cc:227
>>>               obj/test/test_common/call_test.obj:(protected: void __cdecl webrtc::test::CallTest::CreateSenderCall(struct webrtc::CallConfig const &))
>>> referenced by .\..\..\test\call_test.cc:234
>>>               obj/test/test_common/call_test.obj:(protected: void __cdecl webrtc::test::CallTest::CreateReceiverCall(struct webrtc::CallConfig const &))

lld-link : error : undefined symbol: public: static class rtc::scoped_refptr<class webrtc::AudioState> __cdecl webrtc::AudioState::Create(struct webrtc::AudioState::Config const &)
>>> referenced by .\..\..\test\call_test.cc:109
>>>               obj/test/test_common/call_test.obj:(public: <auto> __cdecl `protected: void __cdecl webrtc::test::CallTest::RunBaseTest(class webrtc::test::BaseTest *)'::`1'::<lambda_2>::operator()(void) const)
>>> referenced by .\..\..\test\call_test.cc:122
>>>               obj/test/test_common/call_test.obj:(public: <auto> __cdecl `protected: void __cdecl webrtc::test::CallTest::RunBaseTest(class webrtc::test::BaseTest *)'::`1'::<lambda_2>::operator()(void) const)
ninja: build stopped: subcommand failed.
D:\OpenMind\webrtc_latest\src\out\Default\obj\video\video_replay.vcxproj(67,5): error MSB3073: 命令“call ninja.exe -C D:\OpenMind\webrtc_latest\src\out\Default\  video_replay.exe”已退出,代碼爲 1。

解決辦法是
修改src\video\BUILD.gn文件,
添加"…/call:call"編譯依賴:
rtc_executable(“video_replay”) {
testonly = true
sources = [
“video_replay.cc”,
]
deps = [
“…/api/rtc_event_log”,
“…/api/task_queue:default_task_queue_factory”,
“…/api/test/video:function_video_factory”,
“…/api/video_codecs:video_codecs_api”,
“…/call:call_interfaces”,
"…/call:call",
“…/common_video”,
“…/media:rtc_internal_video_codecs”,
“…/rtc_base:checks”,
“…/rtc_base:rtc_json”,
“…/rtc_base:stringutils”,
“…/rtc_base:timeutils”,
“…/system_wrappers”,
“…/test:call_config_utils”,
“…/test:encoder_settings”,
“…/test:fake_video_codecs”,
“…/test:null_transport”,
“…/test:rtp_test_utils”,
“…/test:run_test”,
“…/test:run_test_interface”,
“…/test:test_common”,
“…/test:test_renderer”,
“…/test:test_support”,
“…/test:video_test_common”,
“…/test:video_test_support”,
“//third_party/abseil-cpp/absl/flags:flag”,
“//third_party/abseil-cpp/absl/flags:parse”,
]
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章