open-license-manager / licensecc

Software licensing, copy protection in C++. It has few dependencies and it's cross-platform.
http://open-license-manager.github.io/licensecc/
BSD 3-Clause "New" or "Revised" License
950 stars 303 forks source link

How use the licensecc in qt project? is there any sample code? #110

Closed kitterive closed 3 years ago

kitterive commented 3 years ago

step1: git clone --recursive https://github.com/open-license-manager/open-license-manager.git

step2: cd open-license-manager/build

step3: cmake .. -G "Visual Studio 15 2017 Win64" -DBOOST_ROOT="C:\local\boost_1_71_0_vs2017" -DCMAKE_INSTALL_PREFIX=../install

step4: cmake --build . --target install --config Release Then I get the library in open-license-manager\install, and copy it to my qt project

step5 I use add library to added it my project

 This is my project pro  file added:

 win32: LIBS += -L$$PWD/thirdparty/licensecc/DEFAULT/ -llicensecc_static

 INCLUDEPATH += $$PWD/thirdparty/include/licensecc/DEFAULT
 DEPENDPATH += $$PWD/thirdparty/include/licensecc/DEFAULT

 win32:!win32-g++: PRE_TARGETDEPS += $$PWD/thirdparty/licensecc/DEFAULT/licensecc_static.lib
 else:win32-g++: PRE_TARGETDEPS += $$PWD/thirdparty/licensecc/DEFAULT/liblicensecc_static.a

step6: I added sample code : https://github.com/open-license-manager/examples/blob/develop/submodule/src/example.cpp into my project , but many sympol can't find When I added openssl library, there many other symbols can't find

error message:

C:\Qt\Qt5.14.2\5.14.2\msvc2017_64\bin\qmake.exe -o Makefile ..\..\..\myDevelop\license\license-test\TrtCalibrationTabeAnalyze\TrtCalibrationTabeAnalyze.pro -spec win32-msvc "CONFIG+=qtquickcompiler"
C:\Qt\Qt5.14.2\Tools\QtCreator\bin\jom.exe -f Makefile.Release
link /NOLOGO /DYNAMICBASE /NXCOMPAT /OPT:REF /INCREMENTAL:NO /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:release\TrtCalibrationTabeAnalyze.exe @C:\Users\guo-win\AppData\Local\Temp\TrtCalibrationTabeAnalyze.exe.4644.15.jom

licensecc_static.lib(signature_verifier.obj) : error LNK2019: 无法解析的外部符号 OPENSSL_init_crypto,该符号在函数 "enum FUNCTION_RETURN cdecl license::os::verify_signature(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?verify_signature@os@license@@YA?AW4FUNCTION_RETURN@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 中被引用 licensecc_static.lib(signature_verifier.obj) : error LNK2019: 无法解析的外部符号 BIO_set_flags,该符号在函数 "enum FUNCTION_RETURN cdecl license::os::verify_signature(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?verify_signature@os@license@@YA?AW4FUNCTION_RETURN@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 中被引用 licensecc_static.lib(signature_verifier.obj) : error LNK2019: 无法解析的外部符号 BIO_new,该符号在函数 "enum FUNCTION_RETURN cdecl license::os::verify_signature(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?verify_signature@os@license@@YA?AW4FUNCTION_RETURN@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 中被引用 licensecc_static.lib(signature_verifier.obj) : error LNK2019: 无法解析的外部符号 BIO_free,该符号在函数 "enum FUNCTION_RETURN __cdecl license::os::verify_signature(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?verify_signature@os@license@@YA?AW4FUNCTION_RETURN@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 中被引用 licensecc_static.lib(signature_verifier.obj) : error LNK2019: 无法解析的外部符号 BIO_read,该符号在函数 "enum FUNCTION_RETURN cdecl license::os::verify_signature(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?verify_signature@os@license@@YA?AW4FUNCTION_RETURN@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 中被引用 licensecc_static.lib(signature_verifier.obj) : error LNK2019: 无法解析的外部符号 BIO_push,该符号在函数 "enum FUNCTION_RETURN cdecl license::os::verify_signature(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?verify_signature@os@license@@YA?AW4FUNCTION_RETURN@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 中被引用 licensecc_static.lib(signature_verifier.obj) : error LNK2019: 无法解析的外部符号 BIO_free_all,该符号在函数 "enum FUNCTION_RETURN cdecl license::os::verify_signature(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?verify_signature@os@license@@YA?AW4FUNCTION_RETURN@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 中被引用 licensecc_static.lib(signature_verifier.obj) : error LNK2019: 无法解析的外部符号 BIO_new_mem_buf,该符号在函数 "enum FUNCTION_RETURN cdecl license::os::verify_signature(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?verify_signature@os@license@@YA?AW4FUNCTION_RETURN@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 中被引用 licensecc_static.lib(signature_verifier.obj) : error LNK2019: 无法解析的外部符号 EVP_MD_CTX_new,该符号在函数 "enum FUNCTION_RETURN __cdecl license::os::verify_signature(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?verify_signature@os@license@@YA?AW4FUNCTION_RETURN@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 中被引用 licensecc_static.lib(signature_verifier.obj) : error LNK2019: 无法解析的外部符号 EVP_MD_CTX_free,该符号在函数 "enum FUNCTION_RETURN cdecl license::os::verify_signature(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?verify_signature@os@license@@YA?AW4FUNCTION_RETURN@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 中被引用 licensecc_static.lib(signature_verifier.obj) : error LNK2019: 无法解析的外部符号 EVP_DigestUpdate,该符号在函数 "enum FUNCTION_RETURN cdecl license::os::verify_signature(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?verify_signature@os@license@@YA?AW4FUNCTION_RETURN@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 中被引用 licensecc_static.lib(signature_verifier.obj) : error LNK2019: 无法解析的外部符号 EVP_DigestVerifyInit,该符号在函数 "enum FUNCTION_RETURN __cdecl license::os::verify_signature(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?verify_signature@os@license@@YA?AW4FUNCTION_RETURN@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 中被引用 licensecc_static.lib(signature_verifier.obj) : error LNK2019: 无法解析的外部符号 EVP_DigestVerifyFinal,该符号在函数 "enum FUNCTION_RETURN cdecl license::os::verify_signature(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?verify_signature@os@license@@YA?AW4FUNCTION_RETURN@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 中被引用 licensecc_static.lib(signature_verifier.obj) : error LNK2019: 无法解析的外部符号 BIO_f_base64,该符号在函数 "enum FUNCTION_RETURN cdecl license::os::verify_signature(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?verify_signature@os@license@@YA?AW4FUNCTION_RETURN@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 中被引用 licensecc_static.lib(signature_verifier.obj) : error LNK2019: 无法解析的外部符号 EVP_sha256,该符号在函数 "enum FUNCTION_RETURN cdecl license::os::verify_signature(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?verify_signature@os@license@@YA?AW4FUNCTION_RETURN@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 中被引用 licensecc_static.lib(signature_verifier.obj) : error LNK2019: 无法解析的外部符号 EVP_PKEY_assign,该符号在函数 "enum FUNCTION_RETURN cdecl license::os::verify_signature(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?verify_signature@os@license@@YA?AW4FUNCTION_RETURN@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 中被引用 licensecc_static.lib(signature_verifier.obj) : error LNK2019: 无法解析的外部符号 EVP_PKEY_new,该符号在函数 "enum FUNCTION_RETURN cdecl license::os::verify_signature(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?verify_signature@os@license@@YA?AW4FUNCTION_RETURN@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 中被引用 licensecc_static.lib(signature_verifier.obj) : error LNK2019: 无法解析的外部符号 EVP_PKEY_free,该符号在函数 "enum FUNCTION_RETURN cdecl license::os::verify_signature(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?verify_signature@os@license@@YA?AW4FUNCTION_RETURN@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 中被引用 licensecc_static.lib(signature_verifier.obj) : error LNK2019: 无法解析的外部符号 d2i_RSAPublicKey_bio,该符号在函数 "enum FUNCTION_RETURN __cdecl license::os::verify_signature(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?verify_signature@os@license@@YA?AW4FUNCTION_RETURN@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 中被引用 licensecc_static.lib(signature_verifier.obj) : error LNK2019: 无法解析的外部符号 ERR_load_ERR_strings,该符号在函数 "enum FUNCTION_RETURN cdecl license::os::verify_signature(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?verify_signature@os@license@@YA?AW4FUNCTION_RETURN@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 中被引用 release\TrtCalibrationTabeAnalyze.exe : fatal error LNK1120: 20 个无法解析的外部命令 jom: F:\private\MyCourse\tensorRT\build-TrtCalibrationTabeAnalyze-Desktop_Qt_5_14_2_MSVC2017_64bit-Release\Makefile.Release [release\TrtCalibrationTabeAnalyze.exe] Error 1120 jom: F:\private\MyCourse\tensorRT\build-TrtCalibrationTabeAnalyze-Desktop_Qt_5_14_2_MSVC2017_64bit-Release\Makefile [release] Error 2 09:46:49: 进程"C:\Qt\Qt5.14.2\Tools\QtCreator\bin\jom.exe"退出,退出代码 2 。 Error while building/deploying project TrtCalibrationTabeAnalyze (kit: Desktop Qt 5.14.2 MSVC2017 64bit) When executing step "Make" 09:46:49: Elapsed time: 00:01.

gcontini commented 3 years ago

Hi there is a forum for this project, i know it's on Google and you can't access from China unless you have a VPN but these kind of questions shouldn't really be opened as issues. What is a free discussion space accessible to Chinese users (that doesn't require to use my mobile phone)?

The project has easy installation scripts for cmake only. Other build systems are not supported, sorry. For windows you can compile it without openssl. This will solve your dependency issues.

kitterive commented 3 years ago

Thanks , I will close this topic . I compiled it without openssl ,But there is still this problem。

gcontini commented 3 years ago

maybe cmake is finding openssl somewhere in your pc and it's still linking against it. please include the output of the configuration step of cmake (in your issue step 3) (remember to clean the build directory before running cmake)

kitterive commented 3 years ago

How to confie step of cmake(step 3) , I modified CMakeLists.txt from line 38 to 43 like this `SET (OPENSSL_USE_STATIC_LIBS FALSE) IF(${STATIC_RUNTIME}) SET(OPENSSL_MSVC_STATIC_RT FALSE) ENDIF(${STATIC_RUNTIME})

find_package(OpenSSL COMPONENTS Crypto QUIET)

SET(OPENSSL_FOUND FALSE)`

There is still this problem

gcontini commented 3 years ago

try to remove completely the find_package(OpenSSL ...) line.

kitterive commented 3 years ago

Thanks , The reason is that there is no link library Bcrypt.dll

gcontini commented 3 years ago

could you be more specific on your fix? so you just removed "-lbcrypt" and it worked? (CmakeLists.txt line 96)?