error in TensorFunctions.h during make on macOS with M2 chip
x-avent opened this issue · comments
When did the error occur?
[ ] CMake configuration (cmake / ccmake)
[X] Compilation (make)
[ ] Installation (make install)
Build environment
- OS: MacOS
- OS version: 14.1
- Type of system: macbook pro M2
ANTs version
git clone https://github.com/ANTsX/ANTs.git on Jan 16, 2024
Build configuration and logs
[build.log](https://github.com/ANTsX/ANTs/files/13956078/build.l
CMakeOutput.log
og)
CMakeError.log
Additional context
Corrected link to build.log: https://github.com/ANTsX/ANTs/files/13956078/build.log
Error message:
In file included from /Users/xeniagrande/ANTs/Examples/antsRegistration2DDouble.cxx:1:
In file included from /Users/xeniagrande/ANTs/Examples/antsRegistrationTemplateHeader.h:14:
In file included from /Users/xeniagrande/ANTs/Examples/itkantsRegistrationHelper.h:21:
In file included from /Users/xeniagrande/ANTs/Utilities/ReadWriteData.h:26:
In file included from /Users/xeniagrande/ANTs/Tensor/itkLogTensorImageFilter.hIn file included from :/Users/xeniagrande/ANTs/Examples/antsRegistrationTemplateHeader.cxx20::
1:
/Users/xeniagrande/ANTs/Tensor/TensorFunctions.hIn file included from :/Users/xeniagrande/ANTs/Examples/antsRegistrationTemplateHeader.h441::1414:
:In file included from /Users/xeniagrande/ANTs/Examples/itkantsRegistrationHelper.h:error: no viable conversion from 'vnl_matrix_inverse<double>' to 'MatrixType' (aka 'vnl_matrix<double>')
21:
In file included from /Users/xeniagrande/ANTs/Utilities/ReadWriteData.h:26:
In file included from /Users/xeniagrande/ANTs/Tensor/itkLogTensorImageFilter.h:20:
/Users/xeniagrande/ANTs/Tensor/TensorFunctions.h:441 MatrixType inv = vnl_matrix_inverse<double>(DT);:
14 ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~:
error: no viable conversion from 'vnl_matrix_inverse<double>' to 'MatrixType' (aka 'vnl_matrix<double>')
MatrixType inv = vnl_matrix_inverse<double>(DT);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/xeniagrande/build/staging/include/ITK-5.4/vnl/vnl_matrix.h:141:3: note: candidate constructor not viable: no known conversion from 'vnl_matrix_inverse<double>' to 'const vnl_matrix<double> &' for 1st argument
vnl_matrix(vnl_matrix<T> const&); // from another matrix.
^
/Users/xeniagrande/build/staging/include/ITK-5.4/vnl/vnl_matrix.h:141:3: note: candidate constructor not viable: no known conversion from 'vnl_matrix_inverse<double>' to 'const vnl_matrix<double> &' for 1st argument
/Users/xeniagrande/build/staging/include/ITK-5.4/vnl/vnl_matrix.h:148:3: note: candidate constructor not viable: no known conversion from 'vnl_matrix_inverse<double>' to 'vnl_matrix<double> &&' for 1st argument
vnl_matrix(vnl_matrix<T> const&); // from another matrix.
^ vnl_matrix(vnl_matrix<T> &&);
^
/Users/xeniagrande/build/staging/include/ITK-5.4/vnl/algo/vnl_matrix_inverse.h/Users/xeniagrande/build/staging/include/ITK-5.4/vnl/vnl_matrix.h:148:3: note: candidate constructor not viable: no known conversion from 'vnl_matrix_inverse<double>' to 'vnl_matrix<double> &&' for 1st argument
:40: vnl_matrix(vnl_matrix<T> &&);12
: ^
note: explicit conversion function is not a candidate
/Users/xeniagrande/build/staging/include/ITK-5.4/vnl/algo/vnl_matrix_inverse.h:40:12: note: explicit conversion function is not a candidate
explicit operator vnl_matrix<T>() const { return this->inverse(); }
^
explicit operator vnl_matrix<T>() const { return this->inverse(); }
^
In file included from /Users/xeniagrande/ANTs/Examples/antsRegistration2DDouble.cxx:1:
In file included from /Users/xeniagrande/ANTs/Examples/antsRegistrationTemplateHeader.h:14:
In file included from /Users/xeniagrande/ANTs/Examples/itkantsRegistrationHelper.h:21:
In file included from /Users/xeniagrande/ANTs/Utilities/ReadWriteData.h:26:
In file included from /Users/xeniagrande/ANTs/Tensor/itkLogTensorImageFilter.h:20:
/Users/xeniagrande/ANTs/Tensor/TensorFunctions.h:840:14: error: no viable conversion from 'vnl_matrix_inverse<double>' to 'MatrixType' (aka 'vnl_matrix<double>')
MatrixType inv = vnl_matrix_inverse<double>(DT);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/xeniagrande/build/staging/include/ITK-5.4/vnl/vnl_matrix.h:141:3: note: candidate constructor not viable: no known conversion from 'vnl_matrix_inverse<double>' to 'const vnl_matrix<double> &' for 1st argument
vnl_matrix(vnl_matrix<T> const&); // from another matrix.
^
/Users/xeniagrande/build/staging/include/ITK-5.4/vnl/vnl_matrix.h:148:3: note: candidate constructor not viable: no known conversion from 'vnl_matrix_inverse<double>' to 'vnl_matrix<double> &&' for 1st argument
vnl_matrix(vnl_matrix<T> &&);
^
/Users/xeniagrande/build/staging/include/ITK-5.4/vnl/algo/vnl_matrix_inverse.h:40:12: note: explicit conversion function is not a candidate
explicit operator vnl_matrix<T>() const { return this->inverse(); }
^
In file included from /Users/xeniagrande/ANTs/Examples/antsRegistrationTemplateHeader.cxx:1:
In file included from /Users/xeniagrande/ANTs/Examples/antsRegistrationTemplateHeader.h:14:
In file included from /Users/xeniagrande/ANTs/Examples/itkantsRegistrationHelper.h:21:
In file included from /Users/xeniagrande/ANTs/Utilities/ReadWriteData.h:26:
In file included from /Users/xeniagrande/ANTs/Tensor/itkLogTensorImageFilter.h:20:
/Users/xeniagrande/ANTs/Tensor/TensorFunctions.h:840:14: error: no viable conversion from 'vnl_matrix_inverse<double>' to 'MatrixType' (aka 'vnl_matrix<double>')
MatrixType inv = vnl_matrix_inverse<double>(DT);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/xeniagrande/build/staging/include/ITK-5.4/vnl/vnl_matrix.h:141:3: note: candidate constructor not viable: no known conversion from 'vnl_matrix_inverse<double>' to 'const vnl_matrix<double> &' for 1st argument
vnl_matrix(vnl_matrix<T> const&); // from another matrix.
^
/Users/xeniagrande/build/staging/include/ITK-5.4/vnl/vnl_matrix.h:148:3: note: candidate constructor not viable: no known conversion from 'vnl_matrix_inverse<double>' to 'vnl_matrix<double> &&' for 1st argument
vnl_matrix(vnl_matrix<T> &&);
^
/Users/xeniagrande/build/staging/include/ITK-5.4/vnl/algo/vnl_matrix_inverse.h:40:12: note: explicit conversion function is not a candidate
explicit operator vnl_matrix<T>() const { return this->inverse(); }
^
Reproduced on my Intel Mac. Result of recent ITK changes perhaps. I will find where the problem begins
ITK bump in #1651 causes this error on Mac but not Linux
Compiles fine on Mac with previous ITK (fabc102c520bcbd21ea35e7303e3756c223e10d7), from June 2023. I don't see any changes to the ITK matrix classes that would have caused this.
OK so the problem looks to be conversion between matrix types in a function added a long time ago by @stnava
Line 441 in 62550fc
I don't get why it stopped working now, but the compile error goes away if I explicitly get the inverse matrix with
MatrixType inv = vnl_matrix_inverse<double>(DT).inverse();
It doesn't look like the enclosing function GetMetricTensorCost
is used anywhere, so I can't test it further.
Many thanks for the quick help! It works fine now.