openssl - OpenSSL 测试在使用 /MT 编译器选项使用静态版本的运行时库构建的 Windows 上失败
问题描述
我正在尝试使用以下方法为 Windows 构建 OpenSSL 1.1.1f:
- 最新的 Visual Studio 2019 (v16.4.6)
- Strawberry Perl(为 MSWin32-x86-multi-thread-64int 构建的 perl 5,版本 28,subversion 1 (v5.28.1))
- Windows 10 64 位
我遵循 https://stackoverflow.com/a/50365514/220425的说明,基本上:
- 从官网下载 OpenSSL 1.1.1f
perl Configure VC-WIN32 no-asm --prefix=C:\some_dir\ --libdir=lib --openssldir=conf
- 在
openssl-1.1.1e\makefile
我更改/MD
为/MT
- 在控制台中
x86 Native Tools Command Prompt for VS 2019
:- 制作
- nmake 测试
构建成功,但是许多测试失败。这是日志中的一个片段:
test\recipes\01-test_abort.t .................... ok
test\recipes\01-test_sanity.t ................... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests
test\recipes\01-test_symbol_presence.t .......... ok
test\recipes\01-test_test.t ..................... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests
test\recipes\02-test_errstr.t ................... skipped: This is unsupported on MSYS/MinGW or MSWin32
test\recipes\02-test_internal_ctype.t ........... ok
test\recipes\02-test_lhash.t .................... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests
test\recipes\02-test_ordinals.t ................. ok
test\recipes\02-test_stack.t .................... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests
test\recipes\03-test_exdata.t ................... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests
test\recipes\03-test_internal_asn1.t ............ ok
test\recipes\03-test_internal_chacha.t .......... ok
test\recipes\03-test_internal_curve448.t ........ ok
test\recipes\03-test_internal_ec.t .............. ok
test\recipes\03-test_internal_mdc2.t ............ Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests
如果我使用详细模式运行测试,nmake test V=1
则会显示更多详细信息:
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests
test\recipes\04-test_bio_callback.t .............
1..1
OPENSSL_Uplink(798E0330,08): no OPENSSL_Applink
..\bio_callback_test.exe => 1
not ok 1 - running bio_callback_test
为什么测试失败,以及如何解决这个问题?我需要用/MT
笔记:
- 如果我不更改
/MD
,/MT
那么一切都按预期工作,并且所有测试都通过 - 构建以前版本的 OpenSSL 可以工作,例如 1.0.1,但从 1.1.x 开始它们会失败
解决方案
获取 /MT 的标准方法是配置“非共享”,即不生成 DLL。
https://www.mail-archive.com/openssl-users@openssl.org/msg88356.html
推荐阅读
- javascript - 您如何结合 CSS 和 JS 在页面加载时淡出 onClick + 淡入?
- python - 有没有办法在用户使用 discord.py 登录时发送消息?
- javascript - 如何在php中将打印页面大小调整为我的条形码大小
- c# - 使用网络文件在 C# 中恢复 SQLDatabase
- python - 原始计算器 - 动态和递归方法
- tensorflow - Colab: UnknownError: 使用 TF 2.5 时获取卷积算法失败
- sql - 在 Oracle 的 SQL 中按不同的值进行分组和排序
- javascript - 如何使 amd.js 和所有依赖项成为本地路径引用
- javascript - 访问数组元素时获取未定义,即使它存在
- java - Selenium 测试在尝试使用 docker 作为 AWS EC2 Ubuntu 实例上的执行程序运行 Gitlab 作业时抛出 SessionNotCreatedException