ubuntu QT openssl支持https

1、Building Qt 5 from Git - Qt Wiki

2、下载编译对应的opengssl [ 1.1.1 ] - /source/old/1.1.1/index.html

3、安装所需基础工具

sudo apt-get install build-essential perl python3 git
sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
sudo apt-get install flex bison gperf libicu-dev libxslt-dev ruby
sudo apt-get install libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev libxtst-dev libxss-dev libdbus-1-dev libevent-dev libfontconfig1-dev libcap-dev libpulse-dev libudev-dev libpci-dev libnss3-dev libasound2-dev libegl1-mesa-dev gperf bison nodejs
sudo apt-get install libasound2-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev libgstreamer-plugins-bad1.0-dev
sudo apt install clang libclang-dev

4、下载源码并编译

git clone https://code.qt.io/qt/qt5.git
cd qt5
git checkout 5.15.2
git submodule update --init --recursive                     # updating each submodule to match the supermodule
mkdir qt5-build
mkdir output
cd qt5-build
OPENSSL_LIBS='-L/home/opensource/openssl-1.1.1g/build/lib -lssl -lcrypto' ../configure -developer-build -opensource -nomake examples -nomake tests  -openssl-linked -I/home/opensource/openssl-1.1.1g/build/include -prefix /home/opensource/qt5/output
make

ubuntu QT openssl支持https_第1张图片

OpenSSL必须是yes。

5、将编译好的库拷贝到qt对应的目录即可

注意,编译过程中报错的解决方法:

一、QT Ubuntu Gcc 静态编译源码 5.15.2 error numeric_limits 出错

修改 Src/qtbase/src/corelib/global/qglobal.h

ifdef __cplusplus

include

include

include

# include //加上这行

endif

ifndef ASSEMBLER

include

include

endif

二、Static compile error Qt5.12.0: bootstrap-private

Static compile error Qt5.12.0: bootstrap-private | Qt Forum

Your

  1. source directory
  2. build directory (your pwd)
  3. install directory (assigned with -prefix)

must be 3 different directories.

三、/usr/bin/ld: warning: libssl.so.1.1, needed by /home/opensource/qt5/qt5-build/qtbase/lib/libQt5Network.so.5, not found (try using -rpath or -rpath-link)

/usr/bin/ld: warning: libcrypto.so.1.1, needed by /home/opensource/qt5/qt5-build/qtbase/lib/libQt5Network.so.5, not found (try using -rpath or -rpath-link)

export LD_LIBRARY_PATH=/home/opensource/openssl-1.1.1g/build/lib:$LD_LIBRARY_PATH

你可能感兴趣的:(ubuntu,linux,运维,qt)