From b939e8779f3dacd51c1fea4d018c505e655a37b1 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Fri, 27 Feb 2026 16:27:11 +0000 Subject: [PATCH 1/3] build: win: update debian base (12->13) --- contrib/build-wine/Dockerfile | 8 +++----- contrib/build-wine/apt.sources.list | 4 ++-- contrib/freeze_containers_distro.sh | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/contrib/build-wine/Dockerfile b/contrib/build-wine/Dockerfile index 4a7022bce..7c6d96737 100644 --- a/contrib/build-wine/Dockerfile +++ b/contrib/build-wine/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:bookworm@sha256:b37bc259c67238d814516548c17ad912f26c3eed48dd9bb54893eafec8739c89 +FROM debian:trixie@sha256:13f29b6806e531c3ff3b565bb6eed73f2132506c8c9d41bb996065ca20fb27f2 # need ca-certificates before using snapshot packages RUN apt update -qq > /dev/null && apt install -qq --yes --no-install-recommends \ @@ -14,11 +14,11 @@ ENV DEBIAN_FRONTEND=noninteractive RUN dpkg --add-architecture i386 && \ apt-get update -q && \ apt-get install -qy --allow-downgrades \ + lsb-release \ wget \ gnupg2 \ dirmngr \ - python3-software-properties \ - software-properties-common \ + python3 \ git \ p7zip-full \ make \ @@ -49,8 +49,6 @@ RUN DEBIAN_CODENAME=$(lsb_release --codename --short) && \ wine-stable-i386:i386=${WINEVERSION} \ wine-stable:amd64=${WINEVERSION} \ winehq-stable:amd64=${WINEVERSION} \ - libvkd3d1:amd64=1.3~${DEBIAN_CODENAME}-1 \ - libvkd3d1:i386=1.3~${DEBIAN_CODENAME}-1 \ && \ rm -rf /var/lib/apt/lists/* && \ apt-get autoremove -y && \ diff --git a/contrib/build-wine/apt.sources.list b/contrib/build-wine/apt.sources.list index b1a8f892b..dd5bd469f 100644 --- a/contrib/build-wine/apt.sources.list +++ b/contrib/build-wine/apt.sources.list @@ -1,2 +1,2 @@ -deb https://snapshot.debian.org/archive/debian/20250530T143637Z/ bookworm main -deb-src https://snapshot.debian.org/archive/debian/20250530T143637Z/ bookworm main +deb https://snapshot.debian.org/archive/debian/20260227T144551Z/ trixie main +deb-src https://snapshot.debian.org/archive/debian/20260227T144551Z/ trixie main diff --git a/contrib/freeze_containers_distro.sh b/contrib/freeze_containers_distro.sh index cc19f7de2..bc60ae7d6 100755 --- a/contrib/freeze_containers_distro.sh +++ b/contrib/freeze_containers_distro.sh @@ -6,7 +6,7 @@ set -e DEBIAN_SNAPSHOT_BASE="https://snapshot.debian.org/archive/debian/" DEBIAN_APPIMAGE_DISTRO="bullseye" # should match build-linux/appimage Dockerfile base -DEBIAN_WINE_DISTRO="bookworm" # should match build-wine Dockerfile base +DEBIAN_WINE_DISTRO="trixie" # should match build-wine Dockerfile base DEBIAN_ANDROID_DISTRO="trixie" # should match android Dockerfile base contrib="$(dirname "$0")" From 3674232dd5b33a29c454e316e7b866a1042c30d7 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Fri, 27 Feb 2026 16:35:05 +0000 Subject: [PATCH 2/3] build: win: bump wine (10->11) --- contrib/build-wine/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/build-wine/Dockerfile b/contrib/build-wine/Dockerfile index 7c6d96737..f45f1a987 100644 --- a/contrib/build-wine/Dockerfile +++ b/contrib/build-wine/Dockerfile @@ -37,7 +37,7 @@ RUN dpkg --add-architecture i386 && \ apt-get clean RUN DEBIAN_CODENAME=$(lsb_release --codename --short) && \ - WINEVERSION="10.0.0.0~${DEBIAN_CODENAME}-1" && \ + WINEVERSION="11.0.0.0~${DEBIAN_CODENAME}-1" && \ wget -nc https://dl.winehq.org/wine-builds/winehq.key && \ echo "d965d646defe94b3dfba6d5b4406900ac6c81065428bf9d9303ad7a72ee8d1b8 winehq.key" | sha256sum -c - && \ cat winehq.key | gpg --dearmor -o /etc/apt/keyrings/winehq.gpg && \ From 31ed05c05ce30e991a194a252379554aeb45d48a Mon Sep 17 00:00:00 2001 From: SomberNight Date: Fri, 27 Feb 2026 18:36:32 +0000 Subject: [PATCH 3/3] build: win: change from win-iconv to GNU libiconv MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - (zbar requires [0] iconv) - issues [1][3] compiling win-iconv: - pre-existing issue: lots of "-Wincompatible-pointer-types" warnings when compiling zbar with win-iconv - new debian means newer GCC - new GCC changed that [2] warning type to "error" - GNU libiconv works as an alternative - drawback: win-iconv is more minimal, it uses the win32 API to do most of the work - still, is a 25+ year old GNU project with one release every ~2 years, so IMO fine [0]: https://github.com/mchehab/zbar/blob/a549566ea11eb03622bd4458a1728ffe3f589163/README-windows.md [1]: https://github.com/SomberNight/electrum/commit/cb00cb60cf9a0cb059dcac5e7acfe5186620cabe [2]: https://gcc.gnu.org/pipermail/gcc-cvs/2023-December/394351.html [3]: see snippet when compiling libzbar: ``` decoder.c: In function ‘zbar_decoder_reset’: decoder.c:116:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] 116 | memset(dcode, 0, (long)&dcode->buf_alloc - (long)dcode); | ^ decoder.c:116:48: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] 116 | memset(dcode, 0, (long)&dcode->buf_alloc - (long)dcode); | ^ CC processor/libzbar_la-win.lo /bin/bash ../libtool --tag=RC \ --mode=compile x86_64-w64-mingw32-windres -DHAVE_CONFIG_H -I. -I../include \ -I../include -o libzbar-rc.lo libzbar.rc CC processor/libzbar_la-lock.lo CC decoder/libzbar_la-qr_finder.lo CC qrcode/libzbar_la-qrdec.lo In file included from ./processor.h:26, from processor/lock.c:25: ../include/config.h:423:9: warning: "_WIN32_WINNT" redefined 423 | #define _WIN32_WINNT 0x0500 | ^~~~~~~~~~~~ In file included from /usr/share/mingw-w64/include/corecrt.h:10, from /usr/share/mingw-w64/include/crtdefs.h:10, from /usr/share/mingw-w64/include/assert.h:15, from processor/lock.c:24: /usr/share/mingw-w64/include/_mingw.h:232:9: note: this is the location of the previous definition 232 | #define _WIN32_WINNT 0xa00 | ^~~~~~~~~~~~ libtool: compile: x86_64-w64-mingw32-windres -DHAVE_CONFIG_H -I. -I../include -I../include libzbar.rc -o .libs/libzbar-rc.o CC qrcode/libzbar_la-qrdectxt.lo CC qrcode/libzbar_la-rs.lo CC qrcode/libzbar_la-isaac.lo CC qrcode/libzbar_la-bch15_5.lo CC qrcode/libzbar_la-binarize.lo CC qrcode/libzbar_la-util.lo In file included from ./image.h:26, from qrcode/binarize.c:10: ../include/config.h:423:9: warning: "_WIN32_WINNT" redefined 423 | #define _WIN32_WINNT 0x0500 | ^~~~~~~~~~~~ In file included from /usr/share/mingw-w64/include/corecrt.h:10, from /usr/share/mingw-w64/include/crtdefs.h:10, from /usr/share/mingw-w64/include/math.h:13, from qrcode/binarize.c:7: /usr/share/mingw-w64/include/_mingw.h:232:9: note: this is the location of the previous definition 232 | #define _WIN32_WINNT 0xa00 | ^~~~~~~~~~~~ CC video/libzbar_la-dshow.lo CC window/libzbar_la-win.lo In file included from ./window.h:26, from window/win.c:26: ../include/config.h:423:9: warning: "_WIN32_WINNT" redefined 423 | #define _WIN32_WINNT 0x0500 | ^~~~~~~~~~~~ In file included from /usr/share/mingw-w64/include/corecrt.h:10, from /usr/share/mingw-w64/include/crtdefs.h:10, from /usr/share/mingw-w64/include/ctype.h:9, from window/win.c:24: /usr/share/mingw-w64/include/_mingw.h:232:9: note: this is the location of the previous definition 232 | #define _WIN32_WINNT 0xa00 | ^~~~~~~~~~~~ In file included from ./processor.h:26, from processor/win.c:29: ../include/config.h:423:9: warning: "_WIN32_WINNT" redefined 423 | #define _WIN32_WINNT 0x0500 | ^~~~~~~~~~~~ In file included from /usr/share/mingw-w64/include/corecrt.h:10, from /usr/share/mingw-w64/include/crtdefs.h:10, from /usr/share/mingw-w64/include/assert.h:15, from processor/win.c:24: /usr/share/mingw-w64/include/_mingw.h:232:9: note: this is the location of the previous definition 232 | #define _WIN32_WINNT 0xa00 | ^~~~~~~~~~~~ processor/win.c: In function ‘_zbar_processor_open’: processor/win.c:282:47: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 282 | proc->display = CreateWindowEx(EXT_STYLE, (LPCTSTR)(long)wca, "ZBar", | ^ processor/win.c: In function ‘_zbar_processor_close’: processor/win.c:297:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 297 | UnregisterClass((LPCTSTR)(long)proc->state->registeredClass, 0); | ^ CC window/libzbar_la-dib.lo qrcode/qrdectxt.c: In function ‘qr_code_data_list_extract_text’: qrcode/qrdectxt.c:302:62: error: passing argument 2 of ‘iconv’ from incompatible pointer type [-Wincompatible-pointer-types] 302 | iconv(utf8_cd, &in, &inleft, &out, | ^~~ | | | char ** In file included from qrcode/qrdectxt.c:12: /usr/x86_64-w64-mingw32/include/iconv.h:43:56: note: expected ‘const char **’ but argument is of type ‘char **’ 43 | size_t iconv(iconv_t cd, WINICONV_CONST char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); qrcode/qrdectxt.c:352:71: error: passing argument 2 of ‘iconv’ from incompatible pointer type [-Wincompatible-pointer-types] 352 | err = iconv(enc_list[ei], &in, | ^~~ | | | char ** /usr/x86_64-w64-mingw32/include/iconv.h:43:56: note: expected ‘const char **’ but argument is of type ‘char **’ 43 | size_t iconv(iconv_t cd, WINICONV_CONST char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); qrcode/qrdectxt.c:374:53: error: passing argument 2 of ‘iconv’ from incompatible pointer type [-Wincompatible-pointer-types] 374 | iconv(eci_cd, &in, &inleft, &out, | ^~~ | | | char ** /usr/x86_64-w64-mingw32/include/iconv.h:43:56: note: expected ‘const char **’ but argument is of type ‘char **’ 43 | size_t iconv(iconv_t cd, WINICONV_CONST char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); make[2]: *** [Makefile:1089: qrcode/libzbar_la-qrdectxt.lo] Error 1 make[2]: *** Waiting for unfinished jobs.... make[2]: Leaving directory '/opt/wine64/drive_c/electrum/contrib/zbar/zbar' make[1]: *** [Makefile:1895: all-recursive] Error 1 make[1]: Leaving directory '/opt/wine64/drive_c/electrum/contrib/zbar' make: *** [Makefile:989: all] Error 2 🗯 ERROR: Could not build zbar 🗯 ERROR: Could not build zbar ``` --- contrib/build-wine/Dockerfile | 2 + contrib/build-wine/make_win.sh | 48 +++++++++++-------- .../patches/libiconv-fix-pointer-buf.patch | 37 ++++++++++++++ contrib/build-wine/prepare-wine.sh | 4 +- 4 files changed, 67 insertions(+), 24 deletions(-) create mode 100644 contrib/build-wine/patches/libiconv-fix-pointer-buf.patch diff --git a/contrib/build-wine/Dockerfile b/contrib/build-wine/Dockerfile index f45f1a987..de547a309 100644 --- a/contrib/build-wine/Dockerfile +++ b/contrib/build-wine/Dockerfile @@ -22,6 +22,8 @@ RUN dpkg --add-architecture i386 && \ git \ p7zip-full \ make \ + cmake \ + pkgconf \ mingw-w64 \ mingw-w64-tools \ autotools-dev \ diff --git a/contrib/build-wine/make_win.sh b/contrib/build-wine/make_win.sh index 13ee21d90..9ce285603 100755 --- a/contrib/build-wine/make_win.sh +++ b/contrib/build-wine/make_win.sh @@ -53,28 +53,34 @@ if [ -f "$DLL_TARGET_DIR/libzbar-0.dll" ]; then info "libzbar already built, skipping" else ( - # As debian bullseye doesn't provide win-iconv-mingw-w64-dev, we need to build it: - WIN_ICONV_COMMIT="9f98392dfecadffd62572e73e9aba878e03496c4" - # ^ tag "v0.0.8" - info "Building win-iconv..." - cd "$CACHEDIR" - if [ ! -d win-iconv ]; then - git clone https://github.com/win-iconv/win-iconv.git - fi - cd win-iconv - if ! $(git cat-file -e ${WIN_ICONV_COMMIT}) ; then - info "Could not find requested version $WIN_ICONV_COMMIT in local clone; fetching..." - git fetch --all - fi - git reset --hard - git clean -dfxq - git checkout "${WIN_ICONV_COMMIT}^{commit}" - - # note: "-j1" as parallel jobs lead to non-reproducibility seemingly due to ordering issues - # see https://github.com/win-iconv/win-iconv/issues/42 - CC="${GCC_TRIPLET_HOST}-gcc" make -j1 || fail "Could not build win-iconv" + # iconv is needed for zbar. see https://github.com/mchehab/zbar/blob/a549566ea11eb03622bd4458a1728ffe3f589163/README-windows.md + # (previously were using win-iconv, but changed to GNU libiconv due to compilation errors with modern gcc) + LIBICONV_VER="1.18" + download_if_not_exist "$CACHEDIR/libiconv-${LIBICONV_VER}.tar.gz" "https://ftp.gnu.org/pub/gnu/libiconv/libiconv-${LIBICONV_VER}.tar.gz" + verify_hash "$CACHEDIR/libiconv-${LIBICONV_VER}.tar.gz" "3b08f5f4f9b4eb82f151a7040bfd6fe6c6fb922efe4b1659c66ea933276965e8" + tar xf "$CACHEDIR/libiconv-${LIBICONV_VER}.tar.gz" -C "$CACHEDIR" + # ref https://github.com/msys2/MINGW-packages/blob/7f68e9f2488737bbe03888ade094eaee8021d1c5/mingw-w64-libiconv/PKGBUILD + info "Building libiconv..." + cd "$CACHEDIR/libiconv-${LIBICONV_VER}" + # Patches taken from msys2/MINGW-packages + patch -p1 < "$here/patches/libiconv-fix-pointer-buf.patch" + ./configure \ + $AUTOCONF_FLAGS \ + --prefix="/usr/${GCC_TRIPLET_HOST}" \ + --disable-static \ + --enable-shared \ + --enable-extra-encodings \ + --enable-relocatable \ + --disable-rpath \ + --enable-silent-rules \ + --enable-nls + CC="${GCC_TRIPLET_HOST}-gcc" make "-j$CPU_COUNT" || fail "Could not build libiconv" + cp -fpv "libcharset/lib/.libs/libcharset-1.dll" "$DLL_TARGET_DIR/" || fail "Could not copy the libcharset binary to DLL_TARGET_DIR" + cp -fpv "lib/.libs/libiconv-2.dll" "$DLL_TARGET_DIR/" || fail "Could not copy the libiconv binary to DLL_TARGET_DIR" # FIXME avoid using sudo - sudo make install prefix="/usr/${GCC_TRIPLET_HOST}" || fail "Could not install win-iconv" + sudo make install || fail "Could not install libiconv" + # workaround to delete files owned by root, created by "make install": + make clean ) "$CONTRIB"/make_zbar.sh || fail "Could not build zbar" fi diff --git a/contrib/build-wine/patches/libiconv-fix-pointer-buf.patch b/contrib/build-wine/patches/libiconv-fix-pointer-buf.patch new file mode 100644 index 000000000..914b87bdf --- /dev/null +++ b/contrib/build-wine/patches/libiconv-fix-pointer-buf.patch @@ -0,0 +1,37 @@ +--- a/lib/iconv.c 2018-05-03 23:18:55.997221700 -0400 ++++ b/lib/iconv.c 2018-05-03 23:26:47.611682700 -0400 +@@ -170,12 +170,12 @@ static const struct stringpool2_t string + #include "aliases2.h" + #undef S + }; + #define stringpool2 ((const char *) &stringpool2_contents) + static const struct alias sysdep_aliases[] = { +-#define S(tag,name,encoding_index) { (int)(long)&((struct stringpool2_t *)0)->stringpool_##tag, encoding_index }, ++#define S(tag,name,encoding_index) { (int)(intptr_t)&((struct stringpool2_t *)0)->stringpool_##tag, encoding_index }, + #include "aliases2.h" + #undef S + }; + #ifdef __GNUC__ + __inline + #else +--- a/lib/genaliases.c 2023-01-14 00:00:00.000000000 +0000 ++++ b/lib/genaliases.c 2023-01-14 10:18:00.000000000 +0000 +@@ -50,7 +50,7 @@ + putc(c, out2); + } + } +- fprintf(out2,"\")' tmp.h | sed -e 's|^.*\\(stringpool_str[0-9]*\\).*$| (int)(long)\\&((struct stringpool_t *)0)->\\1,|'\n"); ++ fprintf(out2,"\")' tmp.h | sed -e 's|^.*\\(stringpool_str[0-9]*\\).*$| (int)(intptr_t)\\&((struct stringpool_t *)0)->\\1,|'\n"); + for (; n > 0; names++, n--) + emit_alias(out1, *names, c_name); + } +--- a/lib/genaliases2.c 2023-01-14 00:00:00.000000000 +0000 ++++ b/lib/genaliases2.c 2023-01-14 10:18:00.000000000 +0000 +@@ -44,6 +44,6 @@ + static void emit_encoding (FILE* out1, FILE* out2, const char* tag, const char* const* names, size_t n, const char* c_name) + { +- fprintf(out2," (int)(long)&((struct stringpool2_t *)0)->stringpool_%s_%u,\n",tag,counter); ++ fprintf(out2," (int)(intptr_t)&((struct stringpool2_t *)0)->stringpool_%s_%u,\n",tag,counter); + for (; n > 0; names++, n--) + emit_alias(out1, tag, *names, c_name); + } diff --git a/contrib/build-wine/prepare-wine.sh b/contrib/build-wine/prepare-wine.sh index f9553f7e5..5d5328e56 100755 --- a/contrib/build-wine/prepare-wine.sh +++ b/contrib/build-wine/prepare-wine.sh @@ -53,9 +53,7 @@ $WINE_PYTHON -m pip install --no-build-isolation --no-dependencies --no-binary : # copy already built DLLs -cp "$DLL_TARGET_DIR"/libsecp256k1-*.dll $WINEPREFIX/drive_c/electrum/electrum/ || fail "Could not copy libsecp to its destination" -cp "$DLL_TARGET_DIR/libzbar-0.dll" $WINEPREFIX/drive_c/electrum/electrum/ || fail "Could not copy libzbar to its destination" -cp "$DLL_TARGET_DIR/libusb-1.0.dll" $WINEPREFIX/drive_c/electrum/electrum/ || fail "Could not copy libusb to its destination" +cp "$DLL_TARGET_DIR"/*.dll "$WINEPREFIX/drive_c/electrum/electrum/" || fail "Could not copy DLLs to destination" info "Building PyInstaller."