2014-12-18 3 views
1

Вот предисловие - у меня есть приложение C++ + Qt, оно состоит из нескольких проектов, и мы используем MSVC 2012 для его создания. Теперь я реализую скрипты сборки, чтобы начать развертывание сервера сборки. Итак, я начал создавать файлы Qt .pro для каждого проекта, который у нас есть.Ошибки компоновщика при построении DLL в зависимости от статического lib Crypto ++

Теперь проблема - мы используем Crypto ++ библиотека (http://www.cryptopp.com/), который мы строим из исходного кода, а выход является статическим Пб и у нас есть DLL, которая зависит от cryptlib.lib.

Я написал файл .pro для Cryptlib и я могу построить его с помощью QMAKE/ЛОМ

QT   -= core gui 
QMAKE_CFLAGS += /Zc:wchar_t 

TEMPLATE = lib 
TARGET = cryptlib 

Release:DESTDIR = ./Release 
Debug:DESTDIR = ./Debug 

CONFIG += staticlib precompile_header 
DEFINES += _USING_V110_SDK71_ WINVER=0x0501 WIN32 _WINDOWS _MBCS 
DEFINES -= UNICODE 

PRECOMPILED_HEADER = pch.h 
DEPENDPATH += . 

include(CryptoPP.pri)@ 

Я написал файл .pro для моей DLL - это нормально компилируется, , но я получаю линкер ошибки на этапе связи. Самое интересное, что когда я строю cryptlib с MSVC2012 и , тогда строит DLL с qmake - тогда он свяжется OK.

Что может быть неправильным? Я проверил все настройки proj в проектах MSVC и применил их в своих файлах. Я проверил имена, искаженные в обеих библиотеках, созданных с помощью MSVC, а QT - искаженные имена выглядят одинаково. Теперь я застрял

@# ---------------------------------------------------- 
# This file is generated by the Qt Visual Studio Add-in. 
# ------------------------------------------------------ 

QT   -= gui core 
QMAKE_CFLAGS += /Zc:wchar_t 

TEMPLATE = lib 
TARGET = PSGLicensing 

Release:DESTDIR = ./Release 
Debug:DESTDIR = ./Debug 

CONFIG += dll 
DEFINES += _AFXDLL _USING_V110_SDK71_ WIN32 _WINDOWS _WINDLL _USRDLL DLL_LIBRARY PSGLICENSING_DLL_BUILD _MBCS _VC80_UPGRADE=0x0710 
DEFINES -= UNICODE 

PRECOMPILED_HEADER = stdafx.h 
DEPENDPATH += . 

win32:CONFIG(release, debug|release): LIBS += -L$$_PRO_FILE_PWD_/../CryptoPP/Release/ -lcryptlib 
else:win32:CONFIG(debug, debug|release): LIBS += -L$$_PRO_FILE_PWD_/../CryptoPP/Debug/ -lcryptlib 

INCLUDEPATH += $$_PRO_FILE_PWD_/../CryptoPP/ 
DEPENDPATH += $$_PRO_FILE_PWD_/../CryptoPP/ 

win32:CONFIG(release, debug|release): PRE_TARGETDEPS += $$_PRO_FILE_PWD_/../CryptoPP/Release/cryptlib.lib 
else:win32:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$_PRO_FILE_PWD_/../CryptoPP/Debug/cryptlib.lib 

include(PSGLicensing.pri)@ 

В MSVC2012 мы имеем следующие параметры для

CryptLib

*Compiler:* /Yu"pch.h" /GS /GL /analyze- /W3 /Gy- /Zc:wchar_t /Zi /Gm- /O2 /Ob2 /Fd"Release\vc110.pdb" /fp:precise /Zp1 /D "_USING_V110_SDK71_" /D "NDEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /D "WINVER=0x0501" /D "_VC80_UPGRADE=0x0710" /errorReport:prompt /GF- /WX- /Zc:forScope /arch:SSE /Gd /Oy /Oi /MD /Fa"Release\" /EHsc /nologo /Fo"Release\" /Fp"Release\cryptlib.pch" 

*Linker:* /OUT:"SecretPath\CryptoPP\Release\cryptlib.lib" /LTCG /NOLOGO 

и вот настройки для DLL

*Compiler*: /Yu"stdafx.h" /GS /analyze- /W3 /Zc:wchar_t /I"SecretPath\PSGLicensing\IncludeExp" /Zi /Gm- /O2 /Fd"Release\vc110.pdb" /fp:precise /D "_USING_V110_SDK71_" /D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "_USRDLL" /D "PSGLICENSING_DLL_BUILD" /D "_VC80_UPGRADE=0x0710" /D "_WINDLL" /D "_MBCS" /D "_AFXDLL" /errorReport:prompt /WX- /Zc:forScope /Gd /Oy- /MD /Fa"Release\" /EHsc /nologo /Fo"Release\" /Fp"Release\PSGLicensing.pch" 

*Linker:* /OUT:"SecretPah\PSGLicensing\Release\PSGLicensing.dll" /MANIFEST /PDB:"SecretPath\PSGLicensing\Release\PSGLicensing.pdb" /DYNAMICBASE:NO "..\CryptoPP\Release\cryptlib.lib" "SecretPath\CryptoPP\Release\cryptlib.lib" /DEF:".\PSGLicensing.def" /IMPLIB:"SecretPath\PSGLicensing\Release\PSGLicensing.lib" /DEBUG /DLL /MACHINE:X86 /OPT:REF /SAFESEH /INCREMENTAL:NO /PGD:"SecretPath\PSGLicensing\Release\PSGLicensing.pgd" /SUBSYSTEM:WINDOWS",5.01" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"Release\PSGLicensing.dll.intermediate.manifest" /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /TLBID:1 

Вот ЛОМ ВЫХОДНОЙ ut

@ C:\Qt\Qt5.2.1\Tools\QtCreator\bin\jom.exe -f Makefile.Release 
    link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /DLL /MANIFEST /MANIFESTFILE:Release\PSGLicensing.dll.embed.manifest /OUT:Release\PSGLicensing.dll @C:\Users\ANDRIY~1.GLO\AppData\Local\Temp\PSGLicensing.dll.6212.16.jom 
    Creating library Release\PSGLicensing.lib and object Release\PSGLicensing.exp 
GenerateRandomBlock.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::CFB_CipherTemplate<class CryptoPP::AbstractPolicyHolder<class CryptoPP::CFB_CipherAbstractPolicy,class CryptoPP::CFB_ModePolicy> >::ProcessData(unsigned char *,unsigned char const *,unsigned int)" ([email protected][email protected][email protected][email protected]@@[email protected]@@[email protected]@@[email protected]@[email protected]) 
GenerateRandomBlock.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::CFB_CipherTemplate<class CryptoPP::AbstractPolicyHolder<class CryptoPP::CFB_CipherAbstractPolicy,class CryptoPP::CFB_ModePolicy> >::Resynchronize(unsigned char const *,int)" ([email protected][email protected][email protected][email protected]@@[email protected]@@[email protected]@@[email protected]@[email protected]) 
GenerateRandomBlock.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall CryptoPP::CFB_CipherTemplate<class CryptoPP::AbstractPolicyHolder<class CryptoPP::CFB_CipherAbstractPolicy,class CryptoPP::CFB_ModePolicy> >::UncheckedSetKey(unsigned char const *,unsigned int,class CryptoPP::NameValuePairs const &)" ([email protected][email protected][email protected][email protected]@@[email protected]@@[email protected]@@[email protected]@[email protected]@@Z) 
GenerateRandomBlock.obj : error LNK2001: unresolved external symbol "private: virtual void __thiscall CryptoPP::CFB_EncryptionTemplate<class CryptoPP::AbstractPolicyHolder<class CryptoPP::CFB_CipherAbstractPolicy,class CryptoPP::CFB_ModePolicy> >::CombineMessageAndShiftRegister(unsigned char *,unsigned char *,unsigned char const *,unsigned int)" ([email protected][email protected][email protected][email protected]@@[email protected]@@[email protected]@@[email protected]@[email protected]) 
cryptlib.lib(rsa.obj) : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::Update(unsigned char const *,unsigned int)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) 
LicensingEx.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::Update(unsigned char const *,unsigned int)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) 
cryptlib.lib(randpool.obj) : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::Update(unsigned char const *,unsigned int)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) 
cryptlib.lib(md5.obj) : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::Update(unsigned char const *,unsigned int)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) 
cryptlib.lib(integer.obj) : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::Update(unsigned char const *,unsigned int)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) 
cryptlib.lib(rsa.obj) : error LNK2001: unresolved external symbol "public: virtual unsigned char * __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::CreateUpdateSpace(unsigned int &)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) 
LicensingEx.obj : error LNK2001: unresolved external symbol "public: virtual unsigned char * __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::CreateUpdateSpace(unsigned int &)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) 
cryptlib.lib(randpool.obj) : error LNK2001: unresolved external symbol "public: virtual unsigned char * __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::CreateUpdateSpace(unsigned int &)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) 
cryptlib.lib(md5.obj) : error LNK2001: unresolved external symbol "public: virtual unsigned char * __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::CreateUpdateSpace(unsigned int &)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) 
cryptlib.lib(integer.obj) : error LNK2001: unresolved external symbol "public: virtual unsigned char * __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::CreateUpdateSpace(unsigned int &)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) 
cryptlib.lib(rsa.obj) : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::Restart(void)" ([email protected][email protected]@[email protected]@@[email protected]@UAEXXZ) 
LicensingEx.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::Restart(void)" ([email protected][email protected]@[email protected]@@[email protected]@UAEXXZ) 
cryptlib.lib(randpool.obj) : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::Restart(void)" ([email protected][email protected]@[email protected]@@[email protected]@UAEXXZ) 
cryptlib.lib(md5.obj) : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::Restart(void)" ([email protected][email protected]@[email protected]@@[email protected]@UAEXXZ) 
cryptlib.lib(integer.obj) : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::Restart(void)" ([email protected][email protected]@[email protected]@@[email protected]@UAEXXZ) 
cryptlib.lib(rsa.obj) : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::TruncatedFinal(unsigned char *,unsigned int)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) 
LicensingEx.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::TruncatedFinal(unsigned char *,unsigned int)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) 
cryptlib.lib(randpool.obj) : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::TruncatedFinal(unsigned char *,unsigned int)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) 
cryptlib.lib(md5.obj) : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::TruncatedFinal(unsigned char *,unsigned int)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) 
cryptlib.lib(integer.obj) : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::TruncatedFinal(unsigned char *,unsigned int)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) 
LicensingEx.obj : error LNK2001: unresolved external symbol "protected: virtual unsigned int __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::HashMultipleBlocks(unsigned int const *,unsigned int)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) 
cryptlib.lib(md5.obj) : error LNK2001: unresolved external symbol "protected: virtual unsigned int __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::HashMultipleBlocks(unsigned int const *,unsigned int)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) 
cryptlib.lib(integer.obj) : error LNK2001: unresolved external symbol "protected: virtual unsigned int __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::HashMultipleBlocks(unsigned int const *,unsigned int)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) 
cryptlib.lib(rsa.obj) : error LNK2001: unresolved external symbol "protected: virtual unsigned int __thiscall CryptoPP::IteratedHashBase<unsigned int,class CryptoPP::HashTransformation>::HashMultipleBlocks(unsigned int const *,unsigned int)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) 
cryptlib.lib(integer.obj) : error LNK2001: unresolved external symbol "public: virtual class CryptoPP::Integer __thiscall CryptoPP::AbstractGroup<class CryptoPP::Integer>::ScalarMultiply(class CryptoPP::Integer const &,class CryptoPP::Integer const &)const " ([email protected][email protected]@[email protected]@@[email protected]@[email protected]@[email protected]@Z) 
cryptlib.lib(rsa.obj) : error LNK2001: unresolved external symbol "public: virtual class CryptoPP::Integer __thiscall CryptoPP::AbstractGroup<class CryptoPP::Integer>::ScalarMultiply(class CryptoPP::Integer const &,class CryptoPP::Integer const &)const " ([email protected][email protected]@[email protected]@@[email protected]@[email protected]@[email protected]@Z) 
cryptlib.lib(integer.obj) : error LNK2001: unresolved external symbol "public: virtual class CryptoPP::Integer __thiscall CryptoPP::AbstractGroup<class CryptoPP::Integer>::CascadeScalarMultiply(class CryptoPP::Integer const &,class CryptoPP::Integer const &,class CryptoPP::Integer const &,class CryptoPP::Integer const &)const " ([email protected][email protected]@[email protected]@@[email protected]@[email protected]@[email protected]@Z) 
cryptlib.lib(rsa.obj) : error LNK2019: unresolved external symbol "public: virtual class CryptoPP::Integer __thiscall CryptoPP::AbstractGroup<class CryptoPP::Integer>::CascadeScalarMultiply(class CryptoPP::Integer const &,class CryptoPP::Integer const &,class CryptoPP::Integer const &,class CryptoPP::Integer const &)const " ([email protected][email protected]@[email protected]@@[email protected]@[email protected]@[email protected]@Z) referenced in function "public: class CryptoPP::GetValueHelperClass<class CryptoPP::InvertibleRSAFunction,class CryptoPP::RSAFunction> & __thiscall CryptoPP::GetValueHelperClass<class CryptoPP::InvertibleRSAFunction,class CryptoPP::RSAFunction>::operator()<class CryptoPP::Integer>(char const *,class CryptoPP::Integer const & (__thiscall CryptoPP::InvertibleRSAFunction::*)(void)const)" ([email protected]@@@[email protected]@[email protected]@[email protected]@@[email protected]@[email protected]@[email protected]@[email protected]@Z) 
cryptlib.lib(integer.obj) : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::AbstractGroup<class CryptoPP::Integer>::SimultaneousMultiply(class CryptoPP::Integer *,class CryptoPP::Integer const &,class CryptoPP::Integer const *,unsigned int)const " ([email protected][email protected]@[email protected]@@[email protected]@[email protected]@[email protected]@[email protected]) 
cryptlib.lib(rsa.obj) : error LNK2019: unresolved external symbol "public: virtual void __thiscall CryptoPP::AbstractGroup<class CryptoPP::Integer>::SimultaneousMultiply(class CryptoPP::Integer *,class CryptoPP::Integer const &,class CryptoPP::Integer const *,unsigned int)const " ([email protected][email protected]@[email protected]@@[email protected]@[email protected]@[email protected]@[email protected]) referenced in function "public: void __thiscall CryptoPP::InvertibleRSAFunction::Initialize(class CryptoPP::Integer const &,class CryptoPP::Integer const &,class CryptoPP::Integer const &)" ([email protected]@[email protected]@[email protected]@[email protected]) 
cryptlib.lib(integer.obj) : error LNK2019: unresolved external symbol "public: virtual class CryptoPP::Integer __thiscall CryptoPP::AbstractRing<class CryptoPP::Integer>::Exponentiate(class CryptoPP::Integer const &,class CryptoPP::Integer const &)const " ([email protected][email protected]@[email protected]@@[email protected]@[email protected]@[email protected]@Z) referenced in function "class CryptoPP::Integer __cdecl CryptoPP::a_exp_b_mod_c(class CryptoPP::Integer const &,class CryptoPP::Integer const &,class CryptoPP::Integer const &)" ([email protected]@@[email protected]@[email protected]@Z) 
cryptlib.lib(rsa.obj) : error LNK2001: unresolved external symbol "public: virtual class CryptoPP::Integer __thiscall CryptoPP::AbstractRing<class CryptoPP::Integer>::Exponentiate(class CryptoPP::Integer const &,class CryptoPP::Integer const &)const " ([email protected][email protected]@[email protected]@@[email protected]@[email protected]@[email protected]@Z) 
cryptlib.lib(integer.obj) : error LNK2019: unresolved external symbol "public: virtual class CryptoPP::Integer __thiscall CryptoPP::AbstractRing<class CryptoPP::Integer>::CascadeExponentiate(class CryptoPP::Integer const &,class CryptoPP::Integer const &,class CryptoPP::Integer const &,class CryptoPP::Integer const &)const " ([email protected][email protected]@[email protected]@@[email protected]@[email protected]@[email protected]@Z) referenced in function "public: virtual class CryptoPP::Integer __thiscall CryptoPP::ModularArithmetic::CascadeExponentiate(class CryptoPP::Integer const &,class CryptoPP::Integer const &,class CryptoPP::Integer const &,class CryptoPP::Integer const &)const " ([email protected]@[email protected]@[email protected]@[email protected]@Z) 
cryptlib.lib(integer.obj) : error LNK2019: unresolved external symbol "public: virtual void __thiscall CryptoPP::AbstractRing<class CryptoPP::Integer>::SimultaneousExponentiate(class CryptoPP::Integer *,class CryptoPP::Integer const &,class CryptoPP::Integer const *,unsigned int)const " ([email protected][email protected]@[email protected]@@[email protected]@[email protected]@[email protected]@[email protected]) referenced in function "public: virtual void __thiscall CryptoPP::ModularArithmetic::SimultaneousExponentiate(class CryptoPP::Integer *,class CryptoPP::Integer const &,class CryptoPP::Integer const *,unsigned int)const " ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
cryptlib.lib(integer.obj) : error LNK2001: unresolved external symbol "public: virtual class CryptoPP::Integer const & __thiscall CryptoPP::AbstractEuclideanDomain<class CryptoPP::Integer>::Gcd(class CryptoPP::Integer const &,class CryptoPP::Integer const &)const " ([email protected][email protected]@[email protected]@@[email protected]@[email protected]@[email protected]@Z) 
Release\PSGLicensing.dll : fatal error LNK1120: 16 unresolved externals 
@ 
+1

Это не решение проблемы, но я настоятельно рекомендую переключиться на CMake. Это просто облегчает жизнь. – juzzlin

+0

Во-первых, qmake не будет компилировать/ссылаться. Он создаст Makefile. Команда link не получает переданную библиотеку. Поэтому он не найдет требуемые символы. Я не вижу '' LIBS + = ... '' в сгенерированном профиле, может вам придется добавить крипто-библиотеку в нужные библиотеки в msv-studio? –

+0

@juzzlin Легче - это очень субъективная точка зрения. Если вся инфраструктура построена вокруг qmake и традиционной настройки, использование cmake - это большая работа. Это также требует чтения в cmake. Я предпочитаю традиционную установку в настоящее время, и я всегда расстроен, если мне приходится устанавливать cmake ... –

ответ

1

Вот версия .pro файла для CryptLib, с помощью которого построена библиотека.

QT   -= core gui 
QMAKE_CFLAGS += /Zc:wchar_t /GL 

TEMPLATE = lib 
TARGET = cryptlib 

Release:DESTDIR = ./Release 
Debug:DESTDIR = ./Debug 

CONFIG += staticlib 
DEFINES += _USING_V110_SDK71_ WINVER=0x0501 WIN32 _WINDOWS _MBCS USE_PRECOMPILED_HEADERS 
DEFINES -= UNICODE 

DEPENDPATH += . 

include(CryptoPP.pri) 

Таким образом, все, что я сделал добавлен USE_PRECOMPILED_HEADERS к DEFINES и удалены PRECOMPILED_HEADER_FILE = pch.h. Я не знаю, как это помогло, но это помогло.