如何在VS2015中构建OpenSSL:x86cpuid.asm是一个空文件 [英] How to build OpenSSL in VS2015: x86cpuid.asm is an empty file

查看:166
本文介绍了如何在VS2015中构建OpenSSL:x86cpuid.asm是一个空文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为使用32位VS2015的项目构建OpenSSL.

I need to build OpenSSL for a project that's using VS2015, 32-bit.

我找到的说明是 http://developer.covenanteyes.com/building-openssl-for -visual-studio/和据报道使用VS2015的更新/编辑版本 在 http://blog.box.kr/?p=953 .

The instructions I found are http://developer.covenanteyes.com/building-openssl-for-visual-studio/ and an updated/edited version reportedly using VS2015 at http://blog.box.kr/?p=953 .

在解压缩发行版的目录中,我首先执行cl来验证我是否具有MS Compiler构建提示(由其批处理文件设置),并进行perl -v来确保我具有Perl.然后,

In the directory where I unpacked the distribution, I first did cl to verify that I had a MS Compiler build prompt (as set up by their batch file), and perl -v to make sure I had Perl. Then,

perl Configure VC-WIN32   no-idea no-mdc2 no-rc5  --prefix=e:\some\path
ms\do_ms
nmake -f ms\nt.mak

在这最后一步,我得到:

and at this last step I get:

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是一个零长度文件.

我真正想要的是为要使用动态运行时库的项目提供(构建或查找现成的)静态库.

What I really want is to have (build or find ready-made) a static library for a project that will use the dynamic run-time library.

更新:如果我手动运行该步骤,

Update: if I run the step manually,

perl crypto\x86cpuid.pl win32 > tmp32\x86cpuid.asm

然后,当makefile进入该文件时,它会给我

then when the makefile gets to that file it gives me

    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,这就是拥有此文件的全部要点!

Now it happens that line 35 etc. is cpuid, which is the whole point of having this file!

推荐答案

在Windows上将OpenSSL 1.0.2d构建为静态库

注意:以下文本摘自我关于SoftHSM2的构建说明.

  • Visual Studio (2015 Community)
  • GNU Privacy Guard for Windows (2.2.5)
  • 7-zip (9.20)
  • Strawberry Perl (5.22.0.1)
  • The Netwide Assembler (2.11.08)

创建工作目录:

mkdir C:\build\bin\
mkdir C:\build\src\

使用 OpenSSL 1.0.2d . org/source/openssl-1.0.2d.tar.gz.asc>将其签名放入C:\build\src\目录,并验证已下载档案的签名:

Download OpenSSL 1.0.2d with its signature into C:\build\src\ directory and verify signature of the downloaded archive:

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

构建32位版本

将存档文件openssl-1.0.2d.tar.gz提取到C:\build\src\openssl-1.0.2d-x86目录中:

Building 32-bit version

Extract archive openssl-1.0.2d.tar.gz into C:\build\src\openssl-1.0.2d-x86 directory:

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目录中:

In a new command line window build OpenSSL and install it into C:\build\bin\openssl-1.0.2d-x86 directory:

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目录中.

Resulting build is located in C:\build\bin\openssl-1.0.2d-x86 directory.

将存档文件openssl-1.0.2d.tar.gz提取到C:\build\src\openssl-1.0.2d-x64目录中:

Extract archive openssl-1.0.2d.tar.gz into C:\build\src\openssl-1.0.2d-x64 directory:

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目录中:

In a new command line window build OpenSSL and install it into C:\build\bin\openssl-1.0.2d-x64 directory:

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目录中.

Resulting build is located in C:\build\bin\openssl-1.0.2d-x64 directory.

这篇关于如何在VS2015中构建OpenSSL:x86cpuid.asm是一个空文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆