From 7371eb703e2f12cadf9e4bb026cf50583914311f Mon Sep 17 00:00:00 2001 From: root Date: Fri, 1 May 2026 23:08:37 +0000 Subject: [PATCH] Harden Windows cross-builds --- contrib/agrarian-build-menu.sh | 3 ++- contrib/build-win64-wallet.sh | 24 ++++++++++++++---------- depends/packages/qt.mk | 6 ++++++ 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/contrib/agrarian-build-menu.sh b/contrib/agrarian-build-menu.sh index aea9a13c..b561acf1 100755 --- a/contrib/agrarian-build-menu.sh +++ b/contrib/agrarian-build-menu.sh @@ -332,7 +332,7 @@ ensure_posix_mingw() { build_windows_daemon() { ensure_posix_mingw - run_step 45 "Building Windows daemon depends" make -C depends HOST="$HOST_WIN64" NO_QT=1 -j"$JOBS" + run_step 45 "Building Windows daemon depends" make -C depends HOST="$HOST_WIN64" NO_QT=1 -j1 if [[ ! -f configure || ! -f src/secp256k1/configure || ! -f src/secp256k1/Makefile.in ]]; then run_step 60 "Generating configure script" ./autogen.sh @@ -347,6 +347,7 @@ build_windows_daemon() { --disable-zmq \ --with-miniupnpc=no + run_step 82 "Cleaning stale target objects" make clean run_step 90 "Compiling Windows daemon and CLI tools" make -j"$JOBS" } diff --git a/contrib/build-win64-wallet.sh b/contrib/build-win64-wallet.sh index 72ab037f..3bfed4bc 100755 --- a/contrib/build-win64-wallet.sh +++ b/contrib/build-win64-wallet.sh @@ -68,18 +68,15 @@ build_native_protoc() { ensure_native_tools() { mkdir -p "$NATIVE_BIN" - for tool in moc uic rcc; do + for tool in moc uic rcc lrelease; do if [[ ! -x "$NATIVE_BIN/$tool" ]]; then copy_first_match "$tool" fi done - for tool in lrelease lupdate; do - if [[ ! -x "$NATIVE_BIN/$tool" ]]; then - require_cmd "$tool" - cp "$(command -v "$tool")" "$NATIVE_BIN/$tool" - fi - done + if [[ ! -x "$NATIVE_BIN/lupdate" ]] && command -v lupdate >/dev/null 2>&1; then + cp "$(command -v lupdate)" "$NATIVE_BIN/lupdate" + fi if [[ ! -x "$NATIVE_BIN/protoc" ]] || ! "$NATIVE_BIN/protoc" --version | grep -q "libprotoc $PROTOBUF_VERSION"; then build_native_protoc @@ -99,7 +96,10 @@ ensure_posix_mingw echo "Building Win64 depends for $HOST..." echo "Building native Qt6 host tools and metadata for $BUILD_HOST..." -make -C depends HOST="$BUILD_HOST" NO_QT=0 qt -j"$JOBS" +# Keep the top-level depends scheduler serial. Individual package build +# systems still use parallelism, but parallel package configure steps race on +# the shared depends prefix and can make Qt see missing zlib/OpenSSL paths. +make -C depends HOST="$BUILD_HOST" NO_QT=0 qt -j1 qt_host_cache=( "$ROOT/depends/built/$BUILD_HOST/qt"/qt-*.tar.gz ) if [[ ${#qt_host_cache[@]} -ne 1 || ! -f "${qt_host_cache[0]}" ]]; then echo "Could not locate a single native Qt6 cache archive for $BUILD_HOST" >&2 @@ -107,7 +107,7 @@ if [[ ${#qt_host_cache[@]} -ne 1 || ! -f "${qt_host_cache[0]}" ]]; then fi mkdir -p "$ROOT/depends/$BUILD_HOST" tar --no-same-owner -xf "${qt_host_cache[0]}" -C "$ROOT/depends/$BUILD_HOST" -make -C depends HOST="$HOST" NO_QT=0 -j"$JOBS" +make -C depends HOST="$HOST" NO_QT=0 -j1 require_path "$PREFIX/share/config.site" ensure_native_tools @@ -130,7 +130,11 @@ CONFIG_SITE="$PREFIX/share/config.site" ./configure \ --with-qt-libdir="$PREFIX/lib" \ --with-qt-plugindir="$PREFIX/plugins" \ --with-qt-translationdir="$PREFIX/translations" \ - --with-qt-bindir="$NATIVE_BIN" + --with-qt-bindir="$NATIVE_BIN" \ + --with-protoc-bindir="$NATIVE_BIN" + +echo "Cleaning stale target objects before compiling..." +make clean echo "Building Win64 Qt6 wallet with JOBS=$JOBS..." make -j"$JOBS" diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk index 75576ac8..09987510 100644 --- a/depends/packages/qt.mk +++ b/depends/packages/qt.mk @@ -104,6 +104,11 @@ define $(package)_build_cmds cmake --build . --parallel endef +ifeq ($(host_os),mingw32) +define $(package)_stage_cmds + DESTDIR=$($(package)_staging_dir) cmake --install . +endef +else define $(package)_stage_cmds DESTDIR=$($(package)_staging_dir) cmake --install . && \ mkdir -p ../qttools-build && \ @@ -119,6 +124,7 @@ define $(package)_stage_cmds mkdir -p $($(package)_staging_prefix_dir)/libexec && \ cp ../qttools-build/bin/lrelease $($(package)_staging_prefix_dir)/libexec/lrelease endef +endif define $(package)_postprocess_cmds rm -rf share/doc share/examples share/qt6/sbom && \