science/py-tensorflow: fix build with libc++ 21
With libc++ 21 science/py-tensorflow fails to build, with errors similar
to:
In file included from tensorflow/tsl/framework/allocator_registry.cc:16:
In file included from ./tensorflow/tsl/framework/allocator_registry.h:23:
In file included from ./tensorflow/tsl/framework/allocator.h:28:
./tensorflow/tsl/framework/type_traits.h:96:8: error: 'is_signed' cannot be specialized: Users are not allowed to specialize this standard library entity [-Winvalid-specialization]
96 | struct is_signed<tsl::qint8> : public is_signed<tsl::int8> {};
| ^
/usr/include/c++/v1/__type_traits/is_signed.h:25:8: note: marked '_Clang::no_specializations' here
25 | struct _LIBCPP_NO_SPECIALIZATIONS is_signed : _BoolConstant<__is_signed(_Tp)> {};
| ^
/usr/include/c++/v1/__config:1167:9: note: expanded from macro '_LIBCPP_NO_SPECIALIZATIONS'
1167 | [[_Clang::__no_specializations__("Users are not allowed to specialize this standard library entity")]]
| ^and later:
tensorflow/lite/kernels/elementwise.cc:245:14: error: no matching function for call to 'EvalImpl'
245 | return EvalImpl<float>(context, node, std::abs<float>, type);
| ^~~~~~~~~~~~~~~
tensorflow/lite/kernels/elementwise.cc:192:21: note: candidate function template not viable: no overload of 'abs' matching 'std::function<float (float)>' for 3rd argument
192 | inline TfLiteStatus EvalImpl(TfLiteContext* context, TfLiteNode* node,
| ^
193 | std::function<T(T)> func,
| ~~~~~~~~~~~~~~~~~~~~~~~~The former is fixed by https://github.com/openxla/xla/commit/0cead9f,
which unfortunately happened after tsl got split off from tensorflow
into a bunch of separate projects.
The latter is fixed as part of
https://github.com/tensorflow/tensorflow/commit/358119a, but that commit
is quite large. Only the changes to elementwise.cc need to be applied.
PR: 293384
Approved by: maintainer timeout (2 weeks)
MFH: 2026Q1