7
votes

I have almost spent a week trying to build Qt5.8.0 with OpenSSL on Ubuntu 16.04.1 x64.

First of all I downloaded sources of OpenSSL v1.0.2k. Then I configured it with command

./Configure --prefix=$PWD/dist -shared linux-x86_64

Then I run theese commands one by one:

make depend
make
make install

So I got Openssl installed in /home/user/openssl-OpenSSL_1.0.2k/dist

Then I downloaded Qt from official website, and installed it with sources, so the sources are situated in /home/user/Qt5.8.0/5.8/Src Then I tried to configure it with command

OPENSSL_LIBS='-L/home/user/openssl-OpenSSL_1_0_2k/dist/lib -lssl -lcrypto' ./configure -prefix /home/user/qt5_static -opensource -confirm-license -release -nomake examples -nomake tests -static -openssl-linked -I /home/user/openssl-OpenSSL_1_0_2k/dist/include/openssl -L /home/user/openssl-OpenSSL_1_0_2k/dist/lib

But got theese errors:

ERROR: Feature 'openssl' was enabled, but the pre-condition '!features.securetransport && tests.openssl' failed.

ERROR: Feature 'openssl-linked' was enabled, but the pre-condition 'features.openssl && libs.openssl' failed.

What am I doing wrong, and how to fix this issue?

Thank you in advance, and sorry for my bad english.

1
How did you fetch Qt? I've got a Ubuntu 16 VM running, and I can take a quick look if you provide the steps that relate to Qt. Also, ./Configure ... linux-x86_64 is probably not needed because it will be guessed correctly. You should also consider adding enable-ec_nistp_64_gcc_128 if it applies. Also see Compilation and Installation on the OpenSSL wiki.jww

1 Answers

4
votes

I had same problem when trying to link openSSL statically and found following solution:

1) Install openSSL

sudo apt-get update && sudo apt-get install libssl-dev

2) Configure and build qt from sources, including -openssl-linked option, my example configuration:

/home/someuser/Qt/5.8/Src/configure -c++std c++11 -static -release -platform linux-g++-64 -prefix /home/someuser/Qt/StaticRelease58 -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -qt-xcb -make libs -openssl-linked -nomake tools -nomake examples -nomake tests -opensource -confirm-license -skip qtwayland -skip qtwebview -skip qtwebengine -skip qtwebchannel -no-qml-debug

Note that to build QT statically, you also must have installed other packages described here:

http://doc.qt.io/qt-5/linux-requirements.html

http://doc.qt.io/qt-5/linux-deployment.html

P.S. Linking dynamically to openSSL from QT5.8 works fine for me with default setup.