When I enter into my Opencv project directory and do the following command-

sudo cmake .
sudo make

it generates make files without any error and the program runs successfully.

But when I do

cmake .

it gives me this error-

"CMake Warning at /home/naman/opencv-2.4.9/cmake/OpenCVConfig.cmake:161 (message): Found OpenCV Windows Pack but it has not binaries compatible with your configuration.

You should manually point CMake variable OpenCV_DIR to your build of OpenCV library. Call Stack (most recent call first): CMakeLists.txt:3 (find_package)

CMake Error at CMakeLists.txt:3 (find_package): Found package configuration file:


but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be NOT FOUND.

-- Configuring incomplete, errors occurred!"

And it complies successfully in my friend's pc when done

cmake .

How to remove this error?

  • Never use sudo to run cmake (or other build configurators such as ./configure scripts) under your home directory - it usually causes the generated files to become root-owned so that subsequent build attempts without sudo fail in mysterious ways. Start over (either chown everything back to your user, or - better - unpack a clean copy of the project) and see if you still get the error. – steeldriver Dec 21 '14 at 20:55
  • Yes I tried them already but it did not work. – Naman Sogani Dec 21 '14 at 21:14
  • Did you previously install OpenCV elsewhere (perhaps under wine)? Does your user's environment define any OpenCV related variables (env | grep CV)? – steeldriver Dec 21 '14 at 21:59
  • I initially installed OpenCV 2.4.9 version and it was working fine(not under wine).Then I tried to install 3.0 but failed to install it.Then these errors occured. I also tried to found that that CMake variable 'OpenCV_DIR' but could not get it. – Naman Sogani Dec 22 '14 at 8:47

Most probably your OpenCV was installed as root, and hence its owner is root. Try running these commands in terminal:

  1. Get to know yourself whoami
  2. Locate OpenCV directory (sudo may be needed) whereis opencv
  3. Go to OpenCV directory

    cd `whereis opencv`
  4. Change ownership recursively to yourself

    sudo chown -R `whoami`
  • No it didn't work. – Naman Sogani Dec 21 '14 at 21:16
  • You did use output of whoami, not literally [whoami], yes? If so, I cannot help. – julka Dec 22 '14 at 9:20
  • 1
    Yes obviously I wrote my username there.But anyways,thanks for your help. – Naman Sogani Dec 22 '14 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.