Skip to content

Instantly share code, notes, and snippets.

@udnaan
Last active April 5, 2024 12:02
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save udnaan/80c5ad125fc4702309b9 to your computer and use it in GitHub Desktop.
Save udnaan/80c5ad125fc4702309b9 to your computer and use it in GitHub Desktop.
How to cross compile Openssl 1.1.0 for Windows Host on Ubuntu 14.04 LTS

Install mingw tools on linux:

sudo apt-get install mingw-w64

clone openssl repo:

git clone https://github.com/openssl/openssl.git

Configure openssl for cross compile:

./Configure --cross-compile-prefix=x86_64-w64-mingw32- mingw64

make

@DaniAffCH
Copy link

DaniAffCH commented Sep 29, 2020

How should i use -lcrypto linker with x86_64-w64-mingw32-g++ compiler?

@udnaan
Copy link
Author

udnaan commented Sep 29, 2020

@DaniAffCH
Once the compile is done and there are no errors, , do a make install. The resulting files should be in /usr/lib/x86_64-w64-mingw32
Afterwards, the compiler should be able to use the libs and include files by default.
Use -L/usr/lib/x86_64-w64-mingw32 if you are getting linker errors though it might indicate a faulty installation.

@c---
Copy link

c--- commented Jun 26, 2021

Note if you want 32-bit binaries you need to set the target to mingw and change to the i686 compiler. In other words: ./Configure --cross-compile-prefix=i686-w64-mingw32- mingw

@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