我需要为使用32位VS2015的项目构建OpenSSL。
我发现的说明是http://developer.covenanteyes.com/building-openssl-for-visual-studio/以及据报道使用VS2015的更新/编辑版本 在http://blog.box.kr/?p=953。
在我解压缩发行版的目录中,我首先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
,这是拥有此文件的重点!
答案 0 :(得分:18)
注意:以下文字摘自my building instructions for SoftHSM2。
创建工作目录:
mkdir C:\build\bin\
mkdir C:\build\src\
将OpenSSL 1.0.2d与its signature一起下载到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
目录。