c-在linux for windows上静态交叉编译openssl



我正试图用静态openssl编译一个应用程序。我用mingw选项编译了openssl,现在我的lib目录有:libcrypto.alibssl.alibcrypto.dll.alibssl.dll.a我使用了正确的-L编译器选项,但仍然会出现以下错误:

x86_64-w64-mingw32-gcc main.c -lws2_32 -s -ffunction-sections -fdata-sections -Wno-write-strings -fno-exceptions -fmerge-all-constants -static-libstdc++ -static-libgcc -static -L/rw/usrlocal/lib/ -I/rw/usrlocal/include/ -lssl -lcrypto
~~~~~~~~^~~~~
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /rw/usrlocal/lib//libssl.a when searching for -lssl
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lssl
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /rw/usrlocal/lib//libcrypto.a when searching for -lcrypto
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status

这里有人能告诉我为什么mingw使用libcrypto.a而不是libcrypto.dll.a吗?更重要的是:我该如何改变这一点?问候

它的字面意思是说"跳过不兼容";,这让我觉得图书馆不是针对同一个平台的。你确定你没有混合使用32位和64位Windows吗?

使用openssl的.dll文件运行file命令,查看它们是否也针对x86_64。

构建openssl时,应使用./Configure命令指定mingw64

最新更新