Compile OpenSSL notes for Windows and compile openssl notes

Source: Internet
Author: User

Compile OpenSSL notes for Windows and compile openssl notes

OpenSSL coding process in Window

1. Download ActivePerl-5.12.4.1205, openssl-0.9.8, configure Perl environment variables, unzip openssl-0.9.8
2. Go to CMD and enter the VS2008/VS2010 command prompt interface. Run: vcvarsall. bat
3. CD cut into the openssl-0.9.8 unzip directory and execute the perl Configure VC-WIN32
4. Execute ms \ do_ms
5. Modify the compilation parameters to go to ms \ nt. mak and ms \ ntdll. mak. Remove the parameters:/WX/G5.
6. Run nmake-f ms \ ntdll. mak (dynamic library) or nmake-f ms \ nt. mak (static library)
The compile result is: compiled by VS2010 using nmake-f ms \ ntdll. mak, and compiled by VS2008 using nmake-f ms \ nt. mak
Among them, VS2008 ntdll. mak is compiled and approved, but an exception occurs.
7. cd out32dll or cd out32 cut into the output directory and execute the command .. \ ms \ test
Result: passed all tests encoding is successful.



Configure the development environment. Take VS2008 as an example:
1. Choose tools> Options> projects and solutions> VC ++ directory to add two items:
1. Switch the drop-down list to the include directory under the OpenSSL decompression path for the included files.
2. Switch the drop-down list to the outdll directory or out32dll directory after the library file is added.

2. Project-> Properties dialog box, configure properties-> linker-> command line to add ssleay32.lib libeay32.lib to save, you can also cancel this step and introduce it in the code file
# Pragma comment (lib, "ssleay32.lib ")
# Pragma comment (lib, "libeay32.lib ")

After that, you can go to the next step to call the code. If a running exception still persists, go to the project-> Properties dialog box, configure properties-> C/C ++-> switch the code generation Runtime Library to multi-threaded DLL (/MD), because OPENSSL uses the/MD mode by default.

In addition, the code in the compile nmake-f ms \ ntdll. mak mode of VS2008 cannot run normally. The code in nmake-f ms \ nt. mak mode will resume normal operation.

After debugging, the Debug mode runs abnormally in the XP environment, because there is no Debug Runtime Library environment in the XP environment, and the Release mode can be switched to compile the runtime.

Before VS2010, the DLL has the program configuration, which is canceled after VS2010. Sometimes different runtime environments, such as the VC90 environment and the VC100, may encounter an error when running different linear DLL libraries. For more information, see static linear programming.

Check the running environment list:
In the "project"> "properties" dialog box, choose "Configure properties"> "configuration tool"> "Input and Output embedded List". In this case, a. manifest suffix file with the same name is generated during the next compilation.

To avoid unnecessary troubles, if VS2008 is used as the development environment, VS2008 is used as the DLL compiling environment, just like VS2010.



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.