]> sigrok.org Git - sigrok-util.git/commitdiff
sigrok-cross-mingw: Fix broken Windows 64bit decoding (bug #1195).
authorUwe Hermann <redacted>
Sat, 29 Sep 2018 16:55:20 +0000 (18:55 +0200)
committerUwe Hermann <redacted>
Sat, 29 Sep 2018 16:55:20 +0000 (18:55 +0200)
cross-compile/mingw/pyconfig.patch [new file with mode: 0644]
cross-compile/mingw/sigrok-cross-mingw

diff --git a/cross-compile/mingw/pyconfig.patch b/cross-compile/mingw/pyconfig.patch
new file mode 100644 (file)
index 0000000..a5ffb1c
--- /dev/null
@@ -0,0 +1,37 @@
+Fix for bug #1195.
+
+Patch taken from the MSYS2 MINGW-packages repo, filename
+0110-MINGW-translate-gcc-internal-defines-to-python-platf.patch,
+but applied to pyconfig.h instead of pyport.h.
+
+Without this, Py_ssize_t ends up being 4 on 64bit Windows (where it
+should be 8) and all kinds of weird issues happen as a result,
+including 4GB allocations for no apparent reason, and none of the
+protocol decoders working (at all).
+
+The respective Py_ssize_t related code is in pyport.h.
+
+--- pyconfig.h.orig    2018-09-29 18:06:33.625204450 +0200
++++ pyconfig.h 2018-09-29 18:34:09.165488139 +0200
+@@ -1,6 +1,21 @@
+ #ifndef Py_CONFIG_H\r
+ #define Py_CONFIG_H\r
\r
++#ifdef __MINGW32__\r
++/* Translate GCC[mingw*] platform specific defines to those\r
++ * used in python code.\r
++ */\r
++#if !defined(MS_WIN64) && defined(_WIN64)\r
++#  define MS_WIN64\r
++#endif\r
++#if !defined(MS_WIN32) && defined(_WIN32)\r
++#  define MS_WIN32\r
++#endif\r
++#if !defined(MS_WINDOWS) && defined(MS_WIN32)\r
++#  define MS_WINDOWS\r
++#endif\r
++#endif /* __MINGW32__*/\r
++\r
+ /* pyconfig.h.  NOT Generated automatically by configure.\r
\r
+ This is a manually maintained version used for the Watcom,\r
index 8330406ecd28969d8d29c8ad23df8968a4b9ec68..81b03e6390386b0d2f96ebaca9696c4540b201b9 100755 (executable)
@@ -106,6 +106,11 @@ mkdir -p $PREFIX
 $WGET http://www.sigrok.org/tmp/Python34_$TARGET.tar.gz -O $PREFIX/Python34.tar.gz
 tar xzf $PREFIX/Python34.tar.gz -C $PREFIX
 
 $WGET http://www.sigrok.org/tmp/Python34_$TARGET.tar.gz -O $PREFIX/Python34.tar.gz
 tar xzf $PREFIX/Python34.tar.gz -C $PREFIX
 
+# Fix for bug #1195.
+if [ $TARGET = "x86_64" ]; then
+       patch -p1 $PREFIX/Python34/include/pyconfig.h < ../pyconfig.patch
+fi
+
 # Create a dummy python3.pc file so that pkg-config finds Python 3.
 mkdir -p $PREFIX/lib/pkgconfig
 cat >$PREFIX/lib/pkgconfig/python3.pc <<EOF 
 # Create a dummy python3.pc file so that pkg-config finds Python 3.
 mkdir -p $PREFIX/lib/pkgconfig
 cat >$PREFIX/lib/pkgconfig/python3.pc <<EOF