2

I'm installing opencv for Python in Ubuntu 18.04 LTS from the official OpenCV release here https://docs.opencv.org/4.1.0/d2/de6/tutorial_py_setup_in_ubuntu.html

after creating the build directory and entering cmake ../ the moment I enter the command to make it's giving me the following error - Previously I've used OpenCV on Windows. I'm new in Ubuntu. Please help.

In file included from /home/avi/opencv/modules/core/test/test_precomp.hpp:12:0,
                 from /home/avi/opencv/build/modules/core/opencv_test_core_pch_dephelp.cxx:1:
/home/avi/opencv/modules/core/include/opencv2/core/private.hpp:66:12: fatal error: Eigen/Core: No such file or directory
 #  include <Eigen/Core>
            ^~~~~~~~~~~~
compilation terminated.
modules/core/CMakeFiles/opencv_test_core_pch_dephelp.dir/build.make:62: recipe for target 'modules/core/CMakeFiles/opencv_test_core_pch_dephelp.dir/opencv_test_core_pch_dephelp.cxx.o' failed
make[2]: *** [modules/core/CMakeFiles/opencv_test_core_pch_dephelp.dir/opencv_test_core_pch_dephelp.cxx.o] Error 1
CMakeFiles/Makefile2:1287: recipe for target 'modules/core/CMakeFiles/opencv_test_core_pch_dephelp.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/opencv_test_core_pch_dephelp.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
0

3 Answers 3

4

Seems like OpenCV did not find Eigen where it was expecting. Supposing you installed Eigen:

sudo apt-get install libeigen3-dev

The most correct way would be for you to specify to OpenCV where you installed Eigen by setting the variable EIGEN_INCLUDE_PATH, usually to \usr\include, but check your system.

Another option, instead of editing the OpenCV code, is to create some links between where you installed Eigen, and where OpenCV expects it to be:

cd /usr/include
sudo ln -sf eigen3/Eigen Eigen
sudo ln -sf eigen3/unsupported unsupported
Sign up to request clarification or add additional context in comments.

Comments

3

I didn't find the solution for me in this post so I may as well share it if somebody comes by.

Problem : The include was looking for an include called Eigen while I installed Eigen3.

Solution : Create a soft link to create a directory called Eigen that redirect to Eigen3.

sudo ln -s /usr/include/eigen3/Eigen /usr/include/Eigen

https://www.programmersought.com/article/44372970691/

Comments

2

Go to /home/avi/opencv/modules/core/include/opencv2/core/private.hpp file.

Edit the line: # include <Eigen/Core> to # include <eigen3/Eigen/Core>

Read more about this error from here.

1 Comment

Thanks. I actually had to resolve it by uninstalling all the dependencies and installing again. It worked!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.