Windows under OpenSSL installation and configuration

Source: Internet
Author: User

Failed to compile Thirift

Many online methods, mostly for 32-bit machines, their own computer because it is win7,64 bit, groping for a long time to install successfully.

Environment

WIN7, 64-bit, vs2005

Download ActivePerl

Some MAK files need to be generated during configuration, which are generated in Perl scripts, so install a activeperl.

Website: http://www.activestate.com/activeperl/

I have downloaded two versions:

1 activeperl-5.16. 2.1602-mswin32-x64-296513. msi  2 activeperl-5.16.  2.1602-mswin32-x86-296513. msi  

The first version, 64-bit, is installed.

Download OpenSSL

URL http://www.openssl.org/

I am using the openssl-0.9.8g version, extracted to the C packing directory.

Installation steps:

(can refer to Install.win32 under the OpenSSL directory)

1 Open command line

Enter the OpenSSL source directory.
CD C:/OPENSSL-0.9.8.G
Execute Perl Configure Vc-win32

2 running Ms\do_ms in the C:/OPENSSL-0.9.8.G directory

The other two methods must also be used to ensure that the machine has a compiler to use.

: Ms\do_masm (Default VC comes with the compiler; also download and install it yourself)

: ms\do_nasm (download required)

3 DOS window go to C:\Program Files\Microsoft Visual Studio \vc98\bin directory (that is, VC or vs corresponding directory, your computer may be different)

Execute the vcvars32.bat to configure the environment variables. Successful displays as follows:

4. Jump to the OpenSSL directory and compile the dynamic link library

CD C:/OPENSSL-0.9.8.G
Execute >nmake-f Ms\ntdll.mak

If the compilation succeeds, the output is in the Out32dll directory: including executables, two DLLs, and two lib files: Libeay32.dll, Libeay32.lib, Ssleay32.dll,ssleay32.lib

If you encounter an "ML is not internal or external command" error, locate your computer's Ml.exe file copy to the current directory to re-execute.

Here is a special emphasis, this method is generated by the library link library, that is, our application engineering if you want to use OpenSSL, compile time to specify

LIB file, the corresponding DLL is used when the program is published. I have encountered a situation where a program using OpenSSL that was released under Win7 could not run, and the popup

"Runtime initialization related errors", but compiled under XP, published, can be run on other Win7 and WinXP. It is estimated that the Win7 is not configured properly, resulting in only natively compiled, run, and cannot be published.

If you want to compile OpenSSL into a static library, as long as the above Ntdll.mak replaced with Nt.mak, I tried to use a static library, found to solve a lot of compile-time compatibility, conflict issues, it is recommended not to use static methods.

Let's test it here.

Establish engineering

Open VS2005,

In Additionalinclude directories plus

"C:\openssl-0.9.8g\include"

This directory.

In additionallibrary directories plus

"C:\openssl-0.9.8g\out32dll"

This directory

The code looks like this:

1#include <stdio.h>2#include <stdlib.h>3#include <string.h>4#include <time.h>5#include <openssl/bn.h>6#include <openssl/ec.h>7#include <openssl/rand.h>8#include <openssl/err.h>9#include <openssl/ecdsa.h>Ten#include <openssl/ecdh.h> One#include"sm2.h"   A     -#pragmacomment (Lib,"Libeay32.lib")

There is no problem with compiling. Also under VC6, the above two directories are included and compiled.

Windows under OpenSSL installation and configuration

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.