Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error compiling Qt5 with openssl linked

Tags:

openssl

qt

My head will explode soon... I want to compile qt with -openssl-linked so the openssl libraries get linked into the qt libraries. I already tried many options and my output when compiling is always:

ssl/qsslcertificate_openssl.cpp: In function ‘uint qHash(const QSslCertificate&, uint)’:
ssl/qsslcertificate_openssl.cpp:63:30: error: invalid use of incomplete type ‘X509 {aka struct x509_st}’
     return qHashBits(x509->sha1_hash, SHA_DIGEST_LENGTH, seed);
                          ^
In file included from /usr/local/include/openssl/crypto.h:131:0,
             from /usr/local/include/openssl/comp.h:59,
             from /usr/local/include/openssl/ssl.h:148,
             from ../../include/QtNetwork/5.5.1/QtNetwork/private/../../../../../src/network/ssl/qsslcontext_openssl_p.h:53,
             from ../../include/QtNetwork/5.5.1/QtNetwork/private/qsslcontext_openssl_p.h:1,
             from ssl/qsslsocket_p.h:55,
             from ssl/qsslsocket_openssl_p.h:63,
             from ssl/qsslsocket_openssl_symbols_p.h:64,
             from ssl/qsslcertificate_openssl.cpp:35:
/usr/local/include/openssl/ossl_typ.h:160:16: note: forward declaration of ‘X509 {aka struct x509_st}’
 typedef struct x509_st X509;

I compiled openssl and tried compiling qt passing my compiled libraries:

OPENSSL_LIBS='-L/opt/openssl_build/lib -lssl -lcrypto' ./configure -prefix /opt/qt5.5.1_linux_staticssl -opensource -confirm-license -release -nomake examples -nomake tests -static -openssl -no-opengl -no-libpng -no-pulseaudio -no-linuxfb -no-gif -no-gstreamer -no-gtkstyle -no-directfb -no-gui -no-eglfs -no-glib -I /opt/openssl_build/include/openssl -L /opt/openssl_build/lib -no-xcb

I know the error seems to be loading the old openssl libraries but I already tried changing that path so it can't find them and force it to load the new ones. I don't know what else to do. The Qt version is 5.5.1 openssl 1.0.1 and g++ 5.2.

like image 613
nicolaszb Avatar asked Feb 18 '16 17:02

nicolaszb


2 Answers

I had to build Qt with the openssl version 1.0.1, don't know if it work with the 1.0.2. I had to change the path of the system's openssl libraries so that Qt was forced to use the ones I made. Lines to compile openssl running at the source's directory:

./config --prefix=/opt/openssl_build_stable -shared
make
make test
sudo make install

My conf line for Qt:

OPENSSL_LIBS='-L/opt/openssl_build_stable/lib -lssl -lcrypto' ./configure -prefix /opt/qt5.5.1_linux_staticssl -opensource -confirm-license -release -nomake examples -nomake tests -static -openssl-linked -I /opt/openssl_build_stable/include/openssl -L /opt/openssl_build_stable/lib

Thanks to simon-warta

like image 194
nicolaszb Avatar answered Oct 02 '22 08:10

nicolaszb


Try ./configure -no-openssl

to bypass openssl altogether, in case you don't need your paraView to talk to another machine.

like image 29
Mars409 Avatar answered Oct 02 '22 07:10

Mars409