我需要为一个使用32位VS2015的项目构建OpenSSL.
我发现的说明是http://developer.covenanteyes.com/building-openssl-for-visual-studio/以及据报道在http://blog.box.kr/?p=953上使用VS2015的更新/编辑版本.
在我解压缩发行版的目录中,我首先cl
确认我有一个MS Compiler构建提示(由他们的批处理文件设置),并perl -v
确保我有Perl.然后,
perl Configure VC-WIN32 no-idea no-mdc2 no-rc5 --prefix=e:\some\path ms\do_ms nmake -f ms\nt.mak
在最后一步,我得到:
Building OpenSSL perl .\util\copy-if-different.pl ".\crypto\buildinf.h" "tmp32\buildinf.h" Copying: ./crypto/buildinf.h to tmp32/buildinf.h perl .\util\copy-if-different.pl ".\crypto\opensslconf.h" "inc32\openssl\opensslconf.h" Copying: ./crypto/opensslconf.h to inc32/openssl/opensslconf.h ml /nologo /Cp /coff /c /Cx /Zi /Fotmp32\x86cpuid.obj tmp32\x86cpuid.asm Assembling: tmp32\x86cpuid.asm tmp32\x86cpuid.asm(1) : error A2088:END directive required at end of file NMAKE : fatal error U1077: '"D:\@Prog-Charon\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\ml.EXE"' : return code '0x1' Stop.
我发现这E:\C++Libs\openssl-1.0.2e\tmp32\x86cpuid.asm
是一个零长度的文件.
我真正想要的是为一个将使用动态运行时库的项目(构建或找到现成的)静态库.
更新:如果我手动运行该步骤,
perl crypto\x86cpuid.pl win32 > tmp32\x86cpuid.asm
然后当makefile到达那个文件时它给了我
ml /nologo /Cp /coff /c /Cx /Zi /Fotmp32\x86cpuid.obj tmp32\x86cpuid.asm Assembling: tmp32\x86cpuid.asm tmp32\x86cpuid.asm(35) : error A2085:instruction or register not accepted in current CPU mode tmp32\x86cpuid.asm(59) : error A2085:instruction or register not accepted in current CPU mode tmp32\x86cpuid.asm(64) : error A2085:instruction or register not accepted in current CPU mode tmp32\x86cpuid.asm(70) : error A2085:instruction or register not accepted in current CPU mode tmp32\x86cpuid.asm(75) : error A2085:instruction or register not accepted in current CPU mode tmp32\x86cpuid.asm(90) : error A2085:instruction or register not accepted in current CPU mode tmp32\x86cpuid.asm(98) : error A2085:instruction or register not accepted in current CPU mode tmp32\x86cpuid.asm(105) : error A2085:instruction or register not accepted in current CPU mode tmp32\x86cpuid.asm(165) : error A2085:instruction or register not accepted in current CPU mode tmp32\x86cpuid.asm(182) : error A2085:instruction or register not accepted in current CPU mode tmp32\x86cpuid.asm(186) : error A2085:instruction or register not accepted in current CPU mode tmp32\x86cpuid.asm(322) : error A2085:instruction or register not accepted in current CPU mode tmp32\x86cpuid.asm(335) : error A2085:instruction or register not accepted in current CPU mode NMAKE : fatal error U1077: '"D:\@Prog-Charon\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\ml.EXE"' : return code '0x1'
现在它发生了35行等cpuid
,这是拥有这个文件的重点!
注意:以下文本摘自SoftHSM2的构建说明.
Visual Studio(2015社区)
适用于Windows的GNU Privacy Guard(2.2.5)
7拉链(9.20)
Strawberry Perl(5.22.0.1)
Netwide Assembler(2.11.08)
创建工作目录:
mkdir C:\build\bin\ mkdir C:\build\src\
下载的OpenSSL 1.0.2d有其签名进入C:\build\src\
目录,并验证所下载的压缩文件的签字:
cd C:\build\src\ gpg --keyserver pgp.mit.edu --recv-keys 0E604491 gpg --verify openssl-1.0.2d.tar.gz.asc openssl-1.0.2d.tar.gz
将存档解压缩openssl-1.0.2d.tar.gz
到C:\build\src\openssl-1.0.2d-x86
目录中:
cd C:\build\src\ "C:\Program Files\7-Zip\7z" x openssl-1.0.2d.tar.gz "C:\Program Files\7-Zip\7z" x openssl-1.0.2d.tar rename openssl-1.0.2d openssl-1.0.2d-x86 del openssl-1.0.2d.tar
在新的命令行窗口中构建OpenSSL并将其安装到C:\build\bin\openssl-1.0.2d-x86
目录中:
cd C:\build\src\openssl-1.0.2d-x86 set PATH=%PATH%;C:\nasm "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" perl Configure VC-WIN32 --prefix=C:\build\bin\openssl-1.0.2d-x86 enable-static-engine ms\do_nasm nmake /f ms\nt.mak nmake /f ms\nt.mak test nmake /f ms\nt.mak install
生成的构建位于C:\build\bin\openssl-1.0.2d-x86
目录中.
将存档解压缩openssl-1.0.2d.tar.gz
到C:\build\src\openssl-1.0.2d-x64
目录中:
cd C:\build\src\ "C:\Program Files\7-Zip\7z" x openssl-1.0.2d.tar.gz "C:\Program Files\7-Zip\7z" x openssl-1.0.2d.tar rename openssl-1.0.2d openssl-1.0.2d-x64 del openssl-1.0.2d.tar
在新的命令行窗口中构建OpenSSL并将其安装到C:\build\bin\openssl-1.0.2d-x64
目录中:
cd C:\build\src\openssl-1.0.2d-x64 set PATH=%PATH%;C:\nasm "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 perl Configure VC-WIN64A --prefix=C:\build\bin\openssl-1.0.2d-x64 enable-static-engine ms\do_win64a nmake /f ms\nt.mak nmake /f ms\nt.mak test nmake /f ms\nt.mak install
生成的构建位于C:\build\bin\openssl-1.0.2d-x64
目录中.