openssl build MSYS2


vs使用openssl aes gcm

C++ Openssl AES GCM 128bits代码示例,可wins10的visual studio 2017 中直接运行_ChainingBlocks-CSDN博客

https://github.com/openssl/openssl/issues/10459

github 是否解决win下编译问题 提问

linux交叉编译win

 第一步:安装mingw32

本人 linux 环境是ubuntu18.04  

sudo apt-get install mingw-w64
sudo apt-get install mingw-w64-tools
sudo apt-get install mingw-w64-i686-dev
sudo apt-get install mingw-w64-x86-64-dev
https://blog.csdn.net/zuihaobushi/article/details/90167362

CROSS_COMPILE="x86_64-w64-mingw32-" ./Configure mingw64 no-asm shared --prefix=/opt/mingw64

PATH=$PATH:/opt/mingw64/bin make

sudo PATH=$PATH:/opt/mingw64/bin make install

https://www.cnblogs.com/findumars/p/6372299.html

http://www.blogcompiler.com/2011/12/21/openssl-for-windows/

https://www.perl.org/

msvc

perl Configure --prefix="%CD%\..\MSVC64r\dll" --openssldir="%CD%\..\MSVC64r\dll\ssl" -EHsc -arch:AVX -FS threads no-deprecated shared VC-WIN64A && nmake
./Configure --prefix=$PWD/GCC32r shared mingw --unified && make depend && make && make install
pacman -S base-devel msys2-devel mingw-w64-{x86_64,i686}-toolchain 

perl Configure mingw64 no-shared --prefix=/d/Code/openssl-1.0.2a/build-x64-PT-seh

./Configure threads no-deprecated shared mingw64 >_Configure.log && make
perl Configure -MTd threads no-deprecated no-shared debug-VC-WIN64A && nmake
    • '/MDd' for Debug+Shared build,
    • '/MD' for Release+Shared build,
    • '/MT' for Release+Static build,
      as expected according to its description. But for some reason it add
    • '/MT' and '/MDd' keys, instead of '/MTd', for Debug+Static build.
./Configure --prefix="$PWD/../GCC64d" -std=gnu11 -mtune=native -march=native threads no-deprecated shared debug-mingw64 >_Configure.log && ma ke 

./configure --prefix="$BASEDIR" \ --with-mibdirs="$BASEDIR/share/snmp/mibs" \ --with-mib-modules="agentx disman/event-mib winExtDLL "\ --disable-embedded-perl --without-perl-modules --enable-ipv6

./Configure --prefix="$PWD/../GCC64r" -std=gnu11 -mtune=native -march=native threads no-deprecated shared mingw64 && make

 perl Configure mingw64 --cross-compile-prefix=x86_64-w64-mingw32-

Then I make with no problems:
make

Then I test:
make test

    perl Configure VC-WIN64A shared --prefix=\dev\openssl-1.1.1 /FS
    jom -j 8
    perl Configure VC-WIN64A shared --prefix=\dev\openssl /FS
    jom -j 8
perl Configure mingw no-shared no-asm --prefix=/c/OpenSSL
make depend
make 

 

 git config core.autocrlf false
git rm --cached -r .
git reset --hard

git config --local core.autocrlf false
git config --local core.eol lf

git rm --cached -r .
git reset --hard

前文 git等各种源码仓库

https://www.cnblogs.com/marklove/p/11831539.html

x1 >> O             git clone https://github.com/openssl/openssl git submodule update --init --recursive ./configure mingw64 shared

./Configure mingw64 初始化配置 2

pacman -S base-devel pacman -S mingw-w64-x86_64-toolchain /*pacman -S mingw64/mingw-w64-x86_64-gcc*/
windows

刚开始编译时提示找不到gcc

添加环境变量
export PATH=$PATH:/mingw64/bin
$source /etc/profile

将openssl源码复制到C:\msys64\home\world下

MSYS2 SHELL

切换到

/home/world/openssl

./Configure mingw64

make

============================================

ubuntu下

进去openssl

perl Configure gcc shared

make

常用软件包编译

常用软件包我们可以简单的使用命令直接从官网安装即可,比如安装openssl:

  • 32bit:pacman -S mingw-w64-i686-openssl
  • 64bit: pacman -S mingw-w64-x86_64-openssl

有时候根据项目需要我们不得不自己动手编译依赖的软件包,以下是我在工作用到的库编译过程记录。

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b6a2fea39318e43fee84fa7b0b90d68bed92d2ba

更新:如果你觉得勇敢,你可以说

ulimit -s unlimited

与任何shell扩展,你会没事的,只要你有足够的内存。

这是一个黑客。 你知道怎么设置堆栈限制吗? 这也会影响其他进程开始在同一个会话。

是的,这是一个黑客。 大多数时候这种黑客是一次性(多长时间你手动移动大量的文件呢?)。 如果你确定这个过程不会吃你所有的内存,你可以设置

ulimit - s无限 实际的命令行限制是2 ^ 31日或2 GB。 ( MAX_ARG_STRLEN 在内核源代码)。

https://unix.stackexchange.com/questions/128559/solving-mv-argument-list-too-long

文献https://github.com/imyller/meta-nodejs/issues/9

源码移动到 C:\msys64\home\freem\openssl  问题依旧。待解决     perl util/mkbuildinf.pl "gcc -m64 -Wall -O3 -DL_ENDIAN -DOPENSSL_PIC -DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN -D_MT -DNDEBUG" "mingw64" > perl的锅??  make build_modules_nodep 能生成 libssl-3-x64.dll  libcrypto-3-x64.dll   不需要的算法配置  
Ciphers:

no-idea       -DOPENSSL_NO_IDEA
no-aes        -DOPENSSL_NO_AES
no-camellia   -DOPENSSL_NO_CAMELLIA
no-seed       -DOPENSSL_NO_SEED
no-bf         -DOPENSSL_NO_BF
no-cast       -DOPENSSL_NO_CAST
no-des        -DOPENSSL_NO_DES
no-rc2        -DOPENSSL_NO_RC2
no-rc4        -DOPENSSL_NO_RC4
no-rc5        -DOPENSSL_NO_RC5

no-md2        -DOPENSSL_NO_MD2
no-md4        -DOPENSSL_NO_MD4
no-md5        -DOPENSSL_NO_MD5
no-sha        -DOPENSSL_NO_SHA
no-ripemd     -DOPENSSL_NO_RIPEMD
no-mdc2       -DOPENSSL_NO_MDC2

no-rsa        -DOPENSSL_NO_RSA
no-dsa        -DOPENSSL_NO_DSA
no-dh         -DOPENSSL_NO_DH

no-ec         -DOPENSSL_NO_EC
no-ecdsa      -DOPENSSL_NO_ECDSA
no-ecdh       -DOPENSSL_NO_ECDH

Non-cipher functionality:

no-sock       -DOPENSSL_NO_SOCK         No socket code.
no-ssl2       -DOPENSSL_NO_SSL2         No SSLv2.
no-ssl3       -DOPENSSL_NO_SSL3         No SSLv3.
no-err        -DOPENSSL_NO_ERR          No error strings.
no-krb5       -DOPENSSL_NO_KRB5         No Kerberos v5.
no-engine     -DOPENSSL_NO_ENGINE       No dynamic engines.
no-hw         -DOPENSSL_NO_HW           No support for external hardware.

Not documented:

no-tlsext     -DOPENSSL_NO_TLSEXT
no-cms        -DOPENSSL_NO_CMS
no-jpake      -DOPENSSL_NO_JPAKE
no-capieng    -DOPENSSL_NO_CAPIENG
./config no-idea no-aes no-camellia no-seed no-bf no-cast no-des no-rc2 no-rc4 no-rc5 \
no-md2 no-md4 no-ripemd no-mdc2 no-rsa no-dsa no-dh no-ec no-ecdsa no-ecdh no-sock \
no-ssl2 no-ssl3 no-err no-krb5 no-engine no-hw
make depend
make build_crypto
  x1 >> O x1 x1 >> O x1 x1 >> O x1 x1 >> O x1 x1 >> O x1 x1 >> O x1 x1 >> O x1 x1 >> O x1 x1 >> O x1 x1 >> O x1 x1 >> O x1 x1 >> O x1 x1 >> O x1