I’m relatively new to C++, so I may be missing some key factors regarding the use of linking, especially on such a complex project.
I can build OpenSSL 3.4.0 fine, as we want a statically linked lib in POCO, which will in turn be statically linked into our binary. When building and linking it into POCO 1.13.3, however, we get 160 unresolved external symbols in the linking of POCO::Crypto, all of them being symbols that should be provided by OpenSSL. Compilation succeeds but it fails on linking.
This is using the base releases of POCO and OpenSSL from git and building on a stock Visual C++ 2022 installation with POCO’s built-in vcxproj.
| Building C:projectexternalspocoCryptoCrypto_vs170.vcxproj
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
&"C:Program FilesMicrosoft Visual Studio2022CommunityMSBuildCurrentBinMSBuild.exe" C:projectexternalspocoCryptoCrypto_vs170.vcxproj /nologo /m /t:rebuild /p:Configuration=release_shared /p:BuildProjectReferences=false /p:Platform=Win32 /p:useenv=True /v:minimal
Cipher.cpp
CipherFactory.cpp
CipherImpl.cpp
CipherKey.cpp
CipherKeyImpl.cpp
CryptoException.cpp
CryptoStream.cpp
CryptoTransform.cpp
DigestEngine.cpp
ECDSADigestEngine.cpp
ECKey.cpp
ECKeyImpl.cpp
Envelope.cpp
EVPCipherImpl.cpp
EVPPKey.cpp
KeyPair.cpp
KeyPairImpl.cpp
OpenSSLInitializer.cpp
PKCS12Container.cpp
RSACipherImpl.cpp
C:projectexternalspocoCryptosrcEVPCipherImpl.cpp(172,55): warning C4244: 'argument': conv
ersion from 'std::streamsize' to 'size_t', possible loss of data [C:projectexternalspocoCry
ptoCrypto_vs170.vcxproj]
RSADigestEngine.cpp
RSAKey.cpp
RSAKeyImpl.cpp
X509Certificate.cpp
OpenSSL 3.4.0-dev
Creating library ..libPocoCrypto.lib and object ..libPocoCrypto.exp
CipherFactory.obj : error LNK2019: unresolved external symbol _OSSL_PROVIDER_load referenced in function "public: __thi
scall Poco::Crypto::CipherFactory::CipherFactory(void)" (??0CipherFactory@Crypto@Poco@@QAE@XZ) [C:UsersoldteDocument
senetenetexternalspocoCryptoCrypto_vs170.vcxproj]
OpenSSLInitializer.obj : error LNK2001: unresolved external symbol _OSSL_PROVIDER_load [C:UsersoldteDocumentsenete
netexternalspocoCryptoCrypto_vs170.vcxproj]
RSACipherImpl.obj : error LNK2001: unresolved external symbol _EVP_PKEY_type [C:projectextern
alspocoCryptoCrypto_vs170.vcxproj]
RSADigestEngine.obj : error LNK2001: unresolved external symbol _EVP_PKEY_type [C:projectexte
rnalspocoCryptoCrypto_vs170.vcxproj]
RSAKey.obj : error LNK2001: unresolved external symbol _EVP_PKEY_type [C:projectexternalspoc
oCryptoCrypto_vs170.vcxproj]
RSAKeyImpl.obj : error LNK2001: unresolved external symbol _EVP_PKEY_type [C:projectexternals
pocoCryptoCrypto_vs170.vcxproj]
Envelope.obj : error LNK2001: unresolved external symbol _EVP_PKEY_type [C:projectexternalsp
ocoCryptoCrypto_vs170.vcxproj]
EVPCipherImpl.obj : error LNK2001: unresolved external symbol _EVP_PKEY_type [C:projectextern
alspocoCryptoCrypto_vs170.vcxproj]
EVPPKey.obj : error LNK2001: unresolved external symbol _EVP_PKEY_type [C:projectexternalspo
coCryptoCrypto_vs170.vcxproj]
PKCS12Container.obj : error LNK2001: unresolved external symbol _EVP_PKEY_type [C:projectexte
rnalspocoCryptoCrypto_vs170.vcxproj]
...trimmed for length...
X509Certificate.obj : error LNK2019: unresolved external symbol _BN_bn2hex referenced in function "protected: void __th
iscall Poco::Crypto::X509Certificate::init(void)" (?init@X509Certificate@Crypto@Poco@@IAEXXZ) [C:UsersoldteDocuments
enetenetexternalspocoCryptoCrypto_vs170.vcxproj]
X509Certificate.obj : error LNK2019: unresolved external symbol _ASN1_STRING_length referenced in function "public: voi
d __thiscall Poco::Crypto::X509Certificate::extractNames(class std::basic_string<char,struct std::char_traits<char>,cla
ss std::allocator<char> > &,class std::set<class std::basic_string<char,struct std::char_traits<char>,class std::alloca
tor<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,
class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &)cons
t " (?extractNames@X509Certificate@Crypto@Poco@@QBEXAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV
?$set@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$a
llocator@D@2@@std@@@2@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@5@@Z) [C:Usersol
dteDocumentsenetenetexternalspocoCryptoCrypto_vs170.vcxproj]
X509Certificate.obj : error LNK2019: unresolved external symbol _ASN1_STRING_get0_data referenced in function "public:
void __thiscall Poco::Crypto::X509Certificate::extractNames(class std::basic_string<char,struct std::char_traits<char>,
class std::allocator<char> > &,class std::set<class std::basic_string<char,struct std::char_traits<char>,class std::all
ocator<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >
>,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &)c
onst " (?extractNames@X509Certificate@Crypto@Poco@@QBEXAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@
AAV?$set@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@U?$less@V?$basic_string@DU?$char_traits@D@std@@V
?$allocator@D@2@@std@@@2@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@5@@Z) [C:Users
oldteDocumentsenetenetexternalspocoCryptoCrypto_vs170.vcxproj]
X509Certificate.obj : error LNK2019: unresolved external symbol _ASN1_INTEGER_to_BN referenced in function "protected:
void __thiscall Poco::Crypto::X509Certificate::init(void)" (?init@X509Certificate@Crypto@Poco@@IAEXXZ) [C:Usersoldte
DocumentsenetenetexternalspocoCryptoCrypto_vs170.vcxproj]
X509Certificate.obj : error LNK2019: unresolved external symbol _OBJ_nid2ln referenced in function "public: class std::
basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall Poco::Crypto::X509Certificate::
signatureAlgorithm(void)const " (?signatureAlgorithm@X509Certificate@Crypto@Poco@@QBE?AV?$basic_string@DU?$char_traits@
D@std@@V?$allocator@D@2@@std@@XZ) [C:projectexternalspocoCryptoCrypto_vs170.vcxproj]
X509Certificate.obj : error LNK2019: unresolved external symbol _X509_verify referenced in function "public: bool __thi
scall Poco::Crypto::X509Certificate::issuedBy(class Poco::Crypto::X509Certificate const &)const " (?issuedBy@X509Certif
icate@Crypto@Poco@@QBE_NABV123@@Z) [C:projectexternalspocoCryptoCrypto_vs170.vcxproj]
X509Certificate.obj : error LNK2019: unresolved external symbol _X509_digest referenced in function "public: class std:
:vector<unsigned char,class std::allocator<unsigned char> > __thiscall Poco::Crypto::X509Certificate::fingerprint(class
std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " (?fingerprint@X509Ce
rtificate@Crypto@Poco@@QBE?AV?$vector@EV?$allocator@E@std@@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@
D@2@@5@@Z) [C:projectexternalspocoCryptoCrypto_vs170.vcxproj]
X509Certificate.obj : error LNK2019: unresolved external symbol _X509_get_signature_nid referenced in function "public:
class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall Poco::Crypto::X509C
ertificate::signatureAlgorithm(void)const " (?signatureAlgorithm@X509Certificate@Crypto@Poco@@QBE?AV?$basic_string@DU?$
char_traits@D@std@@V?$allocator@D@2@@std@@XZ) [C:projectexternalspocoCryptoCrypto_vs170.vc
xproj]
X509Certificate.obj : error LNK2019: unresolved external symbol _X509_get_serialNumber referenced in function "protecte
d: void __thiscall Poco::Crypto::X509Certificate::init(void)" (?init@X509Certificate@Crypto@Poco@@IAEXXZ) [C:Usersold
teDocumentsenetenetexternalspocoCryptoCrypto_vs170.vcxproj]
X509Certificate.obj : error LNK2019: unresolved external symbol _X509_get_issuer_name referenced in function "protected
: void __thiscall Poco::Crypto::X509Certificate::init(void)" (?init@X509Certificate@Crypto@Poco@@IAEXXZ) [C:Usersoldt
eDocumentsenetenetexternalspocoCryptoCrypto_vs170.vcxproj]
X509Certificate.obj : error LNK2019: unresolved external symbol _X509_get_subject_name referenced in function "protecte
d: void __thiscall Poco::Crypto::X509Certificate::init(void)" (?init@X509Certificate@Crypto@Poco@@IAEXXZ) [C:Usersold
teDocumentsenetenetexternalspocoCryptoCrypto_vs170.vcxproj]
X509Certificate.obj : error LNK2019: unresolved external symbol _X509_get0_notBefore referenced in function "public: cl
ass Poco::DateTime __thiscall Poco::Crypto::X509Certificate::validFrom(void)const " (?validFrom@X509Certificate@Crypto@
Poco@@QBE?AVDateTime@3@XZ) [C:projectexternalspocoCryptoCrypto_vs170.vcxproj]
X509Certificate.obj : error LNK2019: unresolved external symbol _X509_get0_notAfter referenced in function "public: cla
ss Poco::DateTime __thiscall Poco::Crypto::X509Certificate::expiresOn(void)const " (?expiresOn@X509Certificate@Crypto@P
oco@@QBE?AVDateTime@3@XZ) [C:projectexternalspocoCryptoCrypto_vs170.vcxproj]
X509Certificate.obj : error LNK2019: unresolved external symbol _X509_up_ref referenced in function "public: __thiscall
Poco::Crypto::X509Certificate::X509Certificate(struct x509_st *,bool)" (??0X509Certificate@Crypto@Poco@@QAE@PAUx509_st
@@_N@Z) [C:projectexternalspocoCryptoCrypto_vs170.vcxproj]
X509Certificate.obj : error LNK2019: unresolved external symbol _X509_cmp referenced in function "public: bool __thisca
ll Poco::Crypto::X509Certificate::equals(class Poco::Crypto::X509Certificate const &)const " (?equals@X509Certificate@C
rypto@Poco@@QBE_NABV123@@Z) [C:projectexternalspocoCryptoCrypto_vs170.vcxproj]
X509Certificate.obj : error LNK2019: unresolved external symbol _X509_NAME_print_ex referenced in function "class std::
basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl Poco::Crypto::_X509_NAME_oneline_u
tf8(struct X509_name_st *)" (?_X509_NAME_oneline_utf8@Crypto@Poco@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$alloca
tor@D@2@@std@@PAUX509_name_st@@@Z) [C:projectexternalspocoCryptoCrypto_vs170.vcxproj]
X509Certificate.obj : error LNK2019: unresolved external symbol _X509_NAME_get_text_by_NID referenced in function "publ
ic: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall Poco::Crypto::X5
09Certificate::issuerName(enum Poco::Crypto::X509Certificate::NID)const " (?issuerName@X509Certificate@Crypto@Poco@@QBE
?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4NID@123@@Z) [C:projectexter
nalspocoCryptoCrypto_vs170.vcxproj]
X509Certificate.obj : error LNK2019: unresolved external symbol _X509_get_ext_d2i referenced in function "public: void
__thiscall Poco::Crypto::X509Certificate::extractNames(class std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > &,class std::set<class std::basic_string<char,struct std::char_traits<char>,class std::allocato
r<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,cl
ass std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &)const
" (?extractNames@X509Certificate@Crypto@Poco@@QBEXAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV?$
set@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$all
ocator@D@2@@std@@@2@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@5@@Z) [C:Usersoldt
eDocumentsenetenetexternalspocoCryptoCrypto_vs170.vcxproj]
X509Certificate.obj : error LNK2019: unresolved external symbol _PEM_read_bio_X509 referenced in function "protected: v
oid __thiscall Poco::Crypto::X509Certificate::load(class std::basic_istream<char,struct std::char_traits<char> > &)" (?
load@X509Certificate@Crypto@Poco@@IAEXAAV?$basic_istream@DU?$char_traits@D@std@@@std@@@Z) [C:UsersoldteDocumentsene
tenetexternalspocoCryptoCrypto_vs170.vcxproj]
X509Certificate.obj : error LNK2019: unresolved external symbol _PEM_write_bio_X509 referenced in function "public: voi
d __thiscall Poco::Crypto::X509Certificate::save(class std::basic_ostream<char,struct std::char_traits<char> > &)const
" (?save@X509Certificate@Crypto@Poco@@QBEXAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z) [C:UsersoldteDocuments
enetenetexternalspocoCryptoCrypto_vs170.vcxproj]
X509Certificate.obj : error LNK2019: unresolved external symbol _GENERAL_NAMES_free referenced in function "public: voi
d __thiscall Poco::Crypto::X509Certificate::extractNames(class std::basic_string<char,struct std::char_traits<char>,cla
ss std::allocator<char> > &,class std::set<class std::basic_string<char,struct std::char_traits<char>,class std::alloca
tor<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,
class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &)cons
t " (?extractNames@X509Certificate@Crypto@Poco@@QBEXAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV
?$set@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$a
llocator@D@2@@std@@@2@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@5@@Z) [C:Usersol
dteDocumentsenetenetexternalspocoCryptoCrypto_vs170.vcxproj]
..binPocoCrypto.dll : fatal error LNK1120: 160 unresolved externals [C:projectexternalspoc
oCryptoCrypto_vs170.vcxproj]
ERROR: powershell.exe ./buildwin.ps1 -vs 170 -action rebuild -linkmode all -config both -platform Win32 -tool msbuild -omit "DNSSD,DNSSD/Avahi,DNSSD/Bonjour,NetSSL_Win,Data/MySQL,Data/PostgreSQL,JWT" -openssl_base "C:project/externals/opensslbuildx86OpenSSL" failed!
This build system works on other machines but not this one, and it’s not clear why. What is it missing to statically link these two libs for the project? My colleague has provided me with pre-linked libraries for POCO, but that’s not permanently sustainable for me to be able to build the project from scratch.