Bug 284159 - math/linbox: fix build with clang 19
Summary: math/linbox: fix build with clang 19
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Dimitry Andric
URL:
Keywords:
Depends on:
Blocks: 280562
  Show dependency treegraph
 
Reported: 2025-01-19 13:56 UTC by Dimitry Andric
Modified: 2025-01-19 20:25 UTC (History)
0 users

See Also:
thierry: maintainer-feedback+


Attachments
math/linbox: fix build with clang 19 (4.35 KB, patch)
2025-01-19 13:57 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2025-01-19 13:56:53 UTC
Clang 19 has become more strict about errors in member functions, which
results in errors building math/linbox:

  ../../linbox/vector/blas-subvector.h:121:20: error: no member named 'data' in 'BlasSubvector<_Vector>'
    121 |             _ptr(V.data()+beg), _size(dim), _inc(inc), _field(&V.field()) {}
        |                  ~ ^
  ../../linbox/matrix/sparsematrix/sparse-ell-matrix.h:1216:16: error: cannot assign to non-static data member '_ld' with const-qualified type 'const size_t &' (aka 'const unsigned long &')
   1216 |                                 _ld        = iter._ld ;
        |                                 ~~~        ^
  ../../linbox/matrix/sparsematrix/sparse-ellr-matrix.h:1108:12: error: no viable overloaded '='
   1108 |                                 _rowid = iter._rowid;
        |                                 ~~~~~~ ^ ~~~~~~~~~~~

In all these cases, the methods where the errors occur are not actually
used, so until upstream sorts out their incorrect code, stub them out
using #if 0/#endif pairs.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2025-01-19 13:57:23 UTC
Created attachment 256800 [details]
math/linbox: fix build with clang 19
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2025-01-19 14:42:54 UTC
Continuing the discussion of https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280562#c200 here:

I had already installed doxygen, gsed, and coreutils, but it doesn't make a difference. As I said, the problem is that the configure script is broken, when `--with-gnuplot` is passed: it appends the string " yes" to $PATH, which breaks the last entry in the list. If that happens to be /usr/bin, tools like grep, sed etc cannot be found.
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2025-01-19 15:34:20 UTC
FWIW https://github.com/linbox-team/linbox main builds fine for me with clang 19, after I applied a fix for one of the givaro headers:

--- /usr/local/include/givaro/random-integer.h.orig     2025-01-05 23:06:34.000000000 +0100
+++ /usr/local/include/givaro/random-integer.h  2025-01-19 16:30:01.045980000 +0100
@@ -11,10 +11,12 @@

 #include "gmp++/gmp++.h"

+#if __cpp_lib_bool_constant < 201505L
 namespace std {
     template <bool B>
     using bool_constant = integral_constant<bool, B>;
 }
+#endif

 namespace Givaro
 {

I'll submit that as a separate bug.
Comment 4 Dimitry Andric freebsd_committer freebsd_triage 2025-01-19 16:01:06 UTC
See bug 284167 for math/givaro.
Comment 5 Thierry Thomas freebsd_committer freebsd_triage 2025-01-19 18:24:15 UTC
Approved, many thanks Dimitry! Please commit.

(`make test' reveals another error:

In file included from test-opencl-domain.C:37:
In file included from ../linbox/matrix/matrix-domain.h:74:
../linbox/matrix/matrixdomain/opencl-domain.h:212:11: error: reference to type 'const Element' (aka 'const float') could not bind to an rvalue of type 'void'
  212 |                         return _Mat->setEntry(_r0 + i, _c0 + j, a_ij);
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../linbox/matrix/matrixdomain/opencl-domain-memory.inl:209:13: note: in instantiation of member function 'LinBox::SubmatrixAdapter<LinBox::BlasMatrix<Givaro::Modular<float>, std::vector<float>>>::setEntry' requested here
  209 |                                         matrix.setEntry((size_t)row, (size_t)col, depaddingBuffer[depaddingBufferPosition]);
      |                                                ^
../linbox/matrix/matrixdomain/opencl-domain-memory.inl:315:10: note: in instantiation of function template specialization 'LinBox::OpenCLMatrixDomain<Givaro::Modular<float>>::oclDepadMatrix<float, LinBox::SubmatrixAdapter<LinBox::BlasMatrix<Givaro::Modular<float>, std::vector<float>>>>' requested here
  315 |                 return oclDepadMatrix<T, Operand2>(
      |                        ^
../linbox/matrix/matrixdomain/opencl-domain.inl:418:10: note: in instantiation of function template specialization 'LinBox::OpenCLMatrixDomain<Givaro::Modular<float>>::oclReadMatrixBuffer<float, LinBox::SubmatrixAdapter<LinBox::BlasMatrix<Givaro::Modular<float>, std::vector<float>>>>' requested here
  418 |                                 SC = oclReadMatrixBuffer<cl_float,SubmatrixAdapter<Operand1> >(
      |                                      ^
test-opencl-domain.C:138:7: note: in instantiation of function template specialization 'LinBox::OpenCLMatrixDomain<Givaro::Modular<float>>::mul<LinBox::BlasMatrix<Givaro::Modular<float>, std::vector<float>>, LinBox::BlasMatrix<Givaro::Modular<float>, std::vector<float>>, LinBox::BlasMatrix<Givaro::Modular<float>, std::vector<float>>>' requested here
  138 |                 OMD.mul(C_o,A,B);
      |                     ^
test-opencl-domain.C:762:6: note: in instantiation of function template specialization 'testMul<Givaro::Modular<float>>' requested here
  762 |         if(!testMul(F, (size_t)n, iterations)){
      |             ^
test-opencl-domain.C:879:10: note: in instantiation of function template specialization 'launch_tests<Givaro::Modular<float>>' requested here
  879 |         pass &= launch_tests(H, (int)n, iterations);
      |                 ^


but this is another story - to be fixed with configure)
Comment 6 commit-hook freebsd_committer freebsd_triage 2025-01-19 18:33:28 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6e2222799ebf6ff0a12bed3798fc0cc0e71e1e55

commit 6e2222799ebf6ff0a12bed3798fc0cc0e71e1e55
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2025-01-19 18:31:50 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2025-01-19 18:31:50 +0000

    math/linbox: fix build with clang 19

    Clang 19 has become more strict about errors in member functions, which
    results in errors building math/linbox:

      ../../linbox/vector/blas-subvector.h:121:20: error: no member named 'data' in 'BlasSubvector<_Vector>'
        121 |             _ptr(V.data()+beg), _size(dim), _inc(inc), _field(&V.field()) {}
            |                  ~ ^
      ../../linbox/matrix/sparsematrix/sparse-ell-matrix.h:1216:16: error: cannot assign to non-static data member '_ld' with const-qualified type 'const size_t &' (aka 'const unsigned long &')
       1216 |                                 _ld        = iter._ld ;
            |                                 ~~~        ^
      ../../linbox/matrix/sparsematrix/sparse-ellr-matrix.h:1108:12: error: no viable overloaded '='
       1108 |                                 _rowid = iter._rowid;
            |                                 ~~~~~~ ^ ~~~~~~~~~~~

    In all these cases, the methods where the errors occur are not actually
    used, so until upstream sorts out their incorrect code, stub them out
    using #if 0/#endif pairs.

    PR:             284159
    Approved by:    thierry (maintainer)
    MFH:            2025Q1

 math/linbox/Makefile                               |  9 +-----
 ...x_matrix_sparsematrix_sparse-ell-matrix.h (new) | 18 ++++++++++++
 ..._matrix_sparsematrix_sparse-ellr-matrix.h (new) | 34 ++++++++++++++++++++++
 .../patch-linbox_vector_blas-subvector.h (new)     | 13 +++++++++
 4 files changed, 66 insertions(+), 8 deletions(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2025-01-19 18:34:29 UTC
A commit in branch 2025Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2a47978486c99459386f37bec701543bf001d6b8

commit 2a47978486c99459386f37bec701543bf001d6b8
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2025-01-19 18:31:50 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2025-01-19 18:33:28 +0000

    math/linbox: fix build with clang 19

    Clang 19 has become more strict about errors in member functions, which
    results in errors building math/linbox:

      ../../linbox/vector/blas-subvector.h:121:20: error: no member named 'data' in 'BlasSubvector<_Vector>'
        121 |             _ptr(V.data()+beg), _size(dim), _inc(inc), _field(&V.field()) {}
            |                  ~ ^
      ../../linbox/matrix/sparsematrix/sparse-ell-matrix.h:1216:16: error: cannot assign to non-static data member '_ld' with const-qualified type 'const size_t &' (aka 'const unsigned long &')
       1216 |                                 _ld        = iter._ld ;
            |                                 ~~~        ^
      ../../linbox/matrix/sparsematrix/sparse-ellr-matrix.h:1108:12: error: no viable overloaded '='
       1108 |                                 _rowid = iter._rowid;
            |                                 ~~~~~~ ^ ~~~~~~~~~~~

    In all these cases, the methods where the errors occur are not actually
    used, so until upstream sorts out their incorrect code, stub them out
    using #if 0/#endif pairs.

    PR:             284159
    Approved by:    thierry (maintainer)
    MFH:            2025Q1

    (cherry picked from commit 6e2222799ebf6ff0a12bed3798fc0cc0e71e1e55)

 ...x_matrix_sparsematrix_sparse-ell-matrix.h (new) | 18 ++++++++++++
 ..._matrix_sparsematrix_sparse-ellr-matrix.h (new) | 34 ++++++++++++++++++++++
 .../patch-linbox_vector_blas-subvector.h (new)     | 13 +++++++++
 3 files changed, 65 insertions(+)