如何解决在Windows上的Linux上静态交叉编译openssl
我正在尝试使用静态openssl编译应用程序。我用mingw选项编译了openssl,现在我的lib目录包含:libcrypto.a libssl.a libcrypto.dll.a libssl.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的file
文件运行.dll
命令,看看它们是否也针对x86_64。
构建openssl时,应使用mingw64
命令指定./Configure
。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。