linbox-team / linbox

LinBox - C++ library for exact, high-performance linear algebra
https://linbox-team.github.io/linbox
GNU Lesser General Public License v2.1
81 stars 28 forks source link

Fails to build with gcc 14 #310

Closed musicinmybrain closed 5 months ago

musicinmybrain commented 5 months ago

Trying to rebuild linbox 1.7.0 with GCC 14.0.1 in Fedora Rawhide, I encounter the following errors:

In file included from ../../linbox/matrix/sparse-matrix.h:76:
../../linbox/matrix/sparsematrix/sparse-ell-matrix.h: In member function 'LinBox::SparseMatrix<_Field, LinBox::SparseM
atrixFormat::ELL>::_IndexedIterator<index_iterator, element_iterator, Field>& LinBox::SparseMatrix<_Field, LinBox::Spa
rseMatrixFormat::ELL>::_IndexedIterator<index_iterator, element_iterator, Field>::operator=(const LinBox::SparseMatrix
<_Field, LinBox::SparseMatrixFormat::ELL>::_IndexedIterator<index_iterator, element_iterator, Field>&)':
../../linbox/matrix/sparsematrix/sparse-ell-matrix.h:1216:44: error: assignment of read-only location '((LinBox::Spars
eMatrix<_Field, LinBox::SparseMatrixFormat::ELL>::_IndexedIterator<index_iterator, element_iterator, Field>*)this)->Li
nBox::SparseMatrix<_Field, LinBox::SparseMatrixFormat::ELL>::_IndexedIterator<index_iterator, element_iterator, Field>
::_ld'
 1216 |                                 _ld        = iter._ld ;
      |                                 ~~~~~~~~~~~^~~~~~~~~~
In file included from ../../linbox/matrix/sparse-matrix.h:77:
../../linbox/matrix/sparsematrix/sparse-ellr-matrix.h: In member function 'LinBox::SparseMatrix<_Field, LinBox::Sparse
MatrixFormat::ELL_R>::_Iterator<element_iterator, Field>& LinBox::SparseMatrix<_Field, LinBox::Spmake[4]: Leaving dire
ctory '/builddir/build/BUILD/linbox-1.7.0/linbox/algorithms'
arseMatrixFormat::ELL_R>::_Iterator<element_iterator, Field>::operator=(const LinBox::SparseMatrix<_Field, LinBox::Spa
rseMatrixFormat::ELL_R>::_Iterator<element_iterator, Field>&)':
../../linbox/matrix/sparsematrix/sparse-ellr-matrix.h:1108:47: error: no match for 'operator=' (operand types are 'con
st std::vector<long unsigned int>' and 'const std::vector<long unsigned int>')
 1108 |                                 _rowid = iter._rowid;
      |                                               ^~~~~~

More context is available in the downstream bug. I haven’t tried to investigate this more closely yet.

(I used the workaround in https://github.com/linbox-team/givaro/issues/226#issuecomment-1908853755 to build givaro with GCC 14.)

jgdumas commented 5 months ago

Hello, ok thank you for the reports. Yes there are some 'const_cast' missing around the LHS. This should be now corrected in b8f2d4ccdc0af4418d14f72caf6c4d01969092a3. And linbox compiles completely with g++-14 for me

musicinmybrain commented 5 months ago

Thanks!