How to compile OpenSSL in Windows

Source: Internet
Author: User
Tags perl interpreter install perl

After decompressing OpenSSL, you can find an install. w32 file in its directory. This file is the installation instructions in windows. You can use ultraedit to open it.

1. Install Perl. Perl can be downloaded from http://www.activestate.com/activeperl.

2. Install the compiler (any one can). I only use VISUAL C ++ as an example.

Visual c ++
Borland C
Gnu c (cygwin or mingw)

3. If compilation is performed by means of assembly, you need to install the Assembly Language compiler. Masm nasm can all be used. If the speed requirement is not high, you do not need to compile it by means of Assembly, that is, you do not need to install it. MASM is generally provided by VC ++, and Windows NT 4.0 ddk a and Windows 98 DDK also contain MASM. Extract the xxxxxml.exeand xxxxxml.err files, named ml.exe and ML. Err, and put them in the path.

NASM can be obtained free of charge, many places can download to, such as http://www.kernel.org/pub/software/devel/nasm/binaries/win32/

The nasmw.exe file also needs to be placed in the path.

4. Open a DOS window and enter: Perl configure VC-WIN32

5. If you use MASM, enter Ms \ do_masm.

If NASM is used, enter: Ms \ do_nasm

If you do not use the Assembly Language compiler, enter: Ms \ do_ms

6. In the DOS window, enter nmake-F Ms \ NTDLL. Mak.

If there is no error, the compilation will pass. You can see the generated DLL file and executable file under the out32dll directory. Put them in a directory corresponding to the path environment variable.

 

 

How to compile OpenSSL in Windows (vs2005 uses the CL compiler of vc8)
1. Install ActivePerl // the perl interpreter is required during initialization.
2. Use Visual Studio 2005 command prompt under vs2005 to enter the Console mode (this mode will automatically set various environment variables)
3. decompress the OpenSSL package and enter the OpenSSL directory.
4. Perl configure VC-WIN32
Try to execute this command in this directory. Otherwise, the configure file cannot be found or the complete configure file path is specified.
5. Ms \ do_ms
Run the MS \ do_ms command in the decompressed directory.
6. nmake-F Ms \ NTDLL. Mak

After compilation
Run the command in the OpenSSL extract directory. After compilation. Output files are in out32dll, including applications.ProgramExecutable files, lib files, and DLL files

Note: The Cl compiler will complain when running Step 5. the read value of the \ crypto \ des \ enc_read.c file is the POSIX name for this item is deprecated (not recommended). _ read is recommended. I don't want to change all the read functions in OpenSSL to _ read. Check Cl errors againCodeError c2220, so on msdn:
Warning treated as error-no object file generated
/Wx tells the compiler to treat all warnings as errors. Since an error occurred, no object or executable file was generated.
Because the/wx option is set, all warnings are treated as errors...

Open the ntdll. Mak file under the MS directory under the OpenSSL directory, remove the/wx option of cflag, and save the disk...
Continue to run nmake-F Ms \ NTDLL. Mak

So success...
(I downloaded the openssl-0.9.8a Version)

 

 
Preparations:
 
1. Install visual c ++ 6.0:
 
When you directly register the environment variable when installing vc6.0, a step is skipped.
 
You have supported vc2005 since openssl0.9.7i, so you can install 2005.
 
2. Install perl5:
 
Search for ActivePerl for windows on the Internet. We need ActivePerl for Win32 x86. It is a Perl interpreter in windows, including Perl for Win32.
3. Download and decompress OpenSSL:
 
To begin.
 
The preparation is complete and compilation starts. Install, install. MacOS, install. NW,
Install. os2, install. VMS, install. w32, install. w64 and install. wce and other files, these files are prepared for the installation of OpenSSL for different operating systems, of course, learning to install in the Win32 environment. the W32 file is clearly written throughout the compilation and installation process:
 
1. Go to the OpenSSL folder on the console and run the configuration file (run configure ):

> Perl configure VC-WIN32

2. Build the makefiles and optionally the assembly language files:

-If you are using MASM then run:

> MS \ do_masm

-If you are using NASM then run:

> MS \ do_nasm

-If you don't want to use the assembly language files at all then run:

> MS \ do_ms

If you don't want to use assembly language files, use the third method.

3. Generate the library file:

> Nmake-F Ms \ NTDLL. Mak

Press enter to enter the compilation status. After the compilation is complete, Several folders will be added to the OpenSSL directory. The link library file and executable program will be obtained in out32dll, inc32 is the generated header file. These library files can be used with header files.

4. How to install it again:

> Nmake-F Ms \ NTDLL. Mak install

BTW: If nmake is not a command on the console, the environment variables of VC are not registered. Run the following command in the \ vc98 \ bin directory under the VC installation directory:

> Vcvars32.bat

In this way, the environment variables are registered. Try nmake again.

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.