From bug-request at octave dot org Fri Mar 10 10:10:47 2006 Subject: Re: [tbm at cyrius dot com: [Pkg-octave-devel] Bug#355980: Makes other packages FTBFS with G++ 4.1:] From: "John W. Eaton" To: Quentin Spencer Cc: Rafael Laboissiere , bugs@octave.org Date: Fri, 10 Mar 2006 11:10:00 -0500 On 10-Mar-2006, Quentin Spencer wrote: | The patch fixed the problem, but now I'm starting to see some of the | other errors that were originally reported. I'm not sure why make -k | didn't generate them for me before--maybe they were dependent on the | compilation of CMatrix.cc. Anyway, like I said before, the compilation | is on a very slow machine, so I haven't finished rebuilding yet, but | here are the two errors so far: | | g++ -c -fPIC -I. -I.. -I../liboctave -I../src -I../libcruft/misc | -DHAVE_CONFIG_H -mieee-fp -Wall -W -Wshadow -O2 -g -pipe -Wall | -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector | --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic | -fasynchronous-unwind-tables -D_GNU_SOURCE ls-mat4.cc -o pic/ls-mat4.o | ls-mat4.cc: In function ?bool save_mat_binary_data(std::ostream&, const | octave_value&, const std::string&)?: | ls-mat4.cc:476: error: cannot convert ?ComplexMatrix? to ?double? for | argument ?1? to ?double real(double)? | ls-mat4.cc:478: error: cannot convert ?ComplexMatrix? to ?double? for | argument ?1? to ?double imag(double)? | make[2]: *** [pic/ls-mat4.o] Error 1 | | g++ -c -fPIC -I. -I.. -I../liboctave -I../src -I../libcruft/misc | -DHAVE_CONFIG_H -mieee-fp -Wall -W -Wshadow -O2 -g -pipe -Wall | -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector | --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic | -fasynchronous-unwind-tables -D_GNU_SOURCE ls-mat5.cc -o pic/ls-mat5.o | ls-mat5.cc: In function ?bool save_mat5_binary_element(std::ostream&, | const octave_value&, const std::string&, bool, bool)?: | ls-mat5.cc:1185: error: cannot convert ?ComplexNDArray? to ?double? for | argument ?1? to ?double real(double)? | ls-mat5.cc:1186: error: cannot convert ?ComplexNDArray? to ?double? for | argument ?1? to ?double imag(double)? | | | Maybe you're already aware, but one of the major changes in g++ 4.1 | relative to 4.0 is more strict enforcement of the C++ standard, which | (if I recall correctly) requires that friend functions be declared | outside the scope of a class. That could be what is causing problems here. Yes, and those changes were already made for 2.9.x. Here are the additional changes for 2.1.x. BTW, this is why we need a maintainer for the "stable" release, or a release manager who can do these kinds of things. Anyone? Thanks, jwe liboctave/ChangeLog: 2006-03-10 John W. Eaton Changes for GCC 4.1, tip from Arno J. Klaassen : * dColVector.h (real (const ComplexColumnVector&)): Publish externally used friend function. (imag (const ComplexColumnVector&)): Likewise. * dNDArray.h (real (const ComplexNDArray&)): Publish externally used friend function. (imag (const ComplexNDArray&)): Likewise. * dMatrix.h (operator * (const ComplexMatrix&)): Move decl outside class. No need to be friend. (real (const ComplexMatrix&)): Publish externally used friend function. (imag (const ComplexMatrix&)): Likewise. src/ChangeLog: 2006-03-10 John W. Eaton Changes for GCC 4.1, tip from Arno J. Klaassen : * ov.h (do_unary_op (octave_value::unary_op, const octave_value&)): Publish externally used friend function. (do_unary_op (octave_value::unary_op, const octave_value&, const octave_value&)): Likewise. Index: liboctave/CMatrix.h =================================================================== RCS file: /usr/local/cvsroot/octave/liboctave/CMatrix.h,v retrieving revision 1.51.2.1 diff -u -r1.51.2.1 CMatrix.h --- liboctave/CMatrix.h 26 Apr 2005 19:43:53 -0000 1.51.2.1 +++ liboctave/CMatrix.h 10 Mar 2006 15:49:53 -0000 at @ -204,17 +204,6 @@ ComplexMatrix expm (void) const; - // column vector by row vector -> matrix operations - - friend ComplexMatrix operator * (const ColumnVector& a, - const ComplexRowVector& b); - - friend ComplexMatrix operator * (const ComplexColumnVector& a, - const RowVector& b); - - friend ComplexMatrix operator * (const ComplexColumnVector& a, - const ComplexRowVector& b); - // matrix by diagonal matrix -> matrix operations ComplexMatrix& operator += (const DiagMatrix& a); at @ -290,6 +279,17 @@ ComplexMatrix Sylvester (const ComplexMatrix&, const ComplexMatrix&, const ComplexMatrix&); +// column vector by row vector -> matrix operations + +ComplexMatrix +operator * (const ColumnVector& a, const ComplexRowVector& b); + +ComplexMatrix +operator * (const ComplexColumnVector& a, const RowVector& b); + +ComplexMatrix +operator * (const ComplexColumnVector& a, const ComplexRowVector& b); + extern ComplexMatrix operator * (const Matrix&, const ComplexMatrix&); extern ComplexMatrix operator * (const ComplexMatrix&, const Matrix&); extern ComplexMatrix operator * (const ComplexMatrix&, const ComplexMatrix&); Index: liboctave/dColVector.h =================================================================== RCS file: /usr/local/cvsroot/octave/liboctave/dColVector.h,v retrieving revision 1.22.2.1 diff -u -r1.22.2.1 dColVector.h --- liboctave/dColVector.h 26 Apr 2005 19:43:54 -0000 1.22.2.1 +++ liboctave/dColVector.h 10 Mar 2006 15:49:54 -0000 at @ -103,6 +103,11 @@ ColumnVector (double *d, int l) : MArray (d, l) { } }; +// Publish externally used friend functions. + +extern ColumnVector real (const ComplexColumnVector& a); +extern ColumnVector imag (const ComplexColumnVector& a); + MARRAY_FORWARD_DEFS (MArray, ColumnVector, double) #endif Index: liboctave/dMatrix.h =================================================================== RCS file: /usr/local/cvsroot/octave/liboctave/dMatrix.h,v retrieving revision 1.57.2.1 diff -u -r1.57.2.1 dMatrix.h --- liboctave/dMatrix.h 26 Apr 2005 19:43:54 -0000 1.57.2.1 +++ liboctave/dMatrix.h 10 Mar 2006 15:49:54 -0000 at @ -181,10 +181,6 @@ boolMatrix operator ! (void) const; - // column vector by row vector -> matrix operations - - friend Matrix operator * (const ColumnVector& a, const RowVector& b); - // other operations Matrix map (d_d_Mapper f) const; at @ -235,6 +231,15 @@ Matrix (double *d, int r, int c) : MArray2 (d, r, c) { } }; +// Publish externally used friend functions. + +extern Matrix real (const ComplexMatrix& a); +extern Matrix imag (const ComplexMatrix& a); + +// column vector by row vector -> matrix operations + +extern Matrix operator * (const ColumnVector& a, const RowVector& b); + extern Matrix Givens (double, double); extern Matrix Sylvester (const Matrix&, const Matrix&, const Matrix&); Index: liboctave/dNDArray.h =================================================================== RCS file: /usr/local/cvsroot/octave/liboctave/dNDArray.h,v retrieving revision 1.19.2.1 diff -u -r1.19.2.1 dNDArray.h --- liboctave/dNDArray.h 26 Apr 2005 19:43:54 -0000 1.19.2.1 +++ liboctave/dNDArray.h 10 Mar 2006 15:49:54 -0000 at @ -131,6 +131,11 @@ NDArray (double *d, const dim_vector& dv) : MArrayN (d, dv) { } }; +// Publish externally used friend functions. + +extern NDArray real (const ComplexNDArray& a); +extern NDArray imag (const ComplexNDArray& a); + extern NDArray min (double d, const NDArray& m); extern NDArray min (const NDArray& m, double d); extern NDArray min (const NDArray& a, const NDArray& b); Index: src/ov.h =================================================================== RCS file: /usr/local/cvsroot/octave/src/ov.h,v retrieving revision 1.116.2.3 diff -u -r1.116.2.3 ov.h --- src/ov.h 26 Apr 2005 19:43:59 -0000 1.116.2.3 +++ src/ov.h 10 Mar 2006 15:49:57 -0000 at @ -814,6 +814,15 @@ octave_value *nil_rep (void) const; }; +// Publish externally used friend functions. + +extern octave_value +do_unary_op (octave_value::unary_op op, const octave_value& a); + +extern octave_value +do_binary_op (octave_value::binary_op op, + const octave_value& a, const octave_value& b); + #define OV_UNOP_FN(name) \ inline octave_value \ name (const octave_value& a) \ ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------