windows compile libcurl + openssl

use:

c ++ send http requests using curl library, there are some functions, such as MD5, hac encryption, we need to use openssl;

So it is necessary

OpenSSL is an open source third-party library that implements the SSL (Secure SocketLayer) and TLS (Transport Layer Security) protocol, is widely used in enterprise applications. For the average developer,  Win32 OpenSSL  download a good way to have compiled OpenSSL library is easy and effort on. For advanced users to develop, may require appropriate modifications or cut OpenSSL, then compile it became a key issue.

Here, we focus on how to compile OpenSSL libraries in Windows.

Copyright: a go, two or three miles, shall not be reproduced without the bloggers allowed.

Preparing the Environment

  1. Download and install the Visual Studio (VS 2015 with an example).

  2. Download and install ActivePerl. 
    Download: http://www.activestate.com/activeperl/downloads 
    I downloaded: ActivePerl-5.26.0.2600-MSWin32-x64-403866.exe

    Open a command prompt, navigate to the  D:\Program Files\Perl\eg directory, execute  perl example.pl, if prompted  Hello from ActivePerl! then the Perl installation was successful:

    Write pictures described here

  3. Download and install Nasm assembler, and  D:\Program Files\NASM added to the Path system environment variable. 
    Download: http://www.nasm.us/ 
    I downloaded: nasm-2.13.01-Installer-x64.exe

  4. Download and install the OpenSSL 
    Download: http://www.openssl.org/ 
    I downloaded: OpenSSL-1.0.2m.tar.gz

    Complete all the steps above to unpack the OpenSSL package  E:\openssl-1.0.2m, you can build.

    Note:  unpacked directory there are two files - INSTALL.W32, INSTALL.W64, contains a separate compilation step for OpenSSL.

Compilation step

  1. Open a command prompt, navigate to  E:\openssl-1.0.2m:

    Write pictures described here

  2. Input  perl Configure VC-WIN32 --prefix=E:\OpenSSL(to install it  E:\OpenSSL):

    Write pictures described here

  3. Input  ms\do_nasm:

    Write pictures described here

  4. The positioning command to the prompt  D:\Program Files\Microsoft Visual Studio 14.0\VC\bin, and enter vcvars32.bat:

    Write pictures described here

    Without this step, you will be prompted nmake is not an internal or external command and a series of errors.

  5. Again to locate the command prompt  E:\openssl-1.0.2m, and enter  nmake -f ms\ntdll.mak:

    Write pictures described here

    After completion, it will  openssl-1.0.2m generate a file named out32dll folder directory, which contains some dynamic libraries and exe files:

    Write pictures described here

  6. Enter  nmake -f ms\ntdll.mak test, if the final display  passed all tests then the correct library generated:

    Write pictures described here

  7. Input  nmake -f ms\ntdll.mak install:

    Write pictures described here

    After completion, it will  E:\OpenSSL generate bin, include, lib directory, ssl four folders:

    Write pictures described here

note:

  • Above is compiled release version to compile debug version of the above-mentioned step 2 of the  VC-WIN32 change  debug-VC-WIN32can be.
  • To compile a static library, use  ms\nt.mak replace used above  ms\ntdll.mak can be.
  • To generate a library without compilation support, you need to use the above-described steps 2  perl Configure VC-WIN32 no-asm --prefix=E:\OpenSSL and  ms\do_ms replaced.
  • In  E:\openssl-1.0.2m\tmp32dll comprising a respective file folder assembly.

Guess you like

Origin blog.csdn.net/qq_34326603/article/details/80935976