Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error in TensorFunctions.h during make on macOS with M2 chip #1657

Closed
x-avent opened this issue Jan 16, 2024 · 8 comments · Fixed by #1659
Closed

error in TensorFunctions.h during make on macOS with M2 chip #1657

x-avent opened this issue Jan 16, 2024 · 8 comments · Fixed by #1659
Labels
bug Reproducible bugs

Comments

@x-avent
Copy link

x-avent commented Jan 16, 2024

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

CMakeCache.txt

Additional context

@cookpa
Copy link
Member

cookpa commented Jan 17, 2024

Corrected link to build.log: https://github.com/ANTsX/ANTs/files/13956078/build.log

@cookpa
Copy link
Member

cookpa commented Jan 17, 2024

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(); }
           ^

@cookpa
Copy link
Member

cookpa commented Jan 17, 2024

Reproduced on my Intel Mac. Result of recent ITK changes perhaps. I will find where the problem begins

@cookpa cookpa added the bug Reproducible bugs label Jan 17, 2024
@cookpa
Copy link
Member

cookpa commented Jan 17, 2024

ITK bump in #1651 causes this error on Mac but not Linux

@cookpa
Copy link
Member

cookpa commented Jan 17, 2024

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.

@cookpa
Copy link
Member

cookpa commented Jan 17, 2024

OK so the problem looks to be conversion between matrix types in a function added a long time ago by @stnava

MatrixType inv = vnl_matrix_inverse<double>(DT);

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.

@cookpa
Copy link
Member

cookpa commented Jan 17, 2024

@x-avent could you try building #1659? It works on my Intel Mac

@x-avent
Copy link
Author

x-avent commented Jan 21, 2024

Many thanks for the quick help! It works fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Reproducible bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants