OpenSSL under Windows compilation bat

Source: Internet
Author: User
Tags visual studio 2010

Make_openssl32.bat-----------

D:
CD D:\Program Files (x86) \microsoft Visual Studio 10.0\vc\bin\
Call Vcvars32.bat

C:
CD C + +
CD openssl-1.0.2g

Perl Configure Vc-win32 no-asm--prefix=c:\openssl-1.0.2g\win32
Call Ms\do_ms.bat

Call Ms\do_win32

REM NT compiled for Lib
Nmake-f Ms\nt.mak

REM nmake-f Ms\nt.mak Test

Nmake-f Ms\nt.mak Install


Pause

Make_openssl64.bat--------

D:
CD D:\Program Files (x86) \microsoft Visual Studio 10.0\vc\bin\amd64\
Call Vcvars64.bat


C:
CD C + +
CD openssl-1.0.2g
Perl Configure vc-win64a no-asm--prefix=c:\openssl-1.0.2g\win64

Call Ms\do_ms.bat
Call ms\do_win64a

REM NT compiled for Lib
Nmake-f Ms\nt.mak

REM nmake-f Ms\nt.mak Test

Nmake-f Ms\nt.mak Install


Pause

Reference website and original text:

Https://bbs.csdn.net/topics/392193545?page=1

I am also just contact OpenSSL, see a installation tutorial directly to get started, the results go a lot of detours. Suggest that you see more information to install, there are problems do not hurry to give up, on the Internet to check the problem code, a solution. Read the online sharing of the installation tutorials, everyone is installed several times, time-consuming days. I was also looking at a lot of information, it took a long time to install the success, so, I also share the process of installation. For your reference, what is insufficient, the wrong place welcomes everyone to correct.
(PS: If you want to see the original install file, then please open the decompression directory of OpenSSL, below are two files Install.w32 and install.w64, open with Notepad, you can see the detailed explanation about the installation)

-and the students are directly installed successfully.

1. Download ActivePerl 5.24.1
Download URL: https://www.activestate.com/activeperl/downloads



2. Install the ActivePerl software:
One step at a-step installation. There is a choice to add to the environment variable, after the installation is successful, you need to set the environment variable again.
For example, if I install ActivePerl in the C:\Perl64\ directory, select Path and click the Edit button to C:\Perl64\site\bin; C:\Perl64\bin; add it and confirm it. (Personal recommended installation to C-drive, follow-up good operation)




How to confirm the installation is successful, run cmd, enter Perl-v, and return to the display below, is the successful


3. Install Microsoft Visual Studio
Microsoft visual_studio_2010_professional Software Installation package Http://pan.baidu.com/s/1o6SsDn0
Of course other versions are also available. This software is relatively large, the time required for installation is longer, patience, step by step installation can be.



C:\Program files (x86) \microsoft Visual Studio 10.0\VC\BIN\AMD64, adding system environment variables (the system may have been added to the path path C:\Program files (x86) \ Microsoft Visual Studio 10.0\vc\bin, if not added on),
Depending on the path you installed

4. Installing NASM
(Some do not install the software can also be successful, personal recommended installation)
Address: http://www.nasm.us/

The current stable version is: 2.12.02
http://www.nasm.us/pub/nasm/releasebuilds/2.12.02/win64/



Then install and add its installation path to the system environment variable path. For example: C:\Users\lenovo\AppData\Local\NASM

5. Download OpenSSL
Address: http://www.openssl.org/source/



After downloading, unzip it to its own directory, it is recommended in the C-disk directory without Chinese name and space, so as to facilitate subsequent operation. For example, I C:\openssl

6. Initializing the compilation environment
Open All Programs and locate the Visual Studio x64 Win64 command Prompt (2010) tool under the Visual Studio Tools folder
Here you use the Visual Studio x64 Win64 command Prompt (2010) tool under the Visual Studio Tools folder.



Enter the Visual Studio 2010 installation directory C:\Program Files (x86) \microsoft Visual Studio 10.0\
Execute command: CD C:\Program Files (x86) \microsoft Visual Studio 10.0\vc\bin\amd64
Execute command: Vcvars64.bat



7. Executive Configure
Start by pointing the command to your OpenSSL directory (this is the way to put OpenSSL on the C drive or to put the VS2010 in a single disk.)



You can also directly CD to: CD C:\openssl
After entering
Then implement the command: Perl Configure vc-win64 no-asm--prefix=c:\openssl
(since OpenSSL installs to C:\openssl, follow your storage path to write the following path)

Also: When you download the OpenSSL is a high version, such as OPENSSL-1.0.2G, you need to add no-asm here, that does not use the assembly, if you do not add, you can execute the NMAKE command error. But if the download is openssl-1.0.1c, seemingly do not add no-asm can also succeed.

The lesson of blood, in this step did not operate correctly, has been in the subsequent NMAKE error, can not find the reason, almost give up.
Say more is a tear!!!
The number of commands that you configure is not the same: 1, Perl Configure vc-win64a
2. Perl Configure vc-win64a--perfix=c:\openssl\win64 (or its storage path)
I have not succeeded in either of these, but when my above order is unsuccessful, you can try these two.


The mapping command was 32-bit, which was forgotten at the time, but the result was basically the same.



Success (This is also 32-bit, basically consistent)

This problem may occur at this time:
It looks like you don ' t has either NMAKE or Dmake.exe on your path




This problem is also troubled me for a long time, check a lot of information and methods are not working, and finally, with the help of a post to complete. If the same problem occurs, refer to.
Http://www.cnblogs.com/emanlee/archive/2012/08/11/2633849.html

8. Executive Ms\do_nasm

Input command: ms\do_nasm
At that time did not think that will be successful and not, here is also likely to appear namke:fatal error u1077 ..., return code "0x43" and so on, this is the problem that I mentioned in the 7th step before, this is a long time, here is not to repeat, if there is a problem, see the 7th step above.


This is generally the case.

9. Perform "ms\do_win64a"

Input command: ms\do_win64a
Forget!

[B]10. Environment re-configuration [/b]

Locate the command prompt to C:\Program Files (x86) \microsoft Visual Studio 10.0\vc\bin\amd64 (VS2010 installation location), and then enter Vcvars64.bat, which displays setting Environment for using Microsoft Visual Studio x64 tools. If this is not the case, the next step is to indicate that NMAKE is not an internal or external command.
The front has been configured, there is no configuration can be successful, some will not, the specific reason is not clear, the proposal is set once.

11. Execution of Nmake-f Ms\nt.mak(This is a static library, followed by a dynamic library description)

Again, navigate to the command prompt, which is the CD to C:\openssl (that is, back to the OpenSSL source directory)
Input command: Nmake-f Ms\nt.mak;
After execution, the Out32 and tmp32 two folders will be generated in the OPENSSL-1.0.1G directory, and the Out32 folder will generate two static libraries and some execution files, and the corresponding assembly files will be generated in the Tmp32 folder.



12. Execution, test: nmake-f Ms\nt.mak test

Input command: nmake-f Ms\nt.mak test;
Check if the previous compilation was successful and, if successful, the word "passed all tests" is displayed



13. Execute command: nmake-f ms\nt.mak install

Success will generate bin, include, LIB, SSL four folders in the C:\openss\win64 directory



Installing OpenSSL here is a success!

14. Follow-up Instructions

A. The above compiled is the release library, if compiled debug library, then the above 7th step in the vc-win64a to change to debug-vc-win64a can;

B. If compiling the dynamic library, use Ms\ntdll.mak to replace the Ms\nt.mak above the 11th step above.

There are several other commands that may be used:

Testing the OpenSSL dynamic library: nmake-f Ms\ntdll.mak test
Test OpenSSL Static Library: nmake-f Ms\nt.mak test
Installing the OpenSSL dynamic Library: nmake-f Ms\ntdll.mak Install
Installing the OpenSSL static Library: nmake-f Ms\nt.mak Install
Clears the compilation of the last OpenSSL dynamic library for recompilation: nmake-f ms\ntdll.mak Clean
Clears the compilation of the last OpenSSL static library for recompilation: nmake-f ms\nt.mak Clean

Reference: http://www.linuxidc.com/Linux/2014-10/108502.htm
http://blog.csdn.net/zh516846937/article/details/40188065

OpenSSL under Windows compilation Bat

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.