Qt添加支持openssl

最近在编写Qt应用程序,其中有一个功能就是需要用到websocket通信。当然,Qt本身是自带QWebSocket模块的。开始访问服务器时,服务器地址是http地址链接,所以在编译Qt源码库时没有添加openssl的支持,后来功能完善后需要访问https地址链接,就需要openssl库的支持了。

1、openssl编译

  • 版本:openssl-1.0.2g
    一定要选对Qt版本对应的openssl版本,由于开始选的openssl版本不对,导致编译Qt时出现很多错误。
  • 交叉编译
./config no-asm shared --prefix=/opt/Xilinx2018_zynq/zynq_openssl_1.0.2/ --cross-compile-prefix=/opt/Xilinx/SDK/2018.3/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-

make -j4

make install

2、Qt5.7.1编译

1.
首先确保qt源码目录下交叉编译命令生效
cd qt-everywhere-opensource-src-5.7.1 
source /opt/Xilinx/SDK/2018.3/settings64.sh

2.执行configure,其配置如下:
./configure -xplatform arm-linux-gnueabihf-g++ \
    -openssl-linked \
    -I/opt/Xilinx2018_zynq/zynq_openssl_1.0.2/include \
    -L/opt/Xilinx2018_zynq/zynq_openssl_1.0.2/lib -lssl -lcrypto \
    -opensource \
    -confirm-license \
    -skip qtquickcontrols \
    -skip qtwebchannel \
    -skip qtactiveqt \
    -skip qtandroidextras \
    -skip qtdeclarative \
    -skip qtimageformats \
    -skip qtmacextras \
    `#-skip qtserialport` \
    -skip qtx11extras \
    -skip qtxmlpatterns \
    -skip qtconnectivity \
    -skip qtdoc \
    -skip qtgraphicaleffects \
    -skip qtlocation \
    -skip qtmultimedia \
    -skip qtsensors \
    -skip qttools \
    -skip qttranslations \
    -skip qtwayland \
    -skip qtwebchannel \
    -skip qtwebengine \
    `#-skip qtwebsockets` \
    -skip qtwinextras \
    -verbose \
    `#-no-gif` \
    `#-no-libjpeg` \
    -qt-libjpeg \
    -qt-libpng \
    -no-mtdev \
    -no-sql-db2 \
    -no-sql-ibase \
    -no-sql-mysql \
    -no-xcb \
    -qt-freetype \
    -fontconfig \
    -no-harfbuzz \
    -no-xinput2 \
    -no-xcb-xlib \
    -no-pulseaudio \
    -no-alsa \
    -no-cups \
    -no-iconv \
    -no-icu \
    -no-eglfs \
    -no-dbus \
    -prefix $ZYNQ_QT_INSTALL
3. make

3、更新库

将新生成的libQt5NetWork*、libQt5WebSocket*相关的库文件替换;然后再把openssl相关的库libssl、libcrypto放在对应目录下即可

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Linux兵工厂

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值