我花了一周的时间尝试在Ubuntu 16.04.1 x64上使用OpenSSL构建Qt5.8.0.
首先,我下载了OpenSSL v1.0.2k的源代码.然后我用命令配置它
./Configure --prefix=$PWD/dist -shared Linux-x86_64
然后我逐个运行theese命令:
make depend
make
make install
所以我在/home/user/openssl-OpenSSL_1.0.2k/dist中安装了Openssl
然后我从官方网站下载了Qt,并安装了源代码,因此源代码位于/home/user/Qt5.8.0/5.8/Src
然后我尝试用命令配置它
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
但得到了错误:
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.
我做错了什么,以及如何解决这个问题?
提前谢谢你,抱歉我的英语不好.
尝试静态链接openSSL并找到以下解决方案时遇到同样的问题:
1)安装openSSL
sudo apt-get update && sudo apt-get install libssl-dev
2)从源配置和构建qt,包括-openssl-linked选项,我的示例配置:
/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
请注意,要静态构建QT,您还必须安装此处描述的其他包:
http://doc.qt.io/qt-5/Linux-requirements.html
http://doc.qt.io/qt-5/Linux-deployment.html
附:使用默认设置,从QT5.8动态链接到openSSL可以正常工作.