Skip to content

Instantly share code, notes, and snippets.

@artynet
Last active September 16, 2022 08:32
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save artynet/ee042155c93fc110e9422b5d458d9c6b to your computer and use it in GitHub Desktop.
Save artynet/ee042155c93fc110e9422b5d458d9c6b to your computer and use it in GitHub Desktop.
Cross compile OpenSSL for mingw32-w64
#!/bin/bash
WORKSPACE=/home/arturo/Programmi/win32-cross
sed -i 's/:.dll.a/ -Wl,--export-all -shared:.dll.a/g' Configure
sed -i 's,.*target already defined.*,$target=$_;,g' Configure
./Configure mingw shared --cross-compile-prefix=i686-w64-mingw32- --prefix=${WORKSPACE}
# ./Configure mingw shared --cross-compile-prefix=x86_64-w64-mingw32- --prefix=${WORKSPACE}
make -j2
make -j2 install
cp *.dll ${WORKSPACE}/lib/
cd ${WORKSPACE}/include
# Fix compile bug in OpenSSL
sed -i '/# define HEADER_X509V3_H/a \\n#ifdef X509_NAME\n#undef X509_NAME\n#endif' openssl/x509v3.h
@darklukee
Copy link

darklukee commented Oct 9, 2020

Thank you for that!

For x86_64 you need to Configure for mingw64 though :)
I didn't need any seds for compilation to work for openssl-1.1.1h

@derunix
Copy link

derunix commented Sep 16, 2022

./Configure mingw shared --cross-compile-prefix=x86_64-w64-mingw32- --prefix=${WORKSPACE}
worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment