Cross compiling for Windows on Linux - open-quantum-safe/openssl GitHub Wiki
Step 0: Get pre-requisites
On Ubuntu, you need to install the following packages:
sudo apt install cmake gcc libtool libssl-dev make ninja-build unzip gcc-mingw-w64 git
Then, get source code of this fork (<OPENSSL_DIR> is a directory of your choosing):
git clone --branch OQS-OpenSSL_1_1_1-stable https://github.com/open-quantum-safe/openssl.git <OPENSSL_DIR>
Step 1: Build and install liboqs
git clone --branch main https://github.com/open-quantum-safe/liboqs.git
cd liboqs
mkdir build && cd build
cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../.CMake/toolchain_windows-amd64.cmake -DOQS_DIST_BUILD=ON -DCMAKE_INSTALL_PREFIX=<OPENSSL_DIR>/oqs ..
ninja
ninja install
Note: If wine is installed, is possible to build with OQS_DIST_BUILD=OFF by setting CMAKE_CROSSCOMPILING_EMULATOR=wine.
Step 2: Build the fork
Now we follow the standard instructions for building OpenSSL. Navigate to <OPENSSL_DIR>, and:
on Ubuntu, run:
./Configure no-shared mingw64 -lm --cross-compile-prefix=x86_64-w64-mingw32- -Wl,--dynamicbase,--nxcompat -static-libgcc no-capieng
make -j