build failure with ICU 75.1
When compiled with ICU 72.1, release 2.13 builds. When trying to compile with ICU 75.1, the following problems arise:
creating build/temp.linux-x86_64-cpython-311
x86_64-linux-gnu-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -Werror=implicit-function-declaration -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/pyicu-2.13=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.11 -c _icu_.cpp -o build/temp.linux-x86_64-cpython-311/_icu_.o -std=c++11 -DPYICU_VER=\"2.13\" -DPYICU_ICU_MAX_VER=\"75\"
cc1plus: warning: '-Werror=' argument '-Werror=implicit-function-declaration' is not valid for C++
cc1plus: warning: '-Werror=' argument '-Werror=implicit-function-declaration' is not valid for C++
In file included from /usr/include/unicode/unistr.h:39,
from common.h:107,
from _icu_.cpp:27:
/usr/include/unicode/stringpiece.h:133:29: error: 'enable_if_t' in namespace 'std' does not name a template type
133 | typename = std::enable_if_t<
| ^~~~~~~~~~~
/usr/include/unicode/stringpiece.h:133:24: note: 'std::enable_if_t' is only available from C++14 onwards
133 | typename = std::enable_if_t<
| ^~~
/usr/include/unicode/stringpiece.h:133:40: error: expected '>' before '<' token
133 | typename = std::enable_if_t<
| ^
In file included from /usr/include/unicode/uenum.h:25,
from /usr/include/unicode/ucnv.h:52,
from common.h:108:
/usr/include/unicode/localpointer.h:561:26: error: parameter declared 'auto'
561 | template <typename Type, auto closeFunction>
| ^~~~
/usr/include/unicode/localpointer.h:573:76: error: template argument 2 is invalid
573 | explicit LocalOpenPointer(std::unique_ptr<Type, decltype(closeFunction)> &&p)
| ^
/usr/include/unicode/localpointer.h:583:78: error: template argument 2 is invalid
583 | LocalOpenPointer &operator=(std::unique_ptr<Type, decltype(closeFunction)> &&p) {
| ^
/usr/include/unicode/localpointer.h:599:59: error: template argument 2 is invalid
599 | operator std::unique_ptr<Type, decltype(closeFunction)> () && {
| ^
/usr/include/unicode/uenum.h:69:1: note: invalid template non-type parameter
69 | U_DEFINE_LOCAL_OPEN_POINTER(LocalUEnumerationPointer, UEnumeration, uenum_close);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
[...]
In file included from /usr/include/unicode/localebuilder.h:11,
from common.h:263:
/usr/include/unicode/localematcher.h:683:10: error: 'optional' in namespace 'std' does not name a template type
683 | std::optional<int32_t> getBestSuppIndex(LSR desiredLSR, LocaleLsrIterator *remainingIter, UErrorCode &errorCode) const;
| ^~~~~~~~
/usr/include/unicode/localematcher.h:683:5: note: 'std::optional' is only available from C++17 onwards
683 | std::optional<int32_t> getBestSuppIndex(LSR desiredLSR, LocaleLsrIterator *remainingIter, UErrorCode &errorCode) const;
| ^~~
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
E: pybuild pybuild:389: build: plugin distutils failed with: exit code=1: /usr/bin/python3 setup.py build
GCC is v13.2.0, and ICU compiled itself with '-std=c++17' and as seen above PyICU uses '-std=c++11' for some reason. It seems to come from setup.py as it notes ICU >= 60 needs it. But it seems ICU >= 73 (74 or 75) needs '-std=c++17'. At least patching setup.py to use it, PyICU compiles and self-tests with ICU 75.1 as well.
Edited by László Böszörményi