QT console application with Crypto++ library

和自甴很熟 提交于 2019-12-11 08:47:05

问题


This is driving me nuts. Using crypto++ ver 5.6.2. Qt 5.2.1 on Mac OSX. All the projects are built inside QT Creator. Im not using make from the command line

I build crypto++ by unpacking and building as follow:

  1. qmake -project
  2. Deleted the GNUmakefile
  3. Open in QT and modified the .pro file by adding

    macx {
        DEFINES += CRYPTOPP_DISABLE_ASM
    }
    

The target is cryptopp:

TARGET = cryptopp

Set to release, ran qmake and did a rebuild all. The dylibs get generated:

  • libcryptopp.1.0.0.dylib
  • libcryptopp.1.0.dylib (Alias)
  • libcryptopp.1.dylib (Alias)
  • libcryptopp.dylib (Alias)

Created a bare console application and included my crypto class. Modified the .pro file as follow:

macx {

    # CONFIG += release cryptopp
    LIBS += /Users/adviner/Qt5.2.1/5.2.1/clang_64/lib/libcryptopp.1.0.0.dylib

    QMAKE_POST_LINK += install_name_tool -change libcryptopp.1.0.0.dylib $$[QT_INSTALL_LIBS]/libcryptopp.1.0.0.dylib $(TARGET)
}

In the console test app in debug mode. Ran qmake and then rebuild all. I keep getting the following error:

:-1: error: symbol(s) not found for architecture x86_64
:-1: error: linker command failed with exit code 1 (use -v to see invocation)

I've checked both the projects and they both include x86_64) in the qmake build steps:

cryptopp lib:
qmake /Users/myname/Projects/QTLibs/Source/crypto/cryptopp562/cryptopp562.pro -r -spec macx-clang CONFIG+=x86_64

Test console app:

qmake /Users/myname/Projects/Test/CryptoTest/CryptoTest.pro -r -spec macx-clang CONFIG+=debug CONFIG+=x86_64 CONFIG+=declarative_debug CONFIG+=qml_debug

Ive done some google search but nothing seems to answer my problem. Any ideas? I have built the same crypto++ lib on windows using Qt 5.2.1 and used in my app with no problems.


回答1:


OK i finally figured it out. When I built the crypto++ lib on the Mac I added as described above:

macx {
    DEFINES += CRYPTOPP_DISABLE_ASM
}

Well on the console application I had to also add this in the .pro file and it works now

I found the following tip also to modify

/Users/adviner/Qt5.2.1/5.2.1/clang_64/mkspecs/macx-clang/qmake.conf

From QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6

To QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9

But it didnt do anything for me.

Only solution was to put on both lib and test the CRYPTOPP_DISABLE_ASM



来源:https://stackoverflow.com/questions/23702414/qt-console-application-with-crypto-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!