On sparc64 I ran into a weird build error.

../numpy/_core/src/umath/string_buffer.h:40:45: error: macro "getchar" passed 2 
arguments, but takes just 0
 getchar(const unsigned char *buf, int *bytes);
                                             ^
../numpy/_core/src/umath/string_buffer.h:40:1: error: 'template<ENCODING enc> 
npy_ucs4 getchar' redeclared as different kind of symbol
 getchar(const unsigned char *buf, int *bytes);
 ^~~~~~~

Unusure how best to fix that. Since getchar is an internal symbol, the
below patch is one option. Not sure if there are better ideas. jca?

These are the test reslts on sparc64, look normal as well.

= 78 failed, 43023 passed, 1062 skipped, 2789 deselected, 59 xfailed, 4 
xpassed, 11 warnings in 1452.88s (0:24:12) =

Index: patches/patch-numpy__core_src_umath_string_buffer_h
===================================================================
RCS file: patches/patch-numpy__core_src_umath_string_buffer_h
diff -N patches/patch-numpy__core_src_umath_string_buffer_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-numpy__core_src_umath_string_buffer_h 8 May 2025 13:53:44 
-0000
@@ -0,0 +1,22 @@
+Fix build with ports-gcc:
+
+../numpy/_core/src/umath/string_buffer.h:40:45: error: macro "getchar" passed 
2 arguments, but takes just 0
+ getchar(const unsigned char *buf, int *bytes);
+                                             ^
+../numpy/_core/src/umath/string_buffer.h:40:1: error: 'template<ENCODING enc> 
npy_ucs4 getchar' redeclared as different kind of symbol
+ getchar(const unsigned char *buf, int *bytes);
+ ^~~~~~~
+
+Index: numpy/_core/src/umath/string_buffer.h
+--- numpy/_core/src/umath/string_buffer.h.orig
++++ numpy/_core/src/umath/string_buffer.h
+@@ -5,6 +5,9 @@
+ #include <cstddef>
+ #include <wchar.h>
+ 
++#undef getchar
++#define getchar numpy_getchar
++
+ #define NPY_NO_DEPRECATED_API NPY_API_VERSION
+ #define _MULTIARRAYMODULE
+ #define _UMATHMODULE

Reply via email to