如何在 Windows 中使用 MinGW 构建 OpenSSL?

2022-01-07 00:00:00 openssl mingw c++ msys

我想用 MinGW 在 Windows 中构建 OpenSSL,
我怎样才能做到这一点?请帮帮我.
谢谢.

I want to build OpenSSL in Windows with MinGW,
How can I do that? Please help me.
Thanks.

推荐答案

这是我写的个人指南的摘录.此后,它已被转换为 脚本(查看 OpenSSL部分,显然).它假定您已安装了 MinGW,并且您有一个可运行的 MSys 控制台.

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,您需要一个有效的 Perl 安装.

To build OpenSSL, you need a working Perl installation.

从官方网站下载OpenSSL并解压存档.

Download OpenSSL from its official website and decompress the archive.

您必须从 MSys 控制台运行这些命令.

You must run these commands from a MSys console.

对于 32 位:

perl 配置 mingw no-shared no-asm --prefix=/c/OpenSSL

perl Configure mingw no-shared no-asm --prefix=/c/OpenSSL

对于 64 位:

perl 配置 mingw64 no-shared no-asm --prefix=/C/OpenSSL-x64

perl Configure mingw64 no-shared no-asm --prefix=/C/OpenSSL-x64

那么:

依赖

制作

进行安装

如果您指定了任何 no-... 选项,则只有在最新的 OpenSSL 版本上才需要 make Depend 行.

The make depend line is only needed on the most recent OpenSSL version if you specified any of the no-... options.

请注意,这将在静态模式下编译 OpenSSL.

Note that this will compile OpenSSL in static mode.

如果在某个时候你得到一个make (e=2):"错误,确保您没有另一个make.exe";在你的 PATH 中或者只输入 /bin/make 而不是 make.

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.

当然,您可能需要使用其他选项(例如动态链接或启用 asm)来编译它.因此,请随时查看 perl Configure 可以提供的帮助以了解有关可用选项的更多信息.

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.

相关文章