Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building Qt with OpenSSL on Ubuntu 16.04.1 fails

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.

like image 691
IronRider Avatar asked Feb 01 '17 20:02

IronRider


1 Answers

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.

like image 193
Fedorov7890 Avatar answered Nov 04 '22 17:11

Fedorov7890