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

7

我已经花了将近一周的时间,试图在Ubuntu 16.04.1 x64上构建带有OpenSSL的Qt5.8.0。

首先,我下载了OpenSSL v1.0.2k的源代码。然后我使用命令进行了配置:

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

然后我一个接一个地运行这些命令:

make depend
make
make install

我已经将Openssl安装在/home/user/openssl-OpenSSL_1.0.2k/dist中。

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

但是出现了以下错误:
错误:启用了“openssl”功能,但前置条件“!features.securetransport && tests.openssl”未满足。
错误:启用了“openssl-linked”功能,但前置条件“features.openssl && libs.openssl”未满足。
我的做法有什么问题,如何解决这个问题?
提前感谢您的帮助,很抱歉我的英语不好。

你是如何获取Qt的?我有一个运行Ubuntu 16的虚拟机,如果你提供与Qt相关的步骤,我可以快速查看一下。此外,./Configure ... linux-x86_64可能不需要,因为它会被正确猜测。如果适用的话,您还应该考虑添加enable-ec_nistp_64_gcc_128。另请参阅OpenSSL维基上的编译和安装 - jww
1个回答

4

我在尝试静态链接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对我来说可以正常工作。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接