Using VS2005 to compile OpenSSL under Windows environment

Source: Internet
Author: User

How to use VS2005 to compile OpenSSL in Windows environment, although this issue in Baidu, Google a bunch of, but the installation still encountered some problems, here to record down hope to help you do not detour. Note: I was successfully compiled under WinXP SP3 under Vs2005sp1, and the version of OpenSSL is 0.9.8l.

http://www.cnblogs.com/moonset7/archive/2009/12/18/1627317.html by Month winding

First, compile OpenSSL

Preparatory work:
Download OpenSSL source official website Download openssl:http://www.openssl.org/source/
Install ActivePerl official website Download activeperl:http://www.activestate.com/activeperl/

Compile steps:
1. Enter console mode using Visual Studio 2005 Command prompt under VS2005
Start Menu All Programs->microsoft->microsoft Visual Studio 2005->visual Studio tools->visual Studio 2005 Command Prompt
2. Enter the OpenSSL source directory
Command line type CD D:\openssl-0.9.8l//Replace the path with your own source path
3. Command line type Perl Configure Vc-win32
ActivePerl will not execute if not installed
4. Command line type Ms\do_ms
I met two reports in the middle of this.%osversion% is not defined at util/pl/vc-32.pl Line 57. And compilation failed in require on util\mk1mf.pl line 151 . Seems to be able to ignore, anyway, I finally succeeded in compiling.

Command line information

5. Build static and dynamic libraries in two different situations
(1) If you are compiling the OpenSSL dynamic library, type nmake-f ms\ntdll.mak at the command line
Compile into homework in the folder Out32dll to view the output files, including the application EXE files, lib files, dll files.
(2) If you are compiling the OpenSSL static library, type Nmake-f ms\nt.mak at the command line
Compile into homework in the folder Out32 to view the output files, including the application EXE files, lib files.

To this compilation has been completed, will be under OpenSSL include folder, lib file, DLL file, the use of the time included in the line.

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

Issues that may be encountered in compiling OpenSSL:
1. Enable the Windows console (run cmd) to compile, perform step 5th nmake-f Ms\ntdll.mak or Nmake-f Ms\nt.mak will error:
' NMAKE ' is not an internal or external command, nor is it a program or batch file that can be run.
2. Enable SDK Command prompt to compile, perform 5th step nmake-f Ms\ntdll.mak or Nmake-f Ms\nt.mak will error:
MS\UPLINK.C (one): Fatal error C1083:cannot open include file: ' windows.h ': No such file or directory
Nmake:fatal error U1077: ' "D:\Program Files\Microsoft Visual Studio 8\vc\bin\cl. EXE "': Return code ' 0x2 ' Stop.

Solutions to the above problems:
1. Strictly follow the 1th step, start the Visual Studio 2005 Command prompt to compile, this will automatically configure the environment.
2. Before performing step 5th nmake-f Ms\ntdll.mak, enter D:\Program Files\Microsoft Visual Studio 8\VC\bin Path (replace with your own VC installation path), command line type VCVARS32, Run Vcvars32.bat. Then go back to the OpenSSL source directory (D:\openssl-0.9.8l), then perform the 5th step nmake-f Ms\ntdll.mak or Nmake-f Ms\nt.mak

Ii. use of OpenSSL
Configure the use of the above function library in VC:
Click menu: Tools, Options, pop up the dialog "Options" and select the "Directories" tab in the dialog box.
Add the directory "C:\openssl\include" to the "Include files" option in "Show Directories for:" and "C:\openssl\lib" in the "Library files" selection.
Then add "Libeay32.lib" when compiling a project that requires a link to the OpenSSL function library.

Using VS2005 to compile OpenSSL under Windows environment

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.