简体   繁体   English

在Ubuntu 16.04.1上使用OpenSSL构建Qt失败

[英]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. 我几乎花了一周的时间尝试在Ubuntu 16.04.1 x64上使用OpenSSL构建Qt5.8.0。

First of all I downloaded sources of OpenSSL v1.0.2k. 首先,我下载了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: 然后我逐个运行theese命令:

make depend
make
make install

So I got Openssl installed in /home/user/openssl-OpenSSL_1.0.2k/dist 所以我在/home/user/openssl-OpenSSL_1.0.2k/dist中安装了Openssl

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 然后我从官方网站下载了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

But got theese errors: 但得到了错误:

ERROR: Feature 'openssl' was enabled, but the pre-condition '!features.securetransport && tests.openssl' failed. 错误:功能'openssl'已启用,但前提条件'!features.securetransport && tests.openssl'失败。

ERROR: Feature 'openssl-linked' was enabled, but the pre-condition 'features.openssl && libs.openssl' failed. 错误:功能'openssl-linked'已启用,但前提条件'features.openssl && libs.openssl'失败。

What am I doing wrong, and how to fix this issue? 我做错了什么,以及如何解决这个问题?

Thank you in advance, and sorry for my bad english. 提前谢谢你,抱歉我的英语不好。

I had same problem when trying to link openSSL statically and found following solution: 尝试静态链接openSSL并找到以下解决方案时遇到同样的问题:

1) Install openSSL 1)安装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: 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

Note that to build QT statically, you also must have installed other packages described here: 请注意,要静态构建QT,您还必须安装此处描述的其他包:

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

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

PS Linking dynamically to openSSL from QT5.8 works fine for me with default setup. PS动态链接到QT5.8的openSSL可以正常使用默认设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM