• 4816阅读
  • 2回复

静态编译Qt5.4.1,在链接xmlpatterns时报告错误,该怎么处理呢? [复制链接]

上一主题 下一主题
离线johnyork
 

只看楼主 倒序阅读 楼主  发表于: 2015-04-02
编译环境是MSYS2 64 bits,编译器使用MinGW64 4.9.2-5
Qt5.4.1的配置为:
  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时报告错误
  1. 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'
  2. 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'
  3. 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'
  4. 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'
  5. 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'
  6. collect2.exe: error: ld returned 1 exit status
看那意思好像是未定义的引用。但我打开MinGW的lib目录下的libcrypto.a查看发现是能找到这些函数符号的。
有高手能帮忙参考一下吗?谢谢了先!

离线adonais

只看该作者 1楼 发表于: 2015-04-03
libcrypto.a 是openssl的静态库,这个错误说明libcrypto.a依赖gdi32.
当你的程序连接libcrypto.a的时候,应该还要连接它的依赖库.
你可以修改xmlpatterns目录下的工程文件,为cfalgs加上-lgdi32
离线johnyork

只看该作者 2楼 发表于: 2015-05-16
谢谢,现在已经通过修改configure脚本使用pkg-config --libs --static openssl解决了
快速回复
限100 字节
 
上一个 下一个