Installing opencv and Linux Makefile:160 : recipe for target ‘all’ failed problem resolution

system used: MAC, remote server: Linux (UBuntu).

installing opencv to the server can accelerate the training speed and enhance the test function to a certain extent. Look up a few methods on the net all write too complex, oneself close test after feasible use the simplest language description record at this.

connect to the server with a terminal on the macbook and download opencv package from github:

git clone https://github.com/Itseez/opencv.git
git clone https://github.com/Itseez/opencv_contrib.git

download completed, opencv and opencv_contrib folders can be seen in your download directory, move opencv_contrib directory to opencv directory.

add the required dependency libraries:

sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

done, use the CD command to enter the opencv directory, and then create a new folder:

mkdir build

goes into the build directory and starts compiling —

1. If your server has no anaconda pre-installed, execute:

cmake -D CMAKE_INSTALL_PREFIX=/usr/local -D CMAKE_BUILD_TYPE=Release -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules ..

2. If you have anaconda on your server, there may be some conflicts. If you use the command above, a Makefile:160: recipe for target ‘all’ failed with an error. Just change it to:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_SHARED_LIBS=OFF -D WITH_OPENMP=ON -D ENABLE_PRECOMPILED_HEADERS=OFF ..

is followed by:

make -j8

After

is compiled, execute:

sudo make install

this way, we can use OPencv in Ubuntu for all languages. You can see the results of the opencv compilation under /usr/local/lib.

cd /usr/local/lib
ls

you can see that there is a large number of lib oepncv, on the stable!

Read More: