【问题标题】:Building Qt with OpenSSL on Ubuntu 16.04.1 fails在 Ubuntu 16.04.1 上使用 OpenSSL 构建 Qt 失败
【发布时间】:2023-03-08 19:33:05
【问题描述】:

我几乎花了一周时间尝试在 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

所以我在 /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

但是遇到了这些错误:

错误:功能“openssl”已启用,但前提条件“!features.securetransport && tests.openssl”失败。

错误:功能“openssl-linked”已启用,但前提条件 'features.openssl && libs.openssl' 失败。

我做错了什么,如何解决这个问题?

提前谢谢你,抱歉我的英语不好。

【问题讨论】:

  • 你是如何获取 Qt 的?我正在运行 Ubuntu 16 VM,如果您提供与 Qt 相关的步骤,我可以快速查看一下。此外,./Configure ... linux-x86_64 可能不需要,因为它会被正确猜到。如果适用,您还应该考虑添加enable-ec_nistp_64_gcc_128。另请参阅 OpenSSL wiki 上的 Compilation and Installation

标签: qt ubuntu ssl openssl


【解决方案1】:

我在尝试静态链接 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 对我来说效果很好。

【讨论】:

    猜你喜欢
    • 2017-09-25
    • 2019-06-28
    • 2023-03-28
    • 2016-04-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-26
    • 2018-08-28
    相关资源
    最近更新 更多