问题描述
我一直在遵循 OpenSSL 用户指南中的说明,其中链接3noch 的指南 编译 OpenSSL.以下是我正在使用的工具/版本:
I have been following the instructions in the OpenSSL User Guide, which links to a guide by 3noch for compiling OpenSSL. Here are the tools/versions I am using:
- ActiveState Perl v5.20.2
- Microsoft Visual Studio 2012
- Netwide Assembler (NASM) v2.12.02
- OpenSSL 1.0.2j(源 tarball)
按照说明,我可以毫无问题地执行以下命令:
Following the instructions, I am able to execute the following commands without issue:
perl Configure VC-WIN32 --prefix=C:\Build-OpenSSL-VC-32
ms\do_ms
然后,当我继续执行
nmake -f ms\nt.mak
我收到以下内容
Assembling: tmp32\sha1-586.asm
tmp32\sha1-586.asm(1432) : error A2070:invalid instruction operands
tmp32\sha1-586.asm(1576) : error A2070:invalid instruction operands
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0
\VC\BIN\ml.EXE"' : return code '0x1'
Stop.
调查该问题后,我发现了一篇博文HostageBrain 提到了那个确切的错误,说明使用 nasm 来执行编译.所以,我切换到这个命令序列:
After looking into that issue, I found a blog post by HostageBrain that mentions that exact error, stating to use nasm to perform the compiling. So, I switched to this command sequence:
perl Configure VC-WIN32 --prefix=C:\Build-OpenSSL-VC-32
ms\do_nasm
nmake -f ms\nt.mak
但是,一旦切换到 NASM 变体,我就会收到以下错误:
However, once switching to the NASM variation, I receive the following errors:
tmp32\sha1-586.asm:1: error: parser: instruction expected
tmp32\sha1-586.asm:2: error: parser: instruction expected
tmp32\sha1-586.asm:3: error: parser: instruction expected
tmp32\sha1-586.asm:4: warning: label alone on a line without a colon might be in error
tmp32\sha1-586.asm:5: warning: label alone on a line without a colon might be in error
tmp32\sha1-586.asm:6: warning: label alone on a line without a colon might be in error
tmp32\sha1-586.asm:7: error: symbol `IF' redefined
tmp32\sha1-586.asm:7: error: parser: instruction expected
tmp32\sha1-586.asm:8: error: parser: instruction expected
tmp32\sha1-586.asm:9: error: comma expected after operand 1
我正在寻找的是能够将 OpenSSL 编译成 .lib 文件,然后我可以从其他 C++ 项目链接到这些文件,例如在编译 FreeTDS 时.
What I am looking for is to be able to compile OpenSSL into .lib files that I can then link to from other C++ projects, such as when compiling FreeTDS.
推荐答案
在你提到的同一个我的博客页面上,我还描述了 'no-asm' 情况 - 这种情况更易于编译(它不需要 nasm 在全部),但缺点是 - 某些算法的性能会比汇编版本慢 2-4 倍.如果您的案例可以接受这种性能 - 尝试编译no-asm"案例.
On the same my blog page which you refer I also describe 'no-asm' case - this case is simpler for compiling (it won't require nasm at all), but drawback is - some algorithms performance will be 2x-4x slower than assembler versions.If your case can accept this performance - try to compile 'no-asm' case.
perl Configure VC-WIN32 no-asm --prefix=C:\Build-OpenSSL-VC-32
这篇关于如何在 Windows 上编译 OpenSSL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!