Windows under OpenSSL compilation

Source: Internet
Author: User

Last night, when compiling rabbitmq-c, you encountered the following error when building vs project files using CMake:

CMake Error at C:/Program files/cmake/share/cmake-3.6/modules/findpackagehandlestandardargs.cmake:148 (message):
Could not find OpenSSL, try to set the path to OpenSSL root folder in the
System Variable Openssl_root_dir (missing:openssl_libraries
Openssl_include_dir) (Required is at least version "0.9.8")
Call Stack (most recent call first):
C:/Program files/cmake/share/cmake-3.6/modules/findpackagehandlestandardargs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
C:/Program files/cmake/share/cmake-3.6/modules/findopenssl.cmake:380 (Find_package_handle_standard_args)
cmakelists.txt:273 (Find_package)

After investigation, the need for source installation OpenSSL and the need for the relevant header files (for the sake of simplicity, using the direct download of the second plate, no). So download the OpenSSL 0.9.8g for compilation.

First make sure to install ActivePerl.

1. Perl Configure Vc-win32 No-asm

No-asm must be specified, or there will be a lot of compile error, specifying--PREFIX=E:\OPENSSL can be installed to the appropriate directory.

2, Ms\do_nasm.bat

The MS subdirectory generates the Nt.make and Ntdll.make files, which must be do_nasm instead of Do_ms because the NO-ASM is specified.

3, Nmake-f Ms\ntdll.mak

4, nmake-f Ms\ntdll.mak install #安装到prefix指定的目录


Microsoft (R) Program Maintenance Utility version 11.00.50727.1
Copyright (C) Microsoft Corporation. All rights reserved.

Building OpenSSL
Perl util/mkdir-p.pl E:\openssl
Perl util/mkdir-p.pl E:\openssl\bin
Created directory ' E:/openssl/bin '
Perl util/mkdir-p.pl E:\openssl\include
Created directory ' E:/openssl/include '
Perl util/mkdir-p.pl E:\openssl\include\openssl
Created directory ' E:/openssl/include/openssl '
Perl util/mkdir-p.pl E:\openssl\lib
Created directory ' E:/openssl/lib '
Perl util/copy.pl inc32\openssl\*. [CH] E:\openssl\include\openssl
Copying:inc32/openssl/aes.h to E:/openssl/include/openssl/aes.h
COPYING:INC32/OPENSSL/APPLINK.C to E:/OPENSSL/INCLUDE/OPENSSL/APPLINK.C
Copying:inc32/openssl/asn1.h to E:/openssl/include/openssl/asn1.h
Copying:inc32/openssl/asn1_mac.h to E:/openssl/include/openssl/asn1_mac.h
Copying:inc32/openssl/asn1t.h to E:/openssl/include/openssl/asn1t.h
Copying:inc32/openssl/bio.h to E:/openssl/include/openssl/bio.h
COPYING:INC32/OPENSSL/BLOWFISH.H to E:/OPENSSL/INCLUDE/OPENSSL/BLOWFISH.H
Copying:inc32/openssl/bn.h to E:/openssl/include/openssl/bn.h
Copying:inc32/openssl/buffer.h to E:/openssl/include/openssl/buffer.h
Copying:inc32/openssl/cast.h to E:/openssl/include/openssl/cast.h
Copying:inc32/openssl/comp.h to E:/openssl/include/openssl/comp.h
Copying:inc32/openssl/conf.h to E:/openssl/include/openssl/conf.h
Copying:inc32/openssl/conf_api.h to E:/openssl/include/openssl/conf_api.h
Copying:inc32/openssl/crypto.h to E:/openssl/include/openssl/crypto.h
Copying:inc32/openssl/des.h to E:/openssl/include/openssl/des.h
Copying:inc32/openssl/des_old.h to E:/openssl/include/openssl/des_old.h
COPYING:INC32/OPENSSL/DH.H to E:/OPENSSL/INCLUDE/OPENSSL/DH.H
Copying:inc32/openssl/dsa.h to E:/openssl/include/openssl/dsa.h
Copying:inc32/openssl/dso.h to E:/openssl/include/openssl/dso.h
Copying:inc32/openssl/dtls1.h to E:/openssl/include/openssl/dtls1.h
Copying:inc32/openssl/e_os2.h to E:/openssl/include/openssl/e_os2.h
Copying:inc32/openssl/ebcdic.h to E:/openssl/include/openssl/ebcdic.h
Copying:inc32/openssl/ec.h to E:/openssl/include/openssl/ec.h
COPYING:INC32/OPENSSL/ECDH.H to E:/OPENSSL/INCLUDE/OPENSSL/ECDH.H
Copying:inc32/openssl/ecdsa.h to E:/openssl/include/openssl/ecdsa.h
Copying:inc32/openssl/engine.h to E:/openssl/include/openssl/engine.h
Copying:inc32/openssl/err.h to E:/openssl/include/openssl/err.h
Copying:inc32/openssl/evp.h to E:/openssl/include/openssl/evp.h
Copying:inc32/openssl/hmac.h to E:/openssl/include/openssl/hmac.h
Copying:inc32/openssl/idea.h to E:/openssl/include/openssl/idea.h
Copying:inc32/openssl/krb5_asn.h to E:/openssl/include/openssl/krb5_asn.h
Copying:inc32/openssl/kssl.h to E:/openssl/include/openssl/kssl.h
COPYING:INC32/OPENSSL/LHASH.H to E:/OPENSSL/INCLUDE/OPENSSL/LHASH.H
Copying:inc32/openssl/md2.h to E:/openssl/include/openssl/md2.h
Copying:inc32/openssl/md4.h to E:/openssl/include/openssl/md4.h
Copying:inc32/openssl/md5.h to E:/openssl/include/openssl/md5.h
Copying:inc32/openssl/obj_mac.h to E:/openssl/include/openssl/obj_mac.h
Copying:inc32/openssl/objects.h to E:/openssl/include/openssl/objects.h
Copying:inc32/openssl/ocsp.h to E:/openssl/include/openssl/ocsp.h
Copying:inc32/openssl/opensslconf.h to E:/openssl/include/openssl/opensslconf.h
Copying:inc32/openssl/opensslv.h to E:/openssl/include/openssl/opensslv.h
Copying:inc32/openssl/ossl_typ.h to E:/openssl/include/openssl/ossl_typ.h
Copying:inc32/openssl/pem.h to E:/openssl/include/openssl/pem.h
Copying:inc32/openssl/pem2.h to E:/openssl/include/openssl/pem2.h
Copying:inc32/openssl/pkcs12.h to E:/openssl/include/openssl/pkcs12.h
Copying:inc32/openssl/pkcs7.h to E:/openssl/include/openssl/pkcs7.h
Copying:inc32/openssl/pq_compat.h to E:/openssl/include/openssl/pq_compat.h
Copying:inc32/openssl/pqueue.h to E:/openssl/include/openssl/pqueue.h
Copying:inc32/openssl/rand.h to E:/openssl/include/openssl/rand.h
Copying:inc32/openssl/rc2.h to E:/openssl/include/openssl/rc2.h
Copying:inc32/openssl/rc4.h to E:/openssl/include/openssl/rc4.h
Copying:inc32/openssl/ripemd.h to E:/openssl/include/openssl/ripemd.h
Copying:inc32/openssl/rsa.h to E:/openssl/include/openssl/rsa.h
Copying:inc32/openssl/safestack.h to E:/openssl/include/openssl/safestack.h
Copying:inc32/openssl/sha.h to E:/openssl/include/openssl/sha.h
Copying:inc32/openssl/ssl.h to E:/openssl/include/openssl/ssl.h
Copying:inc32/openssl/ssl2.h to E:/openssl/include/openssl/ssl2.h
Copying:inc32/openssl/ssl23.h to E:/openssl/include/openssl/ssl23.h
Copying:inc32/openssl/ssl3.h to E:/openssl/include/openssl/ssl3.h
Copying:inc32/openssl/stack.h to E:/openssl/include/openssl/stack.h
Copying:inc32/openssl/store.h to E:/openssl/include/openssl/store.h
Copying:inc32/openssl/symhacks.h to E:/openssl/include/openssl/symhacks.h
Copying:inc32/openssl/tls1.h to E:/openssl/include/openssl/tls1.h
Copying:inc32/openssl/tmdiff.h to E:/openssl/include/openssl/tmdiff.h
Copying:inc32/openssl/txt_db.h to E:/openssl/include/openssl/txt_db.h
Copying:inc32/openssl/ui.h to E:/openssl/include/openssl/ui.h
Copying:inc32/openssl/ui_compat.h to E:/openssl/include/openssl/ui_compat.h
Copying:inc32/openssl/x509.h to E:/openssl/include/openssl/x509.h
Copying:inc32/openssl/x509_vfy.h to E:/openssl/include/openssl/x509_vfy.h
Copying:inc32/openssl/x509v3.h to E:/openssl/include/openssl/x509v3.h
Perl util/copy.pl Out32dll\openssl.exe E:\openssl\bin
Copying:out32dll/openssl.exe to E:/openssl/bin/openssl.exe
Perl util/copy.pl apps\openssl.cnf E:\openssl
COPYING:APPS/OPENSSL.CNF to E:/OPENSSL/OPENSSL.CNF
Perl util/copy.pl Out32dll\ssleay32.dll E:\openssl\bin
Copying:out32dll/ssleay32.dll to E:/openssl/bin/ssleay32.dll
Perl util/copy.pl Out32dll\libeay32.dll E:\openssl\bin
Copying:out32dll/libeay32.dll to E:/openssl/bin/libeay32.dll
Perl util/copy.pl Out32dll\ssleay32.lib E:\openssl\lib
Copying:out32dll/ssleay32.lib to E:/openssl/lib/ssleay32.lib
Perl util/copy.pl Out32dll\libeay32.lib E:\openssl\lib
Copying:out32dll/libeay32.lib to E:/openssl/lib/libeay32.lib

The generated dynamic and static libraries are named: Libeay32.dll,libeay32.lib,ssleay32.dll,ssleay32.lib, and Openssl.exe.

Related error:

The third step, if reported:

. \CRYPTO\CVERSION.C: Error C2220: Warning is treated as error-no "object" file generated
. \CRYPTO\CVERSION.C: Warning C4129: "O": Unrecognized character escape sequence
Nmake:fatal error U1077: "" C:\Program Files (x86) \microsoft Visual Studio 11.0\vc\bin\cl. EXE "": Return Code "0x2"
Stop.

Then open the Ms\ntdll.mak file and remove the/WX, as follows:

If the newspaper:

F:\Microsoft Visual Studio 10.0\vc\include\errno.h: Error c2220:warning treated as Error-no ' object ' file generate D

F:\Microsoft Visual Studio 10.0\vc\include\errno.h: Warning C4005: ' eaddrinuse ': Macro redefinition
Tmp32dll\e_os.h (153): See previous definition of ' eaddrinuse '
Nmake:fatal error U1077: ' "F:\Microsoft Visual Studio 10.0\vc\bin\cl. EXE "': Return code ' 0x2 ' Stop.

Then:. Open the Errno.h file, locate line 92nd, comment out the # define Eaddrinuse 100

if the report ' nmake ' is not an internal or external command, or a program or batch file that can be run, use the VS self-brought cmd as follows:

Reference:

http://blog.csdn.net/eclipser1987/article/details/17588041

Http://www.cnblogs.com/yidev/p/6373283.html

Http://blog.163.com/[email protected]/blog/static/68117214201332761143157/

Http://shikezhi.com/html/2016/windows_0608/1140879.html

http://blog.csdn.net/pony_maggie/article/details/8588888

Http://www.cnblogs.com/yidev/p/6373283.html

https://www.openssl.org/source/old/0.9.x/

http://blog.csdn.net/lg1259156776/article/details/52529704

As for the others, they are purely nonsense.

Windows under OpenSSL compilation

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.