[Bug 293384] science/py-tensorflow: fix build with libc++ 21

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 23 Feb 2026 13:17:44 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293384

            Bug ID: 293384
           Summary: science/py-tensorflow: fix build with libc++ 21
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: dim@FreeBSD.org
                CC: amzo1337@gmail.com
                CC: amzo1337@gmail.com
             Flags: maintainer-feedback?(amzo1337@gmail.com)

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.