C++ 如何在 Windows 中使用 MinGW 构建 OpenSSL?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9379363/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to build OpenSSL with MinGW in Windows?
提问by Harry Fox
I want to build OpenSSL in Windows with MinGW,
How can I do that? Please help me.
Thanks.
我想用 MinGW 在 Windows 中构建 OpenSSL,
我该怎么做?请帮我。
谢谢。
回答by ereOn
This is an extract from a personal how-to I wrote. It has since been transformed to a script(look at the OpenSSL section, obviously). It assumes you have a working installation of MinGW and that you have a working MSys console.
这是我写的个人指南的摘录。它已被转换为脚本(显然,请查看 OpenSSL 部分)。它假设您有一个有效的 MinGW 安装并且您有一个有效的 MSys 控制台。
OpenSSL
开放式SSL
To build OpenSSL, you need a working Perl installation.
要构建 OpenSSL,您需要一个有效的Perl 安装。
Download OpenSSL from its official websiteand decompress the archive.
从其官方网站下载 OpenSSL并解压缩存档。
Windows 32/64 bits - MinGW
Windows 32/64 位 - MinGW
You must run these commands from a MSysconsole.
您必须从 MSys控制台运行这些命令。
For 32 bits:
对于 32 位:
perl Configure mingw no-shared no-asm --prefix=/c/OpenSSL
perl 配置 mingw no-shared no-asm --prefix=/c/OpenSSL
For 64 bits:
对于 64 位:
perl Configure mingw64 no-shared no-asm --prefix=/C/OpenSSL-x64
perl 配置 mingw64 no-shared no-asm --prefix=/C/OpenSSL-x64
Then:
然后:
make depend
make
make install
依赖
制作
进行安装
The make depend
line is only needed on the most recent OpenSSL version if you specified any of the no-...
options.
make depend
如果您指定了任何no-...
选项,则仅在最新的 OpenSSL 版本上才需要该行。
Note that this will compile OpenSSL in static mode.
请注意,这将在静态模式下编译 OpenSSL。
If at some point you get a "make (e=2):" error, ensure you don't have another "make.exe" in your PATH or just type /bin/make
instead of make
.
如果在某些时候你会得到一个“化妆(E = 2):”错误,确保你没有其他“的make.exe”在您的PATH或只需键入/bin/make
代替make
。
You may, of course, need to compile it with other options (such as dynamic linking, or asm enabled). So feel free to look at the help perl Configure
can provide to know more about the available options.
当然,您可能需要使用其他选项(例如动态链接或启用 asm)来编译它。因此,请随时查看perl Configure
可以提供的帮助以了解有关可用选项的更多信息。