编译带有 openSSL 错误的静态 Qt
Compiling static Qt with openSSL errors
我成功地在win32下用mingw编译了OpenSSL 1.0.1。现在我正在尝试使用以下配置编译静态Qt 4.8.1:
configure -release -static -qt-zlib -nomake examples -nomake demos -no-qt3support -no-scripttools -no-opengl -no-webkit -no-phonon -no-style-motif -no-style-cde -no-style-cleanlooks -no-style-plastique -no-sql-sqlite -openssl-linked OPENSSL_LIBS="-lssl -lcrypto -lgdi32 -luser32" -I H:WorkplaceOpenSSLinclude -L H:WorkplaceOpenSSL
我收到这些错误:
H:WorkplaceOpenSSL/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x17be): undefined ref
erence to '_time32'
(多次)
H:WorkplaceOpenSSL/libcrypto.a(o_time.o):o_time.c:(.text+0x362): undefined ref
erence to '_gmtime32'
H:WorkplaceOpenSSL/libcrypto.a(mem_dbg.o):mem_dbg.c:(.text+0x4c7): undefined r
eference to '_localtime32'
已解决(见下文)
最后我解决了所有问题,这里是使用 TDM-GCC 使用静态 OpenSSL 编译静态 Qt 的完整解决方案。
-
下载最新OpenSSL的源代码并解压缩它们。
-
我使用TDM-GCC进行编译,因此请下载并安装它。
-
安装 MSY。
-
创建包含以下内容的文件
../MsysInstallDir/etc/fstab
:
MyPathToMinGW /mingw
(如果您使用 TDM-GCC,则需要)
MyPathToPerl /perl
(还需要安装 perl)
- 要编译 OpenSSL,请在 OpenSSL 源文件夹(在 MSYS 中)中运行以下命令:
./config
make
- 下载qt-everywhere(我使用了v.4.8.1)源代码并解压缩它们。
更新:最近我在另一台 windows7 计算机上构建了 4.8.2,并遇到编译错误(在构建我的应用程序时):«找不到 -lQtCore4», «找不到 -lQtGui4»。这是帮助我的解决方案 - 编辑文件"qt-sources-dir/mkspecs/win32-g++/qmake.conf"。设置QMAKE_LFLAGS = -static -static-libgcc
- 使用配置在Qt源目录中创建conf.bat文件:
configure -release -static -qt-zlib -nomake examples -nomake demos -no-qt3support -no-scripttools -no-opengl -no-webkit -no-phonon -no-style-motif -no-style-cde -no-sql-sqlite -openssl OPENSSL_LIBS="-lssl -lcrypto -lgdi32 -luser32" -I MyOpenSSLdirinclude -L MyOpenSSLdir
-
运行
cmd
. 在 Mingw 文件夹中运行mingwvars.bat
。 在 QT 源文件夹中运行conf.bat
(或将源文件夹添加到 PATH 并从另一个目录运行它,以将安装与源分开)。编译Qt需要几个小时。 -
添加到项目的 .pro 文件:
INCLUDEPATH += OpenSSLdir/include/
我认为这可能会帮助某人。
你确定你需要 -openssl-link 吗?我们总是使用openssl的动态使用来构建Qt。(-openssl)
- Qt C++静态thread_local QNetworkAccessManager是线程应用程序的好选择吗
- 将实时(非静态)放在qt(c ++)上
- Mingw32无法静态链接到libgcc_s_dw2-1、libstdc++-6、libwinpthread-1(Qt
- 如何使用MinGW编译器和SSL支持静态编译Qt
- 使用静态 Qt 构建在 Linux 上部署 Qt5 应用程序
- MSYS2静态QT未定义的参考问题
- 使用 PostgreSQL 编译静态 Qt 5.10.0 时出错
- 静态 QT 编译问题
- 构建静态QT时未解决的外部
- 如何从静态Qt运行qmake
- 如何从不同类的静态成员函数访问非静态Qt-Ui函数
- 静态Qt链接版本,Qt 5.2,QT中的未知模块:快速qml
- 如何在 64 位 Linux Mint 上构建最小的静态 Qt 5.2 32 位库
- QT https SSL支持静态QT静态程序构建 - 仍然需要openssl dll
- QT https SSL支持静态QT静态程序构建 - 获取“协议”https“未知”
- 编译带有 openSSL 错误的静态 Qt
- 静态qt对话框窗口不可能
- 如何解决使用静态QT odbc时的链接问题
- 静态Qt程序在VS2013中构建-许多未解决的外部
- 链接静态Qt库到c程序