openssl-1.1.1-pre1 windows环境下编译

场景
         VS2015编译openssl-1.1.1-pre1


工具
         nasm-2.14rc0-installer-x64.exe
         ActivePerl-5.24.3.2404-MSWin32-x64-404865.exe
         openssl-1.1.1-pre1.tar.gz


环境变量
 C:\Program Files\NASM(添加汇编器路径)
 C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin(VS2015编译路径)


操作
 1)perl Configure VC-WIN32 [no-shared] [no-asm] [no-tests] [--debug] --prefix=d:\openssllib
VC-WIN32:可根据需要修改为64位等,no-shared为编译静态库,不加此项默认编译出的是动态库;no-tests为不需要tests功能,如果只需要openssl的库可以加上此项,否则可能会出很多错误导致编译不过;--debug为编译debug版,不加此项默认编译出的是release版。
 2)nmake,编译通过后再nmake install就安装到--prefix=指定的目录了。
 3)如果要编译多个版本(release,debug),最好先nmake clean下,再重复第3步骤。
注意:
1.VS工程的运行时库(Runtime Library)选择应与编译出的openssl库匹配,尤其动态库,否则可能编译不过
2.需要使用静态库的时候,如果编译不过,出现LNK2019等错误的时候,你可能还需要添加ws2_32.lib,crypt32.lib库。
3.NASM汇编器没有安装出现如下错误
C:\Users\admin\Downloads\openssl-1.1.1-pre1>perl Configure VC-WIN32
Using implicit seed configuration
Configuring OpenSSL version 1.1.1-pre1 (0x10101001L) for VC-WIN32
NASM not found - please read INSTALL and NOTES.WIN for further details
4It looks like you don't have either nmake.exe or dmake.exe on your PATH错误解决方案
It looks like you don't have either nmake.exe or dmake.exe on your PATH,
so you will not be able to execute the commands from a Makefile.  You can
install dmake.exe with the Perl Package Manager by running:
ppm install dmake
解决:执行ppm install dmake,安装dmake。
说明:ppm是perl图形化包管理工具,dmake是同GNU Make类似的工具,支持跨平台
当前安装VS2015,搜索到nmake.exe,然后执行vcvarsall.bat,并且添加了VS的nmake路径到环境变量还是有问题


猜你喜欢

转载自blog.51cto.com/fengyuzaitu/2150487