首页| 论坛| 消息

标题:静态编译Qt5.4.1,在链接xmlpatterns时报告错误,该怎么处理呢?
作者:johnyork
日期:2015-04-02 23:01
内容:

编译环境是MSYS2 64 bits,编译器使用MinGW64 4.9.2-5
Qt5.4.1的配置为:
./configure -top-level -platform win32-g++ -release -static -strip -qt-freetype -openssl-linked -dbus-linked -qt-sql-sqlite -qt-sql-odbc -no-reduce-exports -opensource -confirm-license -c++11 -qt-harfbuzz -largefile -optimized-qmake -accessibility -gui -widgets -icu -opengl desktop -egl -no-eglfs -iconv -qt-zlib -qt-libpng -qt-libjpeg -mtdev -alsa -no-gtkstyle -force-pkg-config -make libs -make tools -nomake examples -no-compile-examples -prefix /D/Qt/Qt5.4.1/5.4/mingw492_64sll -silent在编译到工具xmlpatterns.exe时报告错误:
C:/Qt/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../lib\libcrypto.a(rand_win.o):(.text+0xdbb): undefined reference to `__imp_GetDeviceCaps'
C:/Qt/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../lib\libcrypto.a(rand_win.o):(.text+0xde8): undefined reference to `__imp_CreateCompatibleBitmap'
C:/Qt/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../lib\libcrypto.a(rand_win.o):(.text+0xdfe): undefined reference to `__imp_GetObjectW'
C:/Qt/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../lib\libcrypto.a(rand_win.o):(.text+0xec2): undefined reference to `__imp_GetDIBits'
C:/Qt/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../lib\libcrypto.a(rand_win.o):(.text+0xf50): undefined reference to `__imp_DeleteObject'
collect2.exe: error: ld returned 1 exit status看那意思好像是未定义的引用。但我打开MinGW的lib目录下的libcrypto.a查看发现是能找到这些函数符号的。
有高手能帮忙参考一下吗?谢谢了先!


#1 [adonais 04-03 20:59]
libcrypto.a 是openssl的静态库,这个错误说明libcrypto.a依赖gdi32.
当你的程序连接libcrypto.a的时候,应该还要连接它的依赖库.
你可以修改xmlpatterns目录下的工程文件,为cfalgs加上-lgdi32
#2 [johnyork 05-16 09:39]
谢谢,现在已经通过修改configure脚本使用pkg-config --libs --static openssl解决了

回复 发表
主题 版块