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

Build breaks with Eigen 3.4 #261

Open
ras0219-msft opened this issue Oct 5, 2021 · 1 comment
Open

Build breaks with Eigen 3.4 #261

ras0219-msft opened this issue Oct 5, 2021 · 1 comment

Comments

@ras0219-msft
Copy link

The new release of Eigen 3.4 [1] on August 18th appears to introduce breaking changes for Theia. We (vcpkg) discovered these breaks while attempting to update Eigen to 3.4 in microsoft/vcpkg#19665.

This can be reproduced by fetching the PR branch and building theia:

git clone https://github.com/spinicist/vcpkg
cd vcpkg
git checkout 255d561
./bootstrap-vcpkg
./vcpkg install theia

An example of one build break is:

[34/190] /usr/bin/c++ -DGTEST_TESTING_OUTPUT_DIRECTORY=\"/mnt/vcpkg-ci/buildtrees/theia/x64-linux-dbg/testing_output\" -DGTEST_USE_OWN_TR1_TUPLE=1 -DTHEIA_DATA_DIR=\"/mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/data\" -I/mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean -I/mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/include -I/mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/src -I/mnt/vcpkg-ci/installed/x64-linux/include -I/mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/. -fPIC -std=c++11 -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -g -std=c++14 -MD -MT libraries/akaze/CMakeFiles/akaze.dir/src/nldiffusion_functions.cpp.o -MF libraries/akaze/CMakeFiles/akaze.dir/src/nldiffusion_functions.cpp.o.d -o libraries/akaze/CMakeFiles/akaze.dir/src/nldiffusion_functions.cpp.o -c /mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/nldiffusion_functions.cpp
FAILED: libraries/akaze/CMakeFiles/akaze.dir/src/nldiffusion_functions.cpp.o 
/usr/bin/c++ -DGTEST_TESTING_OUTPUT_DIRECTORY=\"/mnt/vcpkg-ci/buildtrees/theia/x64-linux-dbg/testing_output\" -DGTEST_USE_OWN_TR1_TUPLE=1 -DTHEIA_DATA_DIR=\"/mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/data\" -I/mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean -I/mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/include -I/mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/src -I/mnt/vcpkg-ci/installed/x64-linux/include -I/mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/. -fPIC -std=c++11 -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -g -std=c++14 -MD -MT libraries/akaze/CMakeFiles/akaze.dir/src/nldiffusion_functions.cpp.o -MF libraries/akaze/CMakeFiles/akaze.dir/src/nldiffusion_functions.cpp.o.d -o libraries/akaze/CMakeFiles/akaze.dir/src/nldiffusion_functions.cpp.o -c /mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/nldiffusion_functions.cpp
/mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/nldiffusion_functions.cpp: In function ‘void libAKAZE::halfsample_image(const RowMatrixXf&, libAKAZE::RowMatrixXf&)’:
/mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/nldiffusion_functions.cpp:256:45: error: no match for ‘operator-=’ (operand types are ‘Eigen::internal::enable_if<true, Eigen::IndexedView<Eigen::Matrix<float, 1, -1>, Eigen::internal::SingleRange, double> >::type’ {aka ‘Eigen::IndexedView<Eigen::Matrix<float, 1, -1>, Eigen::internal::SingleRange, double>’} and ‘double’)
  256 |     y_kernel_mul(y_kernel_clamped_size - 1) -=
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
  257 |         y_kernel_mul.sum() - y_kernel_size;
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
In file included from /mnt/vcpkg-ci/installed/x64-linux/include/Eigen/Core:273,
                 from /mnt/vcpkg-ci/installed/x64-linux/include/Eigen/Dense:1,
                 from /mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/convolution.h:38,
                 from /mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/nldiffusion_functions.cpp:28:
/mnt/vcpkg-ci/installed/x64-linux/include/Eigen/src/Core/MatrixBase.h:161:14: note: candidate: ‘template<class OtherDerived> Derived& Eigen::MatrixBase<Derived>::operator-=(const Eigen::MatrixBase<OtherDerived>&) [with OtherDerived = OtherDerived; Derived = Eigen::IndexedView<Eigen::Matrix<float, 1, -1>, Eigen::internal::SingleRange, double>]’
  161 |     Derived& operator-=(const MatrixBase<OtherDerived>& other);
      |              ^~~~~~~~
/mnt/vcpkg-ci/installed/x64-linux/include/Eigen/src/Core/MatrixBase.h:161:14: note:   template argument deduction/substitution failed:
/mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/nldiffusion_functions.cpp:257:30: note:   mismatched types ‘const Eigen::MatrixBase<Derived>’ and ‘double’
  257 |         y_kernel_mul.sum() - y_kernel_size;
      |                              ^~~~~~~~~~~~~
In file included from /mnt/vcpkg-ci/installed/x64-linux/include/Eigen/Core:273,
                 from /mnt/vcpkg-ci/installed/x64-linux/include/Eigen/Dense:1,
                 from /mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/convolution.h:38,
                 from /mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/nldiffusion_functions.cpp:28:
/mnt/vcpkg-ci/installed/x64-linux/include/Eigen/src/Core/MatrixBase.h:496:46: note: candidate: ‘template<class OtherDerived> Derived& Eigen::MatrixBase<Derived>::operator-=(const Eigen::ArrayBase<OtherDerived>&) [with OtherDerived = OtherDerived; Derived = Eigen::IndexedView<Eigen::Matrix<float, 1, -1>, Eigen::internal::SingleRange, double>]’
  496 |     template<typename OtherDerived> Derived& operator-=(const ArrayBase<OtherDerived>& )
      |                                              ^~~~~~~~
/mnt/vcpkg-ci/installed/x64-linux/include/Eigen/src/Core/MatrixBase.h:496:46: note:   template argument deduction/substitution failed:
/mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/nldiffusion_functions.cpp:257:30: note:   mismatched types ‘const Eigen::ArrayBase<Derived>’ and ‘double’
  257 |         y_kernel_mul.sum() - y_kernel_size;
      |                              ^~~~~~~~~~~~~
In file included from /mnt/vcpkg-ci/installed/x64-linux/include/Eigen/Core:272,
                 from /mnt/vcpkg-ci/installed/x64-linux/include/Eigen/Dense:1,
                 from /mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/convolution.h:38,
                 from /mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/nldiffusion_functions.cpp:28:
/mnt/vcpkg-ci/installed/x64-linux/include/Eigen/src/Core/DenseBase.h:298:14: note: candidate: ‘template<class OtherDerived> Derived& Eigen::DenseBase<Derived>::operator-=(const Eigen::EigenBase<OtherDerived>&) [with OtherDerived = OtherDerived; Derived = Eigen::IndexedView<Eigen::Matrix<float, 1, -1>, Eigen::internal::SingleRange, double>]’
  298 |     Derived& operator-=(const EigenBase<OtherDerived> &other);
      |              ^~~~~~~~
/mnt/vcpkg-ci/installed/x64-linux/include/Eigen/src/Core/DenseBase.h:298:14: note:   template argument deduction/substitution failed:
/mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/nldiffusion_functions.cpp:257:30: note:   mismatched types ‘const Eigen::EigenBase<Derived>’ and ‘double’
  257 |         y_kernel_mul.sum() - y_kernel_size;
      |                              ^~~~~~~~~~~~~
/mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/nldiffusion_functions.cpp:267:47: error: no match for ‘operator-=’ (operand types are ‘Eigen::internal::enable_if<true, Eigen::IndexedView<Eigen::Matrix<float, 1, -1>, Eigen::internal::SingleRange, double> >::type’ {aka ‘Eigen::IndexedView<Eigen::Matrix<float, 1, -1>, Eigen::internal::SingleRange, double>’} and ‘double’)
  267 |       x_kernel_mul(x_kernel_clamped_size - 1) -=
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
  268 |           x_kernel_mul.sum() - x_kernel_size;
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
In file included from /mnt/vcpkg-ci/installed/x64-linux/include/Eigen/Core:273,
                 from /mnt/vcpkg-ci/installed/x64-linux/include/Eigen/Dense:1,
                 from /mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/convolution.h:38,
                 from /mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/nldiffusion_functions.cpp:28:
/mnt/vcpkg-ci/installed/x64-linux/include/Eigen/src/Core/MatrixBase.h:161:14: note: candidate: ‘template<class OtherDerived> Derived& Eigen::MatrixBase<Derived>::operator-=(const Eigen::MatrixBase<OtherDerived>&) [with OtherDerived = OtherDerived; Derived = Eigen::IndexedView<Eigen::Matrix<float, 1, -1>, Eigen::internal::SingleRange, double>]’
  161 |     Derived& operator-=(const MatrixBase<OtherDerived>& other);
      |              ^~~~~~~~
/mnt/vcpkg-ci/installed/x64-linux/include/Eigen/src/Core/MatrixBase.h:161:14: note:   template argument deduction/substitution failed:
/mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/nldiffusion_functions.cpp:268:32: note:   mismatched types ‘const Eigen::MatrixBase<Derived>’ and ‘double’
  268 |           x_kernel_mul.sum() - x_kernel_size;
      |                                ^~~~~~~~~~~~~
In file included from /mnt/vcpkg-ci/installed/x64-linux/include/Eigen/Core:273,
                 from /mnt/vcpkg-ci/installed/x64-linux/include/Eigen/Dense:1,
                 from /mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/convolution.h:38,
                 from /mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/nldiffusion_functions.cpp:28:
/mnt/vcpkg-ci/installed/x64-linux/include/Eigen/src/Core/MatrixBase.h:496:46: note: candidate: ‘template<class OtherDerived> Derived& Eigen::MatrixBase<Derived>::operator-=(const Eigen::ArrayBase<OtherDerived>&) [with OtherDerived = OtherDerived; Derived = Eigen::IndexedView<Eigen::Matrix<float, 1, -1>, Eigen::internal::SingleRange, double>]’
  496 |     template<typename OtherDerived> Derived& operator-=(const ArrayBase<OtherDerived>& )
      |                                              ^~~~~~~~
/mnt/vcpkg-ci/installed/x64-linux/include/Eigen/src/Core/MatrixBase.h:496:46: note:   template argument deduction/substitution failed:
/mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/nldiffusion_functions.cpp:268:32: note:   mismatched types ‘const Eigen::ArrayBase<Derived>’ and ‘double’
  268 |           x_kernel_mul.sum() - x_kernel_size;
      |                                ^~~~~~~~~~~~~
In file included from /mnt/vcpkg-ci/installed/x64-linux/include/Eigen/Core:272,
                 from /mnt/vcpkg-ci/installed/x64-linux/include/Eigen/Dense:1,
                 from /mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/convolution.h:38,
                 from /mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/nldiffusion_functions.cpp:28:
/mnt/vcpkg-ci/installed/x64-linux/include/Eigen/src/Core/DenseBase.h:298:14: note: candidate: ‘template<class OtherDerived> Derived& Eigen::DenseBase<Derived>::operator-=(const Eigen::EigenBase<OtherDerived>&) [with OtherDerived = OtherDerived; Derived = Eigen::IndexedView<Eigen::Matrix<float, 1, -1>, Eigen::internal::SingleRange, double>]’
  298 |     Derived& operator-=(const EigenBase<OtherDerived> &other);
      |              ^~~~~~~~
/mnt/vcpkg-ci/installed/x64-linux/include/Eigen/src/Core/DenseBase.h:298:14: note:   template argument deduction/substitution failed:
/mnt/vcpkg-ci/buildtrees/theia/src/v0.8-fff4592347.clean/libraries/akaze/src/nldiffusion_functions.cpp:268:32: note:   mismatched types ‘const Eigen::EigenBase<Derived>’ and ‘double’
  268 |           x_kernel_mul.sum() - x_kernel_size;
      |                                ^~~~~~~~~~~~~

The build logs for our CI are available at https://dev.azure.com/vcpkg/public/_build/results?buildId=60777&view=artifacts&pathAsName=false&type=publishedArtifacts, a direct download link to the logs zip is https://dev.azure.com/vcpkg/c1ee48cb-0df2-4ab3-8384-b1df5a79fe53/_apis/build/builds/60777/artifacts?artifactName=failure%20logs%20for%20x64-linux&api-version=6.0&%24format=zip

[1] https://eigen.tuxfamily.org/index.php?title=3.4

@cenit
Copy link

cenit commented Oct 6, 2021

this patch solves the issue

--- a/libraries/akaze/src/nldiffusion_functions.cpp
+++ b/libraries/akaze/src/nldiffusion_functions.cpp
@@ -222,8 +222,8 @@ void halfsample_image(const RowMatrixXf& src, RowMatrixXf& dst) {
 
   // Do the whole resampling in one pass by using neighboring values. First, we
   // compute the borders.
-  const double x_kernel_size = static_cast<double>(src.cols()) / dst.cols();
-  const double y_kernel_size = static_cast<double>(src.rows()) / dst.rows();
+  const int x_kernel_size = static_cast<double>(src.cols()) / dst.cols();
+  const int y_kernel_size = static_cast<double>(src.rows()) / dst.rows();
 
   // Do simple linear interpolation.
   if (x_kernel_size == 2 && y_kernel_size == 2) {
@@ -237,8 +237,8 @@ void halfsample_image(const RowMatrixXf& src, RowMatrixXf& dst) {
     return;
   }
 
-  const double x_kernel_clamped_size = static_cast<int>(ceil(x_kernel_size));
-  const double y_kernel_clamped_size = static_cast<int>(ceil(y_kernel_size));
+  const int x_kernel_clamped_size = static_cast<int>(ceil(static_cast<double>(src.cols()) / dst.cols()));
+  const int y_kernel_clamped_size = static_cast<int>(ceil(static_cast<double>(src.rows()) / dst.rows()));
 
   // Set up precomputed factor matrices.
   Eigen::RowVectorXf x_kernel_mul(static_cast<int>(x_kernel_clamped_size)),

i am double posting it, also in the vcpkg PR related to eigen 3.4 update

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

No branches or pull requests

2 participants