Hush lite wallet https://faq.hush.is/sdl
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

119 lines
5.3 KiB

# Crosscompile for Windows (only tested for Debian Bullseye 11)
Last updated on October 31, 2021 - happy halloween!!!
We are testing with Qt 5.15.2 and we'll see...
## build dependencies
```
sudo apt install -y clang g++ build-essential make mingw-w64 git pkg-config libc6-dev m4 g++-multilib autoconf libncurses-dev libtool-bin unzip python2 python3-zmq zlib1g-dev wget curl bsdmainutils automake libgl1-mesa-dev libglu1-mesa-dev libfontconfig1-dev autopoint libssl-dev
sudo apt-get install qtbase5-dev qt5-qmake libqt5websockets5-dev qtcreator
```
### MXE dependencies
Below we have the list I tested with, but you can also cross reference the [upstream requirements documentation](https://mxe.cc/#requirements) for the latest list.
```
sudo apt install -y bash bison bzip2 flex gettext gperf intltool libc6-dev-i386 libgdk-pixbuf2.0-dev libltdl-dev libtool-bin libxml-parser-perl lzip make openssl p7zip-full patch perl pkg-config python ruby sed unzip xz-utils
```
### and yet even more dependencies...
```
apt-get -y update && \
apt-get install -y libdbus-1-3 libexpat1 \
libgl1-mesa-dev libglu1-mesa-dev libfontconfig1-dev libssl-dev \
libfreetype6 libgl1-mesa-glx libglib2.0-0 libx11-6 libx11-xcb1 \
cmake clang++-6.0 software-properties-common gperf libtool \
libgdk-pixbuf2.0-dev libltdl-dev
# needed for QT 5.15.x
sudo apt install -y libxcb-sync-dev libxcb-xinerama0-dev
```
## Compile OpenSSL
QT 5.15.2 has a [known issue list](https://wiki.qt.io/Qt_5.15.2_Known_Issues)
that currently lists that OpenSSL version 1.1.1 be used
```
# Download openssl 1.1.1 from https://openssl.org/source/
wget https://www.openssl.org/source/openssl-1.1.1.tar.gz
tar zxvpf openssl-1.1.1.tar.gz
cd openssl-1.1.1
./config
make -j$(nproc)
```
### Integrate libsodium for mingw
Compilation keeps bailing stating that it doesn't have libsodium, so now to set this up...
```
wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable-mingw.tar.gz
tar zxvpf libsodium-1.0.18-stable-mingw.tar.gz
```
This will be the SODIUM_STATIC path further down.
## Static build of Qt5
### Download Qt5 sources
```
mkdir -p ~/Qt/5.15.2
cd ~/Qt/5.15.2
wget https://download.qt.io/archive/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz
tar xvpf qt-everywhere-src-5.15.2.tar.xz
cd qt-everywhere-src-5.15.2
```
### Configure and build Qt5 statically.
```
# trying to get libsodium not failing...
## OPENSSL_LIBS='-L/PATH/TO/openssl-1.1.1 -lssl -lcrypto' ./configure -static -prefix ~/Qt/5.15.2/static -skip qtlocation -skip qtmacextras -skip qtpurchasing -skip qtscript -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtdatavis3d -skip qtdoc -skip qtcharts -skip qtdeclarative -skip qt3d -skip qtwebengine -skip qtandroidextras -skip qtwebview -skip qtgamepad -skip qtquickcontrols -skip qtquickcontrols2 -skip qtremoteobjects -skip qtwebview -skip qtwebchannel -skip qtwebglplugin -nomake examples -nomake tests -qt-zlib -qt-libpng -feature-fontconfig -no-feature-getentropy -release -openssl-linked -opensource
OPENSSL_LIBS='-L/PATH/TO/openssl-1.1.1 SODIUM_STATIC=-L/PATH/TO/libsodium-win64/lib -lssl -lcrypto -lsodium' ./configure -static -prefix ~/Qt/5.15.2/static -skip qtlocation -skip qtmacextras -skip qtpurchasing -skip qtscript -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtdatavis3d -skip qtdoc -skip qtcharts -skip qtdeclarative -skip qt3d -skip qtwebengine -skip qtandroidextras -skip qtwebview -skip qtgamepad -skip qtquickcontrols -skip qtquickcontrols2 -skip qtremoteobjects -skip qtwebview -skip qtwebchannel -skip qtwebglplugin -nomake examples -nomake tests -qt-zlib -qt-libpng -feature-fontconfig -no-feature-getentropy -release -openssl-linked -opensource
gmake -j$(nproc)
gmake -j$(nproc) install
```
My own Random Notes I came across while figuring this all out for this newer version of QT...
- had error re: -qt-xcb flag and found [this write](https://forum.qt.io/topic/115827/build-on-linux-qt-xcb-option/18) explaining what to add in there
- had error re: -qt-xkbcommon flag and [found this](https://forum.qt.io/post/677389) re "It seems that -qt-xcb option was removed from 5.12.1 onward?"
- now I get [this error](https://github.com/microsoft/vcpkg/issues/15150)
- possible solution to install certain packages, which configure and (g)make now all work when we identify their names on Debian [libxcb-sync-dev libxcb-xinerama0-dev]
## Build MXE (Cross-compiled Qt5 for Windows in Linux)
```
mkdir ~/git
cd ~/git
git clone https://github.com/mxe/mxe.git
cd mxe
make -j$(nproc) MXE_TARGETS=x86_64-w64-mingw32.static qtbase qtwebsockets
```
## Build SilentDragonLite .exe
```
git clone https://git.hush.is/hush/SilentDragonLite
cd SilentDragonLite
# I'm using rust 1.56.0 from rustup, so not running this command
# if you have newer rustc, then stick with that
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.49.0 -y
# if not already in your .bashrc...
echo 'source $HOME/.cargo/env' >> $HOME/.bashrc
# add win64 to rust
~/.cargo/bin/rustup target add x86_64-pc-windows-gnu
echo "[target.x86_64-pc-windows-gnu]" >> ~/.cargo/config
echo "linker = 'x86_64-w64-mingw32.static-gcc'" >> ~/.cargo/config
MXE_PATH="/home/your_username/git/mxe/usr/bin" QT_STATIC="/home/your_username/Qt/5.15.2/static" \
APP_VERSION="1.5.2" PREV_VERSION="1.5.0" ./src/scripts/win-mkrelease-only.sh
```