Cross Compiling OPENSSL from WSL/Linux to Windows
Flags for the different binaries need to be overwritten when generating the Makefile with Configure
https://github.com/openssl/openssl?tab=readme-ov-file
https://gist.github.com/udnaan/80c5ad125fc4702309b9
./Configure --cross-compile-prefix=x86_64-w64-mingw32- mingw64
make
make install
.. . .
So the above was from a guide but at least my BELOW thing compiles...
./Configure --static -static --prefix=/opt/Cross-openssl/win64 --openssldir=/opt/Cross-openssl/win64 mingw64 CC=x86_64-w64-mingw32-gcc RC=x86_64-w64-mingw32-windres AR=x86_64-w64-mingw32-ar RANLIB=x86_64-w64-mingw32-ranlib
The flags -ffunctions-sections and -fdata-sections help reduce static linking size, otherwise your binary will be like 6mb with no content of lib.
-rwxrwxrwx 1 lepus lepus 6.0M Aug 14 19:34 bunpass.exe
Consider this below to reduce by ~2mb.
./config no-ssl2 no-ssl3 no-comp no-hw no-engine no-async no-err no-ocsp no-psk no-srp no-tests no-idea no-md2 no-md4 no-mdc2 no-rc2 no-rc4 no-rc5 no-rmd160 no-whirlpool no-dso no-ec no-ecdsa no-ecdh no-sm2 no-sm3 no-sm4 no-camellia no-seed no-bf no-cast no-des no-dh no-dsa no-ssl no-tls no-aria no-chacha no-poly1305 no-siphash no-siv no-ct no-aria no-ktls no-srtp no-ssl-trace no-ssl3-method no-weak-ssl-ciphers no-ssl3 no-tls1 no-tls1_1 no-tls1_2 no-tls1_3 no-dtls no-dtls1 --static -static --prefix=/opt/Cross-openssl/win64 --openssldir=/opt/Cross-openssl/win64 mingw64 CC=x86_64-w64-mingw32-gcc RC=x86_64-w64-mingw32-windres AR=x86_64-w64-mingw32-ar RANLIB=x86_64-w64-mingw32-ranlib
make install_dev
Ref:
https://github.com/openssl/openssl/issues/9922