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 :
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. 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
My question is : how to avoid sub-library aggregation during webrtc compilation ? The option rtc_build_ssl=false seems to have no effect ... What is the option and where can I pass it ?