sudo apt install -y \
autoconf automake autopoint bash bison \
build-essential bzip2 flex g++ g++-multilib \
gettext git gperf intltool libffi-dev \
libgdk-pixbuf-2.0-dev libltdl-dev libssl-dev \
libtool-bin lzip make p7zip-full patch \
perl python3 python3-mako python3-pkg-resources \
ruby sed unzip wget xz-utils cmake ninja-build git wget
cd ~
git clone https://github.com/mxe/mxe.git
cd mxe
make MXE_TARGETS='x86_64-w64-mingw32.static i686-w64-mingw32.static'
echo 'export PATH="$HOME/mxe/usr/bin:$PATH"' >> ~/.bashrc source ~/.bashrc
test x86_64-w64-mingw32.static-g++ --version i686-w64-mingw32.static-g++ --version
echo '#include <iostream>
int main(){std::cout<<"Hello";}' > test.cpp
i686-w64-mingw32.static-g++ test.cpp -o test.exemake zlib MXE_TARGETS='i686-w64-mingw32.static'
make MXE_TARGETS='x86_64-w64-mingw32.static i686-w64-mingw32.static'
x64 make -j$(nproc) MXE_TARGETS='x86_64-w64-mingw32.static' cc
x32 make -j$(nproc) MXE_TARGETS='i686-w64-mingw32.static' cc
https://mxe.cc/