Windows & gcc & mingw & Mysy compiling OpenSSL

Source: Internet
Author: User
Tags openssl library

Today, there is a project to use to HTTPS, has been using the HTTP request, with the socket () to implement HTTPS request I was really the first time to meet.

First online search for the relevant information, understand that HTTPS compared to HTTP is more than one authentication, send and receive data are encrypted, cannot be plaintext.

Then say download a OpenSSL, with this can implement HTTPS request.

I usually seldom write code in C, and when I study C, I choose a path that now seems to be not ideal (C & gcc & mingw & windows & Codeblocks)

I don't even have the basic GCC usage right now.

Spent the whole day, and finally completed OpenSSL in the local compilation, the following is my operation steps, collection, or the next time will need to be long:

1. Download MinGW and MSYS and install (can download from http://www.mingw.org/, MSYS can also be downloaded separately)

2. Download per 5.x, (Baidu Search: ActivePerl, you can download)

3. Download the OpenSSL source code (http://www.openssl.org/source/) and unzip to C:\openssl-1.0.1g when the download is complete

4. Run the MSYS console: Msys.bat

5. CD/C/OPENSSL-1.0.1G (This is the path written under Linux)

6. Compile method See Install file, and Install.win32 file

According to the instructions, execute the command sequentially:(before executing the command, it is recommended to 360 temporary exit, the compilation speed will improve a lot)

$./config

$ make (time spent on my computer: about 10 minutes)

$ make test (time spent on my computer: about 20 minutes)

$ make install (time on my computer: about 30 minutes) Note that you need to modify the Makefile file before executing this command.

The default compilation is a static library, and I need a dynamic library, just add the parameter shared:

$./config GKFX

$ make

$ make Test

$ make Install

The following is an excerpt from its INSTALL instructions file

Configuration Options

---------------------

There is several options to./config (or./configure) to customize

The build: .....

Shared in addition to the usual static libraries, create shared

Libraries on platforms where it ' s supported. See "Note on

Shared Libraries "below.

After the make install is complete, the OpenSSL library is found in the D:\MinGW\msys\1.0\local\ssl directory, including the header files, DLL files, etc.

---------------------------------------------------------------------------------

The first time I executed make install, it took about 30 minutes to complete, but at the end of the day I threw an error prompt:

Installing LIBCRYPTO.A

/bin/sh:line 5:codeblocksmingwbin/ranlib.exe:no such file or directory

Installing LIBSSL.A

/bin/sh:line 5:codeblocksmingwbin/ranlib.exe:no such file or directory

Make: * * * [INSTALL_SW] Error 1

See this meaning, is related to Ranlib.exe, did not find the file.

Because the path name is like Linux in the Mysy console, I open a Makefile file, search: Ranlib.exe

Find a line: ranlib= \codeblocks\mingw\bin/ranlib.exe

Look at this file name path strange, there are ' \ ', and '/', I searched the local computer ranlib.exe, found the file location, I modified to:

ranlib=/c/codeblocks/mingw/bin/ranlib.exe (i.e. C:\CodeBlocks\MinGW\bin\ranlib.exe)

Save and then re-execute make install, no more errors are thrown.

---------------------------------------------------------------------------------

Related information:

MinGW under Compile OpenSSL

http://blog.csdn.net/cibiren2011/article/details/10095021

Compiling OpenSSL with MinGW

http://blog.csdn.net/feiyunw/article/details/5597546

MinGW compile support for openssl-1.0.0a libcurl-7.21.3

http://blog.csdn.net/yui/article/details/6170889

How to build OpenSSL with MinGW in WIndows?

Http://stackoverflow.com/questions/9379363/how-to-build-openssl-with-mingw-in-windows

Compiling OpenSSL under Windows (VS2005)

http://lwglucky.blog.51cto.com/1228348/325483

2014-05-06

Windows & gcc & mingw & Mysy compiling OpenSSL

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.