ESVO icon indicating copy to clipboard operation
ESVO copied to clipboard

Problem with Eigen while building

Open nsgln opened this issue 3 years ago • 8 comments

After following all the instructions in the README file, I am stuck building the project : catkin build esvo_time_surface esvo_core. image image image

I've already tried uninstalling everything and starting from scratch, and I've googled, but I can't find an explanation for this problem, so I'm posting this Issue in the hope that someone can help me. I'm trying to run on Ubuntu 20.04 with ROS noetic.

nsgln avatar Feb 18 '22 17:02 nsgln

Hi @ghoshsuman, I remember you successfully build and run ESVO on Ubuntu 20.04 with ROS noetic. Could you disclose your cmake and gcc version here? Also, have you ever come across @nsgln 's problem shown above? Any thoughts would be appreciated~

Ethan-Zhou avatar Feb 20 '22 02:02 Ethan-Zhou

Hi, I built ESVO on Ubuntu 20.04 with gcc 9.3.0 and CMake 3.16.3. Unfortunately, I have never come across this issue with Eigen. I was using the eigen_catkin repository as defined in the dependencies, which I think uses eigen3 version 3.3.7 installed on my system.

ghoshsuman avatar Feb 21 '22 11:02 ghoshsuman

Thank you for your reply. My versions of gcc and CMake are identical to yours. When I check my Eigen3 version with the command pkg-config --modversion eigen3 the answer is 3.4.0. So I tried to uninstall all the dependencies, including Eigen3, I didn't reinstall it manually and yet when I retry the previous command line after trying the build, the version of Eigen3 is still that one. I assume that Eigen3 is automatically installed with one of the other dependencies. But unfortunately, I always get the same error. Maybe I have to change the version of Eigen3? But I can't find when it installs, so I don't know how to change the version. Do you have any advice or ideas? Any help is welcome!

nsgln avatar Feb 22 '22 16:02 nsgln

Hi @nsgln, Not sure, but the follwing one may help. https://stackoverflow.com/questions/40611485/compiling-againt-another-version-of-eigen-using-cmake

Ethan-Zhou avatar Feb 23 '22 06:02 Ethan-Zhou

Hi @nsgln , based on this answer perhaps you could try the following:

  • Uninstall Eigen 3.4.0 manually from your system.
  • Checkout branch 3.3 from the Eigen repo: https://gitlab.com/libeigen/eigen/-/tree/3.3. I think the latest stable version is 3.3.9.
  • Build it manually from source using make install.
  • Verify that you have a different version of Eigen3 in your system.
  • Build esvo_core. eigen_catkin should now pick up your system installation instead of re-installing the latest version of Eigen3.

ghoshsuman avatar Feb 25 '22 14:02 ghoshsuman

Hi @nsgln , I met the same problem as you previously. After I manually installed eigen 3.9 in /usr/local/include/eigen3, the problem still existed. I checked /usr/include and found another eigen with version 3.3.4. Then I deleted /usr/include/eigen3 and /usr/share/pkgconfig/eigen3.pc, creating a link using sudo ln -s /usr/local/include/eigen3 /usr/include/eigen3. After that the problem vanished and my building passed.

myuansun avatar Mar 12 '22 10:03 myuansun

I have the same problem but I could not solve it based on the mentioned solutions. Any help in this regard is highly appreciated.

hmirh avatar May 23 '22 19:05 hmirh

I think the new version of Eigen 3.4 doesn't allow indexing a matrix using float/double indices, as mentioned here. I solved the problem by casting the indices to integers like ((int) x_rect(1), (int) x_rect (0)) in the source code.

ghoshsuman avatar Jun 22 '22 17:06 ghoshsuman

Tested Build

Ubuntu GCC ROS Cmake Eigen
v20.04 v10.3.0 Noetic v3.22.1 3.3.9*

* Ubuntu 20.04 comes with Eigen 3.4.0 by default. However, esvo_core will fail to compile with this version of Eigen. Therefore, you must downgrade the to v3.3.9 manually. If you do this using apt, you will also inadvertently uninstall all your ROS packages that depend on Eigen. So, the best way to achieve this is to do it manually (ugly) that way you can keep everything else intact. Switching between different Eigen versions is also simple because it is a header-only library.

Solution

I received the same error as the original poster of this message and thought I would add a bit more details for anyone else that runs into this in the future. Also, I am adding the error message as text here to enable it to be searchable. The specific message is esvo_ws/src/ESVO/esvo_core/src/core/RegProblemLM.cpp:397:71: error: no match for ‘operator<’.

I'm not sure what the exact issue is with Eigen 3.4.0, but downgrading to v3.3.9 will correct the issue.

  1. Check Eigen version
$ sudo apt search libeigen3-dev
$ pkg-config --modversion eigen3
# If both return v3.4.0, then proceed to step 2.
  1. Downgrade to Eigen 3.3.9
# this example stores the v3.3.9 software in the ~/repos folder, but you can change this to wherever you want.
$ cd ~/repos
$ wget https://gitlab.com/libeigen/eigen/-/archive/3.3.9/eigen-3.3.9.tar.gz
$ tar -xvf eigen-3.3.9.tar.gz && cd eigen-3.3.9
$ mkdir eigen3
$ cp -r Eigen eigen3 && cp -r unsupported eigen3 && \
   cp signature_of_eigen3_matrix_library eigen3
$ sudo mv /usr/include/eigen3 /usr/include/eigen3_3.4.0_bkp
$ sudo ln -s /home/$USER/repos/eigen-3.3.9/eigen3 /usr/include
# now try to re-build EVSO

digiwang avatar Dec 22 '22 14:12 digiwang

Dear

Tested Build

Ubuntu GCC ROS Cmake Eigen v20.04 v10.3.0 Noetic v3.22.1 3.3.9* * Ubuntu 20.04 comes with Eigen 3.4.0 by default. However, esvo_core will fail to compile with this version of Eigen. Therefore, you must downgrade the to v3.3.9 manually. If you do this using apt, you will also inadvertently uninstall all your ROS packages that depend on Eigen. So, the best way to achieve this is to do it manually (ugly) that way you can keep everything else intact. Switching between different Eigen versions is also simple because it is a header-only library.

Solution

I received the same error as the original poster of this message and thought I would add a bit more details for anyone else that runs into this in the future. Also, I am adding the error message as text here to enable it to be searchable. The specific message is esvo_ws/src/ESVO/esvo_core/src/core/RegProblemLM.cpp:397:71: error: no match for ‘operator<’.

I'm not sure what the exact issue is with Eigen 3.4.0, but downgrading to v3.3.9 will correct the issue.

  1. Check Eigen version
$ sudo apt search libeigen3-dev
$ pkg-config --modversion eigen3
# If both return v3.4.0, then proceed to step 2.
  1. Downgrade to Eigen 3.3.9
# this example stores the v3.3.9 software in the ~/repos folder, but you can change this to wherever you want.
$ cd ~/repos
$ wget https://gitlab.com/libeigen/eigen/-/archive/3.3.9/eigen-3.3.9.tar.gz
$ tar -xvf eigen-3.3.9.tar.gz && cd eigen-3.3.9
$ mkdir eigen3
$ cp -r Eigen eigen3 && cp -r unsupported eigen3 && \
   cp signature_of_eigen3_matrix_library eigen3
$ sudo mv /usr/include/eigen3 /usr/include/eigen3_3.4.0_bkp
$ sudo ln -s /home/$USER/repos/eigen-3.3.9/eigen3 /usr/include
# now try to re-build EVSO

Dear digiwang Thank you for your help. The way that you mentioned did not work for me and I added some steps to it:

wget https://gitlab.com/libeigen/eigen/-/archive/3.3.9/eigen-3.3.9.tar.gz
tar -xvf eigen-3.3.9.tar.gz && cd eigen-3.3.9
mkdir build
cd build
cmake ..
sudo make install
mkdir eigen3
cp -r Eigen eigen3 && cp -r unsupported eigen3 && \
   cp signature_of_eigen3_matrix_library eigen3
$ sudo mv /usr/include/eigen3 /usr/include/eigen3_3.4.0_bkp
$ sudo ln -s /home/$USER/repos/eigen-3.3.9/eigen3 /usr/include

msh003 avatar Oct 12 '23 19:10 msh003