wasp256
wasp256

Reputation: 6242

qt crypto QCA is not compiling

I have installed the following qca packages for qca under Ubuntu 15.04:

  qca2-utils       
  qca-qt5-2-utils
  libqca2                    
  libqca2-plugin-cyrus-sasl  
  libqca2-plugins            
  libqca-qt5-2-dev
  libqca2-dbg                
  libqca2-plugin-gnupg       
  libqca-qt5-2               
  libqca-qt5-2-plugins
  libqca2-dev                
  libqca2-plugin-ossl        
  libqca-qt5-2-dbg

When running the command dpkg -L libqca2 I get the following:

 /.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libqca.so.2.1.0
/usr/share
/usr/share/doc
/usr/share/doc/libqca2
/usr/share/doc/libqca2/copyright
/usr/share/doc/libqca2/changelog.Debian.gz
/usr/lib/x86_64-linux-gnu/libqca.so.2

The .pro file contains the entry:

CONFIG += c++11 crypto

and in the main.cpp I have:

 #include <Qca-qt5/QtCrypto/QtCrypto>
 #include <QtCrypto/QtCrypto>

 int main(int argc, char *argv[]) {

         QCA::Initializer init;

         return 0;
  }

But I get the error

     /main.cpp:37: error: undefined reference to `QCA::Initializer::Initializer(QCA::MemoryMode, int)'

Is there anything else I need to install or add in the .pro file?

EDIT: Ok the comilation error could be solved but now I get Segmentation fault when calling QCA::Initializer init;

enter image description here

Upvotes: 0

Views: 1239

Answers (2)

chris
chris

Reputation: 1

LIBS += -L/usr/lib/x86_64-linux-gnu
LIBS += -lqca-qt5_LIBNAME

Upvotes: -1

Simon Warta
Simon Warta

Reputation: 11418

That is a link error, i.e. the headers are found, your code compiles but than the linker cannot create the final binary from your .o files and the libqca2 library.

You need to tell the linker that it should look for libqca. This is typically done by adding to the .pro (untested):

LIBS += -lqca

I don't know what CONFIG += crypto does because I never came across other config values than the ones documented here: http://doc.qt.io/qt-5/qmake-variable-reference.html#config and all Qt modules (including automatic linking) goes via the QT variable, e.g. QT += core gui widgets.


Ubuntu's libqca2 is Qt 4 only!

Regarding your segmentation fault: I think the problem is that libqca2 is made for Qt 4 and you are using Qt 5 (right?).

You can confirm that libqca requires Qt 4 here: http://packages.ubuntu.com/vivid/libqca2

I don't know if QCA is still maintained. So you might need to use it with Qt 4 or look for an alternative.

You might be able to compile QCA for Qt 5 yourself, but this is going to require advanced build system knowledge: https://github.com/JPNaude/dev_notes/wiki/Using-the-Qt-Cryptographic-Architecture-with-Qt5

Upvotes: 2

Related Questions