[Solved][QCA] Missing library for -lqca/-lqca_debug on compile



  • Hi,
    I'm new to Qt. I'm on a new project, which needs a cryptographic library (like openssl, for AES, RSA and md5/sha1). I found QCA and it's plugin QCA-OSSL...

    After almost 2 hours trying to install them with the new QtSDK Beta (QtCreator 2.2), a patch to compile qca-ossl, i'm experiencing some issues on compilation.

    First, I've installed QCA with: @./configure --prefix="/Library/Framework"@
    I found then, that it has installed the framework in: @/Library/Framework/lib/{pkg-
    config,qca.Framework}@

    I've moved the pkg-config to /usr/local/lib/pkg-config (the default ./configure dir).
    Then, for the qca-ossl, it couldn't detecte qca, so i've installed qca with classic ./configure, then qca-ossl with prefix=/Users/max13/QtSDK/Desktop/.../plugins .

    And it worked (then I've deleted the framework created in /usr/local/lib ...

    Now, i'm on my new project, and the compilation fails:
    @g++ -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -o TagPG.app/Contents/MacOS/TagPG main.o mainwindow.o mainmenubar.o dbmanager.o dbmanager_access.o mainwindow_access.o moc_mainwindow.o moc_mainmenubar.o moc_dbmanager.o qrc_res.o -F/Users/max13/QtSDK/Desktop/Qt/472/gcc/lib -L/Users/max13/QtSDK/Desktop/Qt/472/gcc/lib -L/usr/local/lib -lqca_debug -framework QtGui -framework QtCore
    ld: library not found for -lqca_debug
    collect2: ld returned 1 exit status
    make: *** [TagPG.app/Contents/MacOS/TagPG] Error 1
    make: Leaving directory `/Users/max13/Developpement/TagPG-build-desktop'
    Le processus "/usr/bin/make" s'est terminé avec le code 2.
    Erreur à la compilation du projet TagPG (cible : Desktop)
    Lors de l'exécution de l'étape 'Make'@

    :(

    If you need it, here is my .pro header:
    @#INCLUDEPATH += /Library/Frameworks/qca.framework/Headers
    #Commented to see if there is a difference... No differences...

    QT += core gui
    TARGET = TagPG
    TEMPLATE = app

    CONFIG += crypto

    HEADERS += ...@

    Please heeelp :'(
    Thank you.



  • I do not fully understand how the mac frameworks etc work (I do not own a Mac) but it looks like your linker line is missing the appropriate -L<path> flag to allow it to find the qca_debug library.

    The line:

    @CONFIG += crypto@

    in your .pro file should be enough to tell qmake what -I<path>, -L<path>, and -l<lib> directives are needed - it essentially just sources the crypto.prf file that should be in your $QTDIR/mkspecs/features directory after installing qca.

    It looks like either:

    The crypto.prf file is not being found or

    One of your manual moves has moved the qca stuff to somewhere that the linker is not looking for it.

    I see that the linker line does have a -L/usr/local/lib but you then say that you have deleted some framework from this location. Which was it?

    I should get around to buying a mac one day so that I can test on that platform too.



  • [quote author="ZapB" date="1301828412"]

    The crypto.prf file is not being found or

    One of your manual moves has moved the qca stuff to somewhere that the linker is not looking for it.

    [/quote]
    The Crypto "seems" to be found. =/

    [quote author="ZapB" date="1301828412"]
    I see that the linker line does have a -L/usr/local/lib but you then say that you have deleted some framework from this location. Which was it?

    I should get around to buying a mac one day so that I can test on that platform too.[/quote]

    I've manually moved the qca.Framework, from /usr/local/lib (Old system directory) to /Library/Framework (New system directory)

    The head of crypto.prf contains references to the old directory.
    I've commented them as well:
    @#QCA_INCDIR = /usr/local/include
    #QCA_LIBDIR = /usr/local/lib
    QCA_INCDIR = /Library/Frameworks/include
    QCA_LIBDIR = /Library/Frameworks/lib@

    The same errors T_T
    Any other idea ?

    Thank you, by the way.



  • Hi there !

    Finally, I think I've solved my issue alone T_T ...
    In fact, in the crypto.prf, I saw this:
    @mac: {
    framework_dir = $$QCA_LIBDIR
    exists($$framework_dir/qca.framework) {
    #QMAKE_FRAMEWORKPATH *= $$framework_dir
    LIBS += -F$$framework_dir
    INCLUDEPATH += $$framework_dir/qca.framework/Headers
    LINKAGE = -framework qca
    }
    }@
    Which opened my eyes, telling me that the header I've modified is not good.
    As Qt will "use" the QCA_INCDIR to look for QtCrypto, this "define" must point to the "Headers" inside "/qca.framework/".

    THEN !! I saw that it uses the QCA_LIBDIR to find the libs, by adding the same directory as above, to assign it to the "INCLUDEPATH" config...
    So, here is my new crypto.prf head:
    @QCA_INCDIR = /Library/Frameworks/qca.framework/Headers
    QCA_LIBDIR = /Library/Frameworks/
    #QCA_INCDIR = /usr/local/include #Old
    #QCA_LIBDIR = /usr/local/lib #Old@

    No more compiling issue :)
    Thank you for your help anyway =)

    (But I don't change the title to "Solved", because I'mnot sure yet I won't have another issue with that)

    EDIT: BTW, with the earlier QtSDK, Qt's Frameworks are located in: ~/QtSDK/Desktop/Qt/472/gcc/lib/, so... I've moved the qca.framework directory inside it, and changed the QCA_INCDIR & QCA_LIBDIR definition.
    Without doing it, Qt didn't complain on compile, but I had to add "INCLUDEPATH += /Library/Frameworks/qca.framework/Headers" to get the help and the auto-completion.

    Now I'm done :)
    Except that if you want to install (& compile) qca-ossl on a mac, you will need this: http://pastebin.com/nVkaiGWP

    Cheers!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.