Skip to content

Commit

Permalink
qt: upgrade to Qt 6.8.2
Browse files Browse the repository at this point in the history
Reason: Moonpay widget login says "you can't perform this action",
fixed by a newer Chromium Version. Qt 6.5 was not new enough, but Qt
6.8 is.

This bumps the min requirements for Ubuntu from 20.04 to 22.04, and
for macOS from 10.14 to 12:

https://doc.qt.io/qt-6/supported-platforms.html

Various changes were needed:
- macos bumped to 14, required for building as per the above link
- the webclass being in a different worker thread caused a
  SIGTRAP. Since our backend calls are anyway launched in
  goroutines (a change done after moving webclass to a thread), we
  can keep this in the main thread as dispatching the call is low overhead.
- qwebchannel.js update is taken from
  https://raw.githubusercontent.com/qt/qtwebchannel/refs/tags/v6.8.2/examples/webchannel/shared/qwebchannel.js.
  The only local modification is to `export const QWebChannel` and drop
  the manual export like in 407bb24
- libxcb-cursor0 is newly required on linux
- on linux, v8_context_snapshot.bin is manually copied to the target
  as linuxdeployqt has not been fixed yet to do it automatically,
  required for QtWebEngine to launch
  • Loading branch information
benma committed Feb 27, 2025
1 parent cd04bb3 commit a20c26d
Show file tree
Hide file tree
Showing 11 changed files with 148 additions and 119 deletions.
2 changes: 1 addition & 1 deletion .containerversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
27
28
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:
name: BitBoxApp-linux-${{github.sha}}.rpm
if-no-files-found: error
macos:
runs-on: macos-13
runs-on: macos-14
outputs:
artifact-url: ${{ steps.upload.outputs.artifact-url }}
steps:
Expand All @@ -151,9 +151,9 @@ jobs:
# qtwebengine is for rendering the frontend.
run: |
pip install aqtinstall
aqt install-qt mac desktop 6.2.4 --modules qtpositioning qtserialport qtwebchannel qtwebengine --outputdir ~/Qt
echo "$HOME/Qt/6.2.4/macos/bin" >> $GITHUB_PATH
echo "$HOME/Qt/6.2.4/macos/libexec" >> $GITHUB_PATH
aqt install-qt mac desktop 6.8.2 --modules qtpositioning qtserialport qtwebchannel qtwebengine --outputdir ~/Qt
echo "$HOME/Qt/6.8.2/macos/bin" >> $GITHUB_PATH
echo "$HOME/Qt/6.8.2/macos/libexec" >> $GITHUB_PATH
- name: Build macOS app
run: >
./scripts/github-ci.sh qt-osx;
Expand Down Expand Up @@ -202,7 +202,7 @@ jobs:
make gomobileinit
(cd $GOPATH/$GO_SRC_DIR; make ios)
windows:
runs-on: windows-2019
runs-on: windows-2022
outputs:
artifact-url: ${{ steps.upload.outputs.artifact-url }}
defaults:
Expand All @@ -227,16 +227,16 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: '6.2'
version: '6.8.2'
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2019_64'
arch: 'win64_msvc2022_64'
modules: 'qtwebengine qtwebchannel qtpositioning'
- name: Link Visual Studio editions
# This is needed due to our build expecting the Community edition, but Enterprise being pre-installed
shell: cmd
run: |
mklink /J "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community" "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise"
mklink /J "C:\Program Files\Microsoft Visual Studio\2022\Community" "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
- name: Build Windows app
run: |
make qt-windows
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
FROM thyrlian/android-sdk:4.0 as android

FROM ubuntu:20.04
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND noninteractive

Expand All @@ -30,6 +30,6 @@ ENV PATH $GOROOT/bin:$GOPATH/bin:$PATH
ADD Makefile /tmp/
RUN make -C /tmp/ envinit

ENV PATH /opt/qt6/6.2.4/gcc_64/bin:/opt/qt6/6.2.4/gcc_64/libexec:$PATH
ENV PATH /opt/qt6/6.8.2/gcc_64/bin:/opt/qt6/6.8.2/gcc_64/libexec:$PATH

CMD ["bash"]
4 changes: 2 additions & 2 deletions docs/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ platforms should be viable for development, building, and use of the BitBox
Wallet application.

* Debian: 11 bullseye or newer
* Ubuntu: 20.04+
* Ubuntu: 22.04+
* Fedora: 36+
* MacOS: 10.15+
* MacOS: 12+
* Windows: Windows 10+

## Debian, Ubuntu, and Fedora GNU/Linux with Docker
Expand Down
2 changes: 1 addition & 1 deletion frontends/qt/BitBox.pro
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ win32 {
#QMAKE_LFLAGS += -Wl,--nxcompat
#QMAKE_LFLAGS += -Wl,--dynamicbase
} else {
QMAKE_CXXFLAGS += -std=c++11
QMAKE_CXXFLAGS += -std=c++17
LIBS += -L$$PWD/server -lserver
QMAKE_CXXFLAGS += $$CFORTIFY
QMAKE_CXXFLAGS += $$CSTACK
Expand Down
6 changes: 5 additions & 1 deletion frontends/qt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ linux:
# Add Wayland libs so the app can run natively on Wayland too.
# The linuxdeployqt maintainer unfortunately refuses to support it automatically: https://github.com/probonopd/linuxdeployqt/issues/189
# The list of related plugins was found by: `find $(qmake -query QT_INSTALL_PLUGINS) | grep wayland`
-extra-plugins=platforms/libqwayland-generic.so,platforms/libqwayland-egl.so,wayland-graphics-integration-client,wayland-decoration-client,wayland-shell-integration
-extra-plugins=platforms/libqwayland-generic.so,platforms/libqwayland-egl.so,wayland-graphics-integration-client,wayland-decoration-client,wayland-shell-integration,*.debug> \
-no-strip
cp /usr/lib/x86_64-linux-gnu/nss/* build/linux-tmp/lib
# See https://github.com/probonopd/linuxdeployqt/issues/554#issuecomment-1761834180
cp "$(shell qmake -query QT_INSTALL_DATA)/resources/v8_context_snapshot.bin" build/linux-tmp/resources
cp -aR resources/linux build/tmp-deb
cp resources/linux/usr/share/applications/bitbox.desktop build/linux-tmp
cp resources/linux/usr/share/icons/hicolor/128x128/apps/bitbox.png build/linux-tmp
Expand All @@ -59,6 +62,7 @@ osx:
mkdir build/osx
mv build/BitBox.app build/osx/
cp resources/MacOS/Info.plist build/osx/BitBox.app/Contents/
mkdir -p build/osx/BitBox.app/Contents/Resources
cp resources/MacOS/icon.icns build/osx/BitBox.app/Contents/Resources/
cd build/osx/ && macdeployqt BitBox.app
cp server/libserver.so build/osx/BitBox.app/Contents/Frameworks
Expand Down
19 changes: 10 additions & 9 deletions frontends/qt/compile_windows.bat
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
:: Compiles the Qt app. Part of `make windows`, which also compiles/bundles the deps

call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
cd build
qmake ..\BitBox.pro
nmake
COPY "%VCToolsRedistDir%\x64\Microsoft.VC142.CRT\msvcp140.dll" windows\
COPY "%VCToolsRedistDir%\x64\Microsoft.VC142.CRT\msvcp140_1.dll" windows\
COPY "%VCToolsRedistDir%\x64\Microsoft.VC142.CRT\msvcp140_2.dll" windows\
COPY "%VCToolsRedistDir%\x64\Microsoft.VC142.CRT\msvcp140_atomic_wait.dll" windows\
COPY "%VCToolsRedistDir%\x64\Microsoft.VC142.CRT\msvcp140_codecvt_ids.dll" windows\
COPY "%VCToolsRedistDir%\x64\Microsoft.VC142.CRT\vccorlib140.dll" windows\
COPY "%VCToolsRedistDir%\x64\Microsoft.VC142.CRT\vcruntime140.dll" windows\
COPY "%VCToolsRedistDir%\x64\Microsoft.VC142.CRT\vcruntime140_1.dll" windows\
dir "%VCToolsRedistDir%\x64\
COPY "%VCToolsRedistDir%\x64\Microsoft.VC143.CRT\msvcp140.dll" windows\
COPY "%VCToolsRedistDir%\x64\Microsoft.VC143.CRT\msvcp140_1.dll" windows\
COPY "%VCToolsRedistDir%\x64\Microsoft.VC143.CRT\msvcp140_2.dll" windows\
COPY "%VCToolsRedistDir%\x64\Microsoft.VC143.CRT\msvcp140_atomic_wait.dll" windows\
COPY "%VCToolsRedistDir%\x64\Microsoft.VC143.CRT\msvcp140_codecvt_ids.dll" windows\
COPY "%VCToolsRedistDir%\x64\Microsoft.VC143.CRT\vccorlib140.dll" windows\
COPY "%VCToolsRedistDir%\x64\Microsoft.VC143.CRT\vcruntime140.dll" windows\
COPY "%VCToolsRedistDir%\x64\Microsoft.VC143.CRT\vcruntime140_1.dll" windows\
6 changes: 0 additions & 6 deletions frontends/qt/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,7 @@ int main(int argc, char *argv[])
preferredLocale = uiLangs.first();
}

QThread workerThread;
webClass = new WebClass();
// Run client queries in a separate thread to not block the UI.
webClass->moveToThread(&workerThread);
workerThread.start();

serve(
// cppHeapFree
Expand Down Expand Up @@ -480,8 +476,6 @@ int main(int argc, char *argv[])
delete view;
view = nullptr;
webClassMutex.unlock();
workerThread.quit();
workerThread.wait();
});

#if defined(_WIN32)
Expand Down
1 change: 1 addition & 0 deletions frontends/web/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"plugin:react/recommended",
"plugin:react-hooks/recommended"
],
"ignorePatterns": ["src/utils/qwebchannel.js"],
"settings": {
"react": {
"version": "detect"
Expand Down
Loading

0 comments on commit a20c26d

Please sign in to comment.