Compiling OpenSSL with MinGW

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

Pre-built packages

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

Compiling on your own

Requirements

How to build

  • Download latest OpenSSL from http://www.openssl.org/source (e.g. openssl-1.0.1c.tar.gz)
  • Start a MSYS command prompt (C:\msys\1.0\msys.bat)
  • Extract tar.gz using MSYS tar (and ignore the symlink warnings)
    • don’t use 7zip or other apps, since they fail to set up any symlinks! tar will also complain about symlinks, but compilation will still succeed.

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

Check that gcc is in PATH, otherwise add it, e.g.

  1. $ export PATH =/c /Mingw -builds /bin :$PATH

for MinGW (32 bit) do:

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

for MinGW-w64 do:

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

Compile & install:

  1. $ make depend  && make  && make install

Errors

If you run into

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

check out http://openssl.6102.n7.nabble.com/Compile-error-with-MinGW-w64-td36657.html

  • Use MSYS perl
  • or change crypto/perlasm/x86_64-xlate.pl as mentioned in the e-mail thread.

Using it

Add the bin, include, lib folders to your compilation environment, e.g. for cmd.exe:

  1. C :\ > set PATH =%PATH %;C :\openssl -1.0.1c\dist\bin
  2. C :\ > set INCLUDE =%INCLUDE %;C :\openssl -1.0.1c\dist\include
  3. C :\ > set 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.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值