From 12426908351f6af35c3adcaaab5aca3679a9b455 Mon Sep 17 00:00:00 2001 From: jwinterm Date: Wed, 20 May 2026 16:18:09 -0400 Subject: [PATCH 1/2] Windows CI: stage monero/wownero DLLs into Release dir after build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The monero_c v0.18.4.6-RC1-2-gbc8d*a0 release bundle ships pre-built MinGW Windows DLLs at x86_64-w64-mingw32/libmonero_wallet2_api_c.dll + libwownero_wallet2_api_c.dll. cw_monero / cw_wownero load them at runtime via Dart FFI DynamicLibrary.open, so they don't need to link at flutter build windows time — but they DO need to be in the Windows DLL search path when hash_wallet.exe runs. Easiest: drop them next to the .exe in the Release dir before we zip. Copy under both naming conventions (lib_wallet2_api_c.dll and _libwallet2_api_c.dll) since the Dart-side libPath constant in package:monero may or may not include the `lib` prefix depending on build flavor. ~30 MB cost. --- .github/workflows/build-windows.yml | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index ede54b0f..bbe2ca36 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -207,6 +207,40 @@ jobs: flutter config --enable-windows-desktop flutter build windows --dart-define-from-file=env.json --release --verbose + # ---- Stage monero/wownero native DLLs next to the .exe --------------- + # cw_monero + cw_wownero use Dart FFI (DynamicLibrary.open) for runtime + # loading, so there's no link-time CMakeLists needed — but the DLLs + # have to be in the Windows DLL search path at .exe runtime. Easiest: + # drop them next to hash_wallet.exe in the Release dir. + # + # The monero_c bundle's MinGW build names them with a `lib` prefix + # (libmonero_wallet2_api_c.dll). We copy under both names because + # the Dart-side libPath constant in package:monero may or may not + # include the `lib` prefix depending on build flavor. Defensive but + # cheap — ~30 MB total. + - name: Stage monero/wownero DLLs into Release dir + run: | + set -x -e + MONERO_C_TAG=$(cd scripts/monero_c && git describe --tags) + SRC="scripts/monero_c/release/$MONERO_C_TAG/x86_64-w64-mingw32" + DST="build/windows/x64/runner/Release" + if [[ ! -d "$DST" ]]; then + echo "FATAL: $DST missing — flutter build windows step must run first" + exit 1 + fi + for coin in monero wownero; do + src_file="$SRC/lib${coin}_wallet2_api_c.dll" + if [[ ! -f "$src_file" ]]; then + echo "FATAL: $src_file not in bundle" + ls "$SRC" || true + exit 1 + fi + # Both naming conventions + cp -v "$src_file" "$DST/lib${coin}_wallet2_api_c.dll" + cp -v "$src_file" "$DST/${coin}_libwallet2_api_c.dll" + done + ls -la "$DST"/*.dll + # ---- Bundle MSVC runtime DLLs with the .exe -------------------------- # Standalone Windows builds need msvcp140.dll + vcruntime140.dll + # vcruntime140_1.dll next to the .exe (or installed via vc_redist on -- 2.50.1 (Apple Git-155) From 11c11098e1178cabda75c4ec8f8ac1c06dc6793c Mon Sep 17 00:00:00 2001 From: jwinterm Date: Wed, 20 May 2026 18:40:19 -0400 Subject: [PATCH 2/2] Windows CI: stage monero_c bundle into upstream cross-compile layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit windows/CMakeLists.txt (lines 84-94) install rules expect monero_c DLLs at the layout that scripts/windows/build_all.sh produces when cross- compiling on Linux: scripts/monero_c/release//_.dll But we use MrCyjaneK's prebuilt release bundle which lays files out as: scripts/monero_c/release///lib_wallet2_api_c.dll Restage the bundle into the cross-compile-style layout before flutter build windows runs. CMake's install() RENAMEs the staged files to the final monero_libwallet2_api_c.dll / wownero_libwallet2_api_c.dll names in the Release dir — no post-build copy needed, so the previous "Stage monero/wownero DLLs into Release dir" step is removed. Also includes libssp-0.dll + libwinpthread-1.dll (MinGW runtime DLLs the wallet libs depend on at load time), staged from the same bundle. --- .github/workflows/build-windows.yml | 88 +++++++++++++++++------------ 1 file changed, 51 insertions(+), 37 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index bbe2ca36..7d0b8ecf 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -146,10 +146,53 @@ jobs: set -x MONERO_C_TAG=$(cd scripts/monero_c && git describe --tags) BUNDLE_DIR="scripts/monero_c/release/$MONERO_C_TAG" - echo "=== windows-ish subdirs ===" - find "$BUNDLE_DIR" -maxdepth 1 -type d \( -name '*mingw*' -o -name '*windows*' -o -name '*-win-*' -o -name '*-pc-windows*' \) 2>/dev/null - echo "=== any DLL anywhere? ===" - find "$BUNDLE_DIR" -name '*.dll' 2>/dev/null | head -20 || true + echo "=== full mingw32 dir contents ===" + ls -la "$BUNDLE_DIR/x86_64-w64-mingw32" 2>/dev/null || true + + # ---- Stage monero_c DLLs into the layout windows/CMakeLists.txt expects + # Upstream Cake's Windows build cross-compiles monero_c on Linux via + # scripts/windows/build_all.sh, which lays files out as: + # scripts/monero_c/release//_.dll + # The CMakeLists.txt at windows/CMakeLists.txt:84-94 hardcodes those + # paths in install(FILES ...) rules — it copies + RENAMEs them to the + # final names (monero_libwallet2_api_c.dll etc.) in the Release dir. + # + # We're using the prebuilt bundle from MrCyjaneK's release, which has + # a different layout: + # scripts/monero_c/release///lib_wallet2_api_c.dll + # So we restage the bundle's files into the upstream-build-all-style + # layout before flutter build windows runs. + - name: Stage monero_c bundle into upstream cross-compile layout + run: | + set -x -e + MONERO_C_TAG=$(cd scripts/monero_c && git describe --tags) + SRC="scripts/monero_c/release/$MONERO_C_TAG/x86_64-w64-mingw32" + MONERO_DST="scripts/monero_c/release/monero" + WOWNERO_DST="scripts/monero_c/release/wownero" + mkdir -p "$MONERO_DST" "$WOWNERO_DST" + + # The wallet C-API DLLs, one per coin + cp -v "$SRC/libmonero_wallet2_api_c.dll" "$MONERO_DST/x86_64-w64-mingw32_libwallet2_api_c.dll" + cp -v "$SRC/libwownero_wallet2_api_c.dll" "$WOWNERO_DST/x86_64-w64-mingw32_libwallet2_api_c.dll" + + # MinGW runtime DLLs the wallet libs depend on. CMakeLists.txt + # references both under release/monero/, so single-source under + # monero/ is enough. Source file may or may not have a `lib` prefix. + for runtime in libssp-0.dll libwinpthread-1.dll; do + src="" + for candidate in "$SRC/$runtime" "$SRC/${runtime#lib}"; do + if [[ -f "$candidate" ]]; then src="$candidate"; break; fi + done + if [[ -z "$src" ]]; then + echo "FATAL: $runtime not in bundle (looked at $SRC)" + ls "$SRC" + exit 1 + fi + cp -v "$src" "$MONERO_DST/x86_64-w64-mingw32_${runtime}" + done + + echo "=== final staged layout ===" + ls -la "$MONERO_DST/" "$WOWNERO_DST/" # ---- Configure: pubspec.yaml + per-coin enablement ------------------- # Mirror of hashwallet.bat — drives tool/configure.dart with the same @@ -207,39 +250,10 @@ jobs: flutter config --enable-windows-desktop flutter build windows --dart-define-from-file=env.json --release --verbose - # ---- Stage monero/wownero native DLLs next to the .exe --------------- - # cw_monero + cw_wownero use Dart FFI (DynamicLibrary.open) for runtime - # loading, so there's no link-time CMakeLists needed — but the DLLs - # have to be in the Windows DLL search path at .exe runtime. Easiest: - # drop them next to hash_wallet.exe in the Release dir. - # - # The monero_c bundle's MinGW build names them with a `lib` prefix - # (libmonero_wallet2_api_c.dll). We copy under both names because - # the Dart-side libPath constant in package:monero may or may not - # include the `lib` prefix depending on build flavor. Defensive but - # cheap — ~30 MB total. - - name: Stage monero/wownero DLLs into Release dir - run: | - set -x -e - MONERO_C_TAG=$(cd scripts/monero_c && git describe --tags) - SRC="scripts/monero_c/release/$MONERO_C_TAG/x86_64-w64-mingw32" - DST="build/windows/x64/runner/Release" - if [[ ! -d "$DST" ]]; then - echo "FATAL: $DST missing — flutter build windows step must run first" - exit 1 - fi - for coin in monero wownero; do - src_file="$SRC/lib${coin}_wallet2_api_c.dll" - if [[ ! -f "$src_file" ]]; then - echo "FATAL: $src_file not in bundle" - ls "$SRC" || true - exit 1 - fi - # Both naming conventions - cp -v "$src_file" "$DST/lib${coin}_wallet2_api_c.dll" - cp -v "$src_file" "$DST/${coin}_libwallet2_api_c.dll" - done - ls -la "$DST"/*.dll + # NOTE: monero/wownero DLLs land in Release dir automatically via + # CMake's install(FILES ... RENAME ...) rules in windows/CMakeLists.txt + # — the staging step above puts them at the source paths CMake reads. + # No post-build copy needed. # ---- Bundle MSVC runtime DLLs with the .exe -------------------------- # Standalone Windows builds need msvcp140.dll + vcruntime140.dll + -- 2.50.1 (Apple Git-155)