简体   繁体   English

在 Windows 上编译 webrtc 期间如何避免子库聚合?

[英]How to avoid sub-library aggregation during webrtc compilation on Windows?

I'm trying to compile and use static WebRTC against OpenSSL 1.1.1 on Windows in a Visual Studio project, here's my gn line: I'm trying to compile and use static WebRTC against OpenSSL 1.1.1 on Windows in a Visual Studio project, here's my gn line:

gn gen ./intermediate --args="target_cpu=\"x64\" use_rtti=false is_debug=true symbol_level=2 enable_iterator_debugging=true rtc_build_tools=false rtc_build_examples=false rtc_include_tests=false enable_precompiled_headers=false use_cxx11=false use_custom_libcxx=false use_custom_libcxx_for_host=false rtc_build_ssl=false rtc_ssl_root=\"C:/libs/OpenSSL/include:\=\\%\" rtc_build_json=false rtc_jsoncpp_root=\"C:/libs/JsonCpp/include:\=\\%\" is_clang=false is_component_build=false use_lld=false dcheck_is_configurable=true"

The compilation is OK , but in my Visual Studio 2019 project I've got these 1156 errors at the linker step:编译正常,但在我的 Visual Studio 2019 项目中,我在 linker 步骤中遇到了这些1156 个错误

1 - libssl.lib(ssl_lib.obj) : error LNK2005: SSL_CTX_check_private_key already defined in webrtc.lib(ssl_lib.obj)
2 - libssl.lib(ssl_lib.obj) : error LNK2005: SSL_CTX_clear_options already defined in webrtc.lib(ssl_lib.obj)
3 - libssl.lib(ssl_lib.obj) : error LNK2005: SSL_CTX_free already defined in webrtc.lib(ssl_lib.obj)
4 - libssl.lib(ssl_lib.obj) : error LNK2005: SSL_CTX_get0_certificate already defined in webrtc.lib(ssl_x509.obj)
...
1154 - libcrypto.lib(p12_asn.obj) : error LNK2005: d2i_PKCS12 already defined in webrtc.lib(pkcs8_x509.obj)
1155 - libcrypto.lib(p12_asn.obj) : error LNK2005: i2d_PKCS12 already defined in webrtc.lib(pkcs8_x509.obj)
1156 - libcrypto.lib(asn1_par.obj) : error LNK2005: ASN1_tag2str already defined in webrtc.lib(asn1_par.obj)

I understood that this appended because libssl.lib and libcrypto.lib are already aggregated in webrtc.lib .我知道这是附加的,因为libssl.lib 和 libcrypto.lib 已经在 webrtc.lib 中聚合 But in this project I also use Curl and LibWebSocket that also depend on the same OpenSSL static libs, and when I try to remove libssl.lib and crypto.lib from the linker input this fail with 67 unresolved symbols : But in this project I also use Curl and LibWebSocket that also depend on the same OpenSSL static libs, and when I try to remove libssl.lib and crypto.lib from the linker input this fail with 67 unresolved symbols :

1 - websockets_static.lib(openssl-server.obj) : error LNK2001: unresolved external symbol SSL_ctrl
2 - webrtc.lib(openssl_adapter.obj) : error LNK2001: unresolved external symbol SSL_ctrl
...
66 - libcurl.lib(openssl.obj) : error LNK2019: unresolved external symbol ENGINE_set_default referenced in function x509_name_oneline
67 - websockets_static.lib(openssl-server.obj) : error LNK2019: unresolved external symbol SSL_CTX_callback_ctrl referenced in function lws_tls_server_vhost_backend_init

So my feeling is that only some part of libssl.lib and crypto.lib that are needed by webrtc.lib are aggregated during the compilation of webrtc.lib所以我的感觉是,在webrtc.lib的编译过程中,只有webrtc.lib需要的libssl.lib和crypto.lib的一部分被聚合了

My question is: how to avoid sub-library aggregation during webrtc compilation?我的问题是: webrtc 编译过程中如何避免子库聚合? The option rtc_build_ssl=false seems to have no effect... What is the option and where can I pass it?选项 rtc_build_ssl=false 似乎没有效果......选项是什么,我在哪里可以通过它?

After facing the same problems as you I switched to the latest OpenSSL version 3.0.0-beta2-dev and then I didn't see all these "already defined" any more.在遇到与您相同的问题后,我切换到最新的 OpenSSL 版本 3.0.0-beta2-dev,然后我不再看到所有这些“已经定义”。

That means I could compile and link without errors but unfortunately it doesn't work and stops in OpenSSLDigest::GetDigestEVP() .这意味着我可以毫无错误地编译和链接,但不幸的是它不起作用并在OpenSSLDigest::GetDigestEVP()中停止。 So WebRTC doesn't seem to support OpenSSL 3.0.0.所以 WebRTC 似乎不支持 OpenSSL 3.0.0。 Did you meanwhile manage to get it compiled, linked and running with OpenSSL 1.1.1?您是否同时设法使用 OpenSSL 1.1.1 对其进行编译、链接和运行?

I Faced the same problme.我面临同样的问题。 Have you solved it.你解决了吗。

gn gen out/Release --args="is_debug=false is_component_build=false rtc_include_tests=false use_custom_libcxx=false symbol_level=0 rtc_enable_symbol_export=false use_rtti=true rtc_build_examples=false rtc_build_ssl=false rtc_ssl_root=\"C:\OpenSSL-Win64\include""

I use rtc_build_ssl = false.我使用 rtc_build_ssl = false。 But I found that,boringssl still compiled and linked但是我发现,boringssl 还是编译链接了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM