【问题标题】:OpenSSL tests fail on Windows built with static version of the run-time library using /MT compiler optionOpenSSL 测试在使用 /MT 编译器选项使用运行时库的静态版本构建的 Windows 上失败
【发布时间】:2020-04-02 12:29:04
【问题描述】:

我正在尝试使用以下方法为 Windows 构建 OpenSSL 1.1.1f:

  • 最新的 Visual Studio 2019 (v16.4.6)
  • Strawberry Perl(perl 5,版本 28,subversion 1 (v5.28.1) 为 MSWin32-x86-multi-thread-64int 构建)
  • 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
    • 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 构建 OpenSSL

注意事项:

  • 如果我不将 /MD 更改为 /MT,那么一切都会按预期进行,并且所有测试都会通过
  • 构建以前版本的 OpenSSL 可以工作,例如 1.0.1,但从 1.1.x 开始它们会失败

【问题讨论】:

    标签: openssl


    【解决方案1】:

    获取 /MT 的标准方法是配置“不共享”,即不 生成 DLL。

    https://www.mail-archive.com/openssl-users@openssl.org/msg88356.html

    【讨论】:

    • 但我需要带有静态链接的 DLL
    • 您可以使用和不使用“no-shared”参数对 makefile 进行区分。 CNF_CFLAGS 中没有运行时库类型。但是:LIB_CFLAGS=... /MT ... BIN_CFLAGS=... /MT ...
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-08
    • 1970-01-01
    • 1970-01-01
    • 2016-02-26
    • 1970-01-01
    • 2019-08-10
    相关资源
    最近更新 更多