windows下vs2017 编译openssl

1,准备好openssl

2,安装perl

3,打开vs2017 开发人员命令行提示符注意区分32位和64位,执行

perl Configure no-shared no-asm VC-WIN32 --debug --prefix=C:\OpenSSL 

ActivePerl-5.26.3.XXXX.msi安装后,命令行执行cpan,会出现如下提示而无法继续。

Can't locate Win32/Console.pm in @INC (you may need to install the Win32::Console module) (@INC contains: C:\Perl64\site\lib C:\Perl64\lib) at C:\Perl64\lib/ActivePerl/Config.pm line 400.

解决办法,修改C:\Perl64\site\lib\ActivePerl\Config.pm,屏蔽这个函数,大约在400行左右:

# Prevent calling Win32::Console::DESTROY on a STDOUT handle
#my $console;
sub _warn {
#    my($msg) = @_;
#    unless (-t STDOUT) {
#	print "\n$msg\n";
#	return;
#    }
#    require Win32::Console;
#    unless ($console) {
#	$console = Win32::Console->new(Win32::Console::STD_OUTPUT_HANDLE());
#    }
#    my($col,undef) = $console->Size;
#    print "\n";
#    my $attr = $console->Attr;
#    $console->Attr($Win32::Console::FG_RED | $Win32::Console::BG_WHITE);
#    for (split(/\n/, "$msg")) {
#	$_ .= " " while length() < $col-1;
#	print "$_\n";
#    }
#    $console->Attr($attr);
#    print "\n";
}

编译类型 编译执指令

编译32位动态库debug版本 perl Configure debug-VC-WIN32 no-asm --prefix="E:\tools\openssl\openssl111\build_debug32"

编译32位动态库Release版本 perl Configure VC-WIN32 no-asm --prefix="E:\tools\openssl\openssl111\build_release32"

编译64位动态库debug版本 perl Configure debug-VC-WIN64A no-asm --prefix="E:\tools\openssl\openssl111\build_debug64"

编译64位动态库Release版本 perl Configure VC-WIN64A no-asm --prefix="E:\tools\openssl\openssl111\build_release64"

编译32位静态库debug版本 perl Configure debug-VC-WIN32 no-asm no-shared --prefix="E:\tools\openssl\openssl111\build_debug32_static"

编译32位静态库Release版本 perl Configure VC-WIN32 no-asm no-shared --prefix="E:\tools\openssl\openssl111\build_release32_static"

编译64位静态库debug版本 perl Configure debug-VC-WIN64A no-asm no-shared --prefix="E:\tools\openssl\openssl111\build_debug64_static"

编译64位静态库Release版本 perl Configure VC-WIN64A no-asm no-shared --prefix="E:\tools\openssl\openssl111\build_release64_static"

4,nmake         编译

5,nmake test    编译后可以进行测试,但我们现在编译的是lib,没法测试,你要是可执行文件可以测试

6,nmake install  编译结果生成,这是最后一步

7,nmake clean    清理工作,排除各种疑难杂症,可多尝试先清理再编译

你可能感兴趣的:(windows,openssl,vs2017,c++)