Compiling OpenSSL with MinGW - Q

2021-01-07  本文已影响0人  XBruce

Compiling OpenSSL with MinGW - Qt Wiki

Compiling OpenSSL with MinGW

Jump to: navigation, search

En Ar Bg De El Es Fa Fi Fr Hi Hu It Ja Kn Ko Ms Nl Pl Pt Ru Sq Th Tr Uk Zh

Qt 5 / QtWebkit can make use of OpenSSL, which MinGW distributions do not ship.

<input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="direction: ltr; position: absolute; opacity: 0; z-index: -1; display: none;">

Contents

<label class="toctogglelabel" for="toctogglecheckbox" style="cursor: pointer; color: rgb(6, 69, 173);"></label>

Pre-built packages

The Win32OpenSSL project provides pre-compiled libraries for both 32 and 64 bit. However, these depend on the Microsoft Visual C++ 2008 runtime being installed.

Inside MSYS2 shell, pre-built openssl can be obtained from MSYS2 repo, with this command: pacman -S openssl

Compiling on your own

Requirements

How to build

$ tar xvzf openssl-1.0.1c.tar.gz $ cd openssl-1.0.1c

$ export PATH="/c/Mingw-builds/bin:$PATH"

$ export PATH="/c/mingw32/bin:$PATH"

$ export PATH="/c/msys2/mingw32/bin:$PATH"

1. or if using 64-bit MSYS2 $ export PATH="/c/msys64/mingw32/bin:$PATH"

$ export PATH="/c/msys32/mingw64/bin:$PATH"

1. or if using 64-bit MSYS2 $ export PATH="/c/msys64/mingw64/bin:$PATH"

<pre style="font-family: monospace, monospace; color: rgb(0, 0, 0); background-color: rgb(248, 249, 250); border: 1px solid rgb(234, 236, 240); padding: 1em; white-space: pre-wrap; line-height: 1.3em; tab-size: 4;"># should point to a mingw distribution of gcc

$ which gcc
/c/msys64/mingw32/bin/gcc
</pre>

$ ./Configure --prefix=$PWD/dist no-idea no-mdc2 no-rc5 shared mingw

$ ./Configure --prefix=$PWD/dist no-idea no-mdc2 no-rc5 shared mingw64

$ make depend && make && make install

Errors

perl asm/sha1-x86_64.pl mingw64 > sha1-x86_64.s gcc -I.. -I../.. -I../modes -I../asn1 -I../evp -I../../include -D_WINDLL -DOPENSSL_PIC -DOPENSSL_TH READS -D_MT -DDSO_WIN32 -DL_ENDIAN -O3 -Wall -DWIN32_LEAN_AND_MEAN -DUNICODE -D_UNICODE -DOPENSSL_IA 32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM- DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -c -o sha1-x86_ 64.o sha1-x86_64.s sha1-x86_64.s: Assembler messages: sha1-x86_64.s:1824: Warning: end of file not at end of a line; newline inserted sha1-x86_64.s:2183: Error: number of operands mismatch forrol' make[2]: *** [sha1-x86_64.o] Error 1** make[2]: Leaving directory /d/dev/tmp/openssl-1.0.1c/crypto/sha' make[1]:*** [subdirs] Error 1** make[1]: Leaving directory/d/dev/tmp/openssl-1.0.1c/crypto' make: *** [build_crypto] Error 1**`

check out http://openssl.6102.n7.nabble.com/Compile-error-with-MinGW-w64-td36657.html *** Use perl inside MSYS or inside MSYS2** *** or change crypto/perlasm/x86_64-xlate.pl as mentioned in the e-mail thread.**

Using it

C:\> set PATH=PATH;C:–1.0.1c\dist\bin C:\> set INCLUDE=INCLUDE;C:–1.0.1c\dist\include C:\> set LIB=LIB;C:–1.0.1c\dist\lib

$ export PATH="$PATH:/c/openssl-1.0.1c/dist/bin" $ export INCLUDE="$INCLUDE:/c/openssl-1.0.1c/dist/include" $ export LIB="$LIB:/c/openssl-1.0.1c/dist/lib"

When you now run Qt's configure.exe openssl should be detected, and Qt links against the libraries.

上一篇 下一篇

猜你喜欢

热点阅读