项目里引用tikv的client-cpp客户端静态库 最后报错的问题

为提高效率,请提供以下信息,问题描述清晰能够更快得到解决:

【概述】 一个cpp项目集成tikv,用了client-cpp编译成的静态库引入工程中出现编译报错

【应用框架及开发适配业务逻辑】

【背景】 编译的静态库用的https://github.com/tikv/client-cpp的代码直接make编译的

【问题】 编译好的libkv_client.a库被用到工程项目里并包含对应的头文件,编译工程最后链接时出现报错,看信息是关于静态库的ssl和项目本身ssl的冲突引起的,这种怎么解决呢,库都是默认编译出的没有任何改动

【业务影响】

【TiDB 版本】

【附件】 错误信息如下:
Make Error: Parse error in command line argument: TIKV
Should be: VAR:type=value

CMake Error: Run ‘cmake --help’ for all supported options.
make[1]: warning: -jN forced in submake: disabling jobserver mode.
CMakeFiles/bif_ca.dir/main.cpp.o: In function asio::ssl::detail::openssl_init_base::do_init::~do_init()': /home/liuyuanchao/BIF-Core/src/3rd/asio/include/asio/ssl/detail/impl/openssl_init.ipp:73: undefined reference toCONF_modules_unload’
/home/liuyuanchao/BIF-Core/src/3rd/asio/include/asio/ssl/detail/impl/openssl_init.ipp:75: undefined reference to ENGINE_cleanup' CMakeFiles/bif_ca.dir/main.cpp.o: In functionasio::ssl::detail::openssl_init_base::do_init::~do_init()’:
/home/liuyuanchao/BIF-Core/src/3rd/asio/include/asio/ssl/detail/impl/openssl_init.ipp:73: undefined reference to CONF_modules_unload' /home/liuyuanchao/BIF-Core/src/3rd/asio/include/asio/ssl/detail/impl/openssl_init.ipp:75: undefined reference toENGINE_cleanup’
CMakeFiles/bif_ca.dir/main.cpp.o: In function asio::ssl::detail::openssl_init_base::do_init::do_init()': /home/liuyuanchao/BIF-Core/src/3rd/asio/include/asio/ssl/detail/impl/openssl_init.ipp:40: undefined reference toOPENSSL_add_all_algorithms_noconf’
/home/liuyuanchao/BIF-Core/src/3rd/asio/include/asio/ssl/detail/impl/openssl_init.ipp:40: undefined reference to OPENSSL_add_all_algorithms_noconf' /home/liuyuanchao/BIF-Core/src/3rd/asio/include/asio/ssl/detail/impl/openssl_init.ipp:40: undefined reference toOPENSSL_add_all_algorithms_noconf’
/home/liuyuanchao/BIF-Core/src/3rd/asio/include/asio/ssl/detail/impl/openssl_init.ipp:40: undefined reference to OPENSSL_add_all_algorithms_noconf' /home/liuyuanchao/BIF-Core/src/3rd/asio/include/asio/ssl/detail/impl/openssl_init.ipp:40: undefined reference toOPENSSL_add_all_algorithms_noconf’
/home/liuyuanchao/BIF-Core/lib/libbifchain_common.a(ca.cpp.o):/home/liuyuanchao/BIF-Core/src/common/ca.cpp:137: more undefined references to OPENSSL_add_all_algorithms_noconf' follow /home/liuyuanchao/BIF-Core/lib/libbifchain_common.a(ca.cpp.o): In functionbifchain::CA::Add_ExtCert(x509_st*, x509_st*, int, char const*)’:
/home/liuyuanchao/BIF-Core/src/common/ca.cpp:227: undefined reference to X509V3_EXT_conf_nid' /home/liuyuanchao/BIF-Core/lib/libbifchain_common.a(ca.cpp.o): In functionbifchain::CA::Add_ExtReq(stack_st_X509_EXTENSION*, int, char*)’:
/home/liuyuanchao/BIF-Core/src/common/ca.cpp:277: undefined reference to X509V3_EXT_conf_nid' /home/liuyuanchao/BIF-Core/lib/libbifchain_common.a(ca.cpp.o): In functionbifchain::CA::mkReq(bifchain::stuSUBJECT*, X509_req_st**, rsa_st**, evp_pkey_st**, int, char*)’:
/home/liuyuanchao/BIF-Core/src/common/ca.cpp:302: undefined reference to RSA_generate_key' /home/liuyuanchao/BIF-Core/lib/libbifchain_common.a(ca.cpp.o): In functionbifchain::CA::mkRoot(bifchain::stuSUBJECT*, x509_st**, rsa_st**, evp_pkey_st**, int, int, char*)’:
/home/liuyuanchao/BIF-Core/src/common/ca.cpp:1288: undefined reference to RSA_generate_key' /home/liuyuanchao/BIF-Core/lib/libbifchain_utils.a(net.cpp.o): In functionasio::ssl::detail::engine::engine(ssl_ctx_st*)’:
/home/liuyuanchao/BIF-Core/src/3rd/asio/include/asio/ssl/detail/impl/engine.ipp:49: undefined reference to SSL_ctrl' /home/liuyuanchao/BIF-Core/src/3rd/asio/include/asio/ssl/detail/impl/engine.ipp:50: undefined reference toSSL_ctrl’
/home/liuyuanchao/BIF-Core/src/3rd/asio/include/asio/ssl/detail/impl/engine.ipp:52: undefined reference to SSL_ctrl' /home/liuyuanchao/BIF-Core/lib/libbifchain_utils.a(ecc_sm2.cpp.o): In functionutils::EccSm2::GetCFCAGroup()’:
/home/liuyuanchao/BIF-Core/src/utils/ecc_sm2.cpp:83: undefined reference to EC_GROUP_new' /home/liuyuanchao/BIF-Core/src/utils/ecc_sm2.cpp:84: undefined reference toEC_GROUP_set_curve_GFp’
/home/liuyuanchao/BIF-Core/lib/libbifchain_utils.a(ecc_sm2.cpp.o): In function utils::EccSm2::NewRandom()': /home/liuyuanchao/BIF-Core/src/utils/ecc_sm2.cpp:377: undefined reference toEC_POINT_get_affine_coordinates_GF2m’
/home/liuyuanchao/BIF-Core/lib/libbifchain_utils.a(ecc_sm2.cpp.o): In function utils::EccSm2::NewGroup(utils::EccSm2::GROUP_TYPE, std::string, std::string, std::string, std::string, std::string, std::string)': /home/liuyuanchao/BIF-Core/src/utils/ecc_sm2.cpp:212: undefined reference toEC_GF2m_simple_method’
/home/liuyuanchao/BIF-Core/src/utils/ecc_sm2.cpp:212: undefined reference to EC_GROUP_new' /home/liuyuanchao/BIF-Core/src/utils/ecc_sm2.cpp:217: undefined reference toEC_GROUP_set_curve_GF2m’
/home/liuyuanchao/BIF-Core/src/utils/ecc_sm2.cpp:222: undefined reference to EC_POINT_set_affine_coordinates_GF2m' /home/liuyuanchao/BIF-Core/src/utils/ecc_sm2.cpp:230: undefined reference toEC_GROUP_check’
/home/liuyuanchao/BIF-Core/src/utils/ecc_sm2.cpp:155: undefined reference to EC_GROUP_new' /home/liuyuanchao/BIF-Core/src/utils/ecc_sm2.cpp:160: undefined reference toEC_GROUP_set_curve_GFp’
/home/liuyuanchao/BIF-Core/lib/libbifchain_utils.a(ecc_sm2.cpp.o): In function utils::EccSm2::GetPublicKey()': /home/liuyuanchao/BIF-Core/src/utils/ecc_sm2.cpp:699: undefined reference toEC_POINT_get_affine_coordinates_GF2m’
/home/liuyuanchao/BIF-Core/lib/libbifchain_utils.a(ecc_sm2.cpp.o): In function utils::EccSm2::getZA(ec_group_st*, std::string, ec_point_st const*)': /home/liuyuanchao/BIF-Core/src/utils/ecc_sm2.cpp:256: undefined reference toEC_POINT_get_affine_coordinates_GF2m’
/home/liuyuanchao/BIF-Core/src/utils/ecc_sm2.cpp:265: undefined reference to EC_POINT_get_affine_coordinates_GF2m' /home/liuyuanchao/BIF-Core/lib/libbifchain_utils.a(ecc_sm2.cpp.o): In functionutils::EccSm2::verify(ec_group_st*, std::string const&, std::string const&, std::string const&, std::string const&)’:
/home/liuyuanchao/BIF-Core/src/utils/ecc_sm2.cpp:587: undefined reference to EC_POINT_set_affine_coordinates_GF2m' /home/liuyuanchao/BIF-Core/src/utils/ecc_sm2.cpp:644: undefined reference toEC_POINT_get_affine_coordinates_GF2m’
/home/liuyuanchao/BIF-Core/lib/libbifchain_utils.a(ecc_sm2.cpp.o): In function utils::EccSm2::From(std::string)': /home/liuyuanchao/BIF-Core/src/utils/ecc_sm2.cpp:335: undefined reference toEC_POINT_get_affine_coordinates_GF2m’
/home/liuyuanchao/BIF-Core/lib/libbifchain_utils.a(ecc_sm2.cpp.o): In function utils::EccSm2::Sign(std::string const&, std::string const&)': /home/liuyuanchao/BIF-Core/src/utils/ecc_sm2.cpp:474: undefined reference toEC_POINT_get_affine_coordinates_GF2m’
collect2: error: ld returned 1 exit status
make[3]: *** [/home/liuyuanchao/BIF-Core/bin/bif_ca] Error 1
make[2]: *** [ca/CMakeFiles/bif_ca.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs…
/home/liuyuanchao/BIF-Core/src/3rd/tikv/libtikv_client.a(d1_both.cc.o): In function bssl::hm_fragment::~hm_fragment()': d1_both.cc:(.text._ZN4bssl11hm_fragmentD2Ev+0x0): multiple definition ofbssl::hm_fragment::~hm_fragment()’
/home/liuyuanchao/BIF-Core/src/3rd/openssl/libssl.a(d1_both.cc.o):d1_both.cc:(.text+0x74): first defined here
/home/liuyuanchao/BIF-Core/src/3rd/tikv/libtikv_client.a(d1_both.cc.o): In function bssl::hm_fragment::~hm_fragment()': d1_both.cc:(.text._ZN4bssl11hm_fragmentD2Ev+0x0): multiple definition ofbssl::hm_fragment::~hm_fragment()’
/home/liuyuanchao/BIF-Core/src/3rd/openssl/libssl.a(d1_both.cc.o):d1_both.cc:(.text+0x74): first defined here
/home/liuyuanchao/BIF-Core/src/3rd/tikv/libtikv_client.a(d1_both.cc.o): In function bssl::dtls1_get_message(ssl_st const*, bssl::SSLMessage*)': d1_both.cc:(.text._ZN4bssl17dtls1_get_messageEPK6ssl_stPNS_10SSLMessageE+0x0): multiple definition ofbssl::dtls1_get_message(ssl_st const*, bssl::SSLMessage*)’
/home/liuyuanchao/BIF-Core/src/3rd/openssl/libssl.a(d1_both.cc.o):d1_both.cc:(.text+0xeb3): first defined here
/home/liuyuanchao/BIF-Core/src/3rd/tikv/libtikv_client.a(d1_both.cc.o): In function bssl::dtls1_next_message(ssl_st*)': d1_both.cc:(.text._ZN4bssl18dtls1_next_messageEP6ssl_st+0x0): multiple definition ofbssl::dtls1_next_message(ssl_st*)’


若提问为性能优化、故障排查类问题,请下载脚本运行。终端输出的打印结果,请务必全选并复制粘贴上传。

libkv_client.a 如果编辑好了,感觉 tikv client-cpp 已经完成了吧。