Can't install cmake on Ubuntu(build error) - opencv

I tried to install opencv(3.1.0) on Ubuntu 12.06. What does this error mean? Is observed for OpenCV modules second time? How can I fix it?
Env Var setup
cmake
-D CMAKE_BUILD_TYPE=RELEASE
-D ENABLE_PRECOMPILED_HEADERS=OFF
-D CMAKE_INSTALL_PREFIX=/usr/local
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules
-D BUILD_NEW_PYTHON_SUPPORT=ON
-D WITH_TBB=ON
-D WITH_QT=ON
-D WITH_OPENGL=ON
-D BUILD_TIFF=ON
-D BUILD_SHARED_LIBS=ON
-D BUILD_EXAMPLES=ON
-D BUILD_opencv_ts=ON
CMake Error at cmake/OpenCVModule.cmake:268 (message):
The directory /home/user/bin/opencv/modules is observed for OpenCV
modules second time.
Call Stack (most recent call first):
modules/CMakeLists.txt:7 (ocv_glob_modules)

This issue is already raised on OpenCV GitHub Page :
ts module not installed
Hope that helps.

Related

Cmake not configuring , showing file download HASH MISMATCH error while installing opencv(3.2.0) on ubuntu 18.04

I am installing ros melodic with opencv(3.2.0) on ubuntu 18.04. the ros installation is proper. But im getting stuck in the opencv installation, at the part where you configure cmake.its giving a hash mismatch error
ICV: Downloading ippicv_linux_20151201.tgz...
CMake Error at 3rdparty/ippicv/downloader.cmake:73 (file):
file DOWNLOAD HASH mismatch
for file: [/home/anirudh/opencv-3.2.0/3rdparty/ippicv/downloads/linux-808b791a6eac9ed78d32a7666804320e/ippicv_linux_20151201.tgz]
expected hash: [808b791a6eac9ed78d32a7666804320e]
actual hash: [d41d8cd98f00b204e9800998ecf8427e]
status: [7;"Couldn't connect to server"]
and when i scroll down theres a line that says:
CMake Error at 3rdparty/ippicv/downloader.cmake:77 (message):
ICV: Failed to download ICV package: ippicv_linux_20151201.tgz.
Status=7;"Couldn't connect to server"
This is the command that i ran with the full errors:
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
How to fix it?
I tried running another command:
cmake -D CMAKE_BUILD_TYPE=RELEASE \
> -D CMAKE_INSTALL_PREFIX=/usr/local \
> -D INSTALL_C_EXAMPLES=ON \
> -D INSTALL_PYTHON_EXAMPLES=ON \
> -D OPENCV_GENERATE_PKGCONFIG=ON \
> -D OPENCV_EXTRA_MODULES_PATH=~/opencv_build/opencv_contrib/modules \
> -D BUILD_EXAMPLES=ON ..
But that too gave the same output with the errors

ubuntu) installed opencv with cmake but python couldn`t find cv2 module

i just want to know about this problem.
pkg config show my opencv4 version, but in python3 there`s no module named cv2.
please help me...!
cmake list:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_PYTHON_EXAMPLES=ON -D INSTALL_C_EXAMPLES=ON -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D BUILD_PACKAGE=OFF -D BUILD_EXAMPLES=OFF -D WITH_TBB=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.7 -D WITH_CUDA=ON -D WITH_CUBLAS=ON -D WITH_CUFFT=ON -D WITH_NVCUVID=ON -D WITH_IPP=OFF -D WITH_V4L=ON -D WITH_1394=OFF -D WITH_GTK=ON -D WITH_QT=OFF -D WITH_OPENGL=ON -D WITH_EIGEN=ON -D WITH_FFMPEG=ON -D WITH_GSTREAMER=ON -D BUILD_JAVA=OFF -D BUILD_opencv_python3=ON -D BUILD_opencv_python2=OFF -D BUILD_NEW_PYTHON_SUPPORT=ON -D OPENCV_SKIP_PYTHON_LOADER=ON -D OPENCV_GENERATE_PKGCONFIG=ON -D OPENCV_ENABLE_NONFREE=ON -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.5.1/modules -D WITH_CUDNN=ON -D OPENCV_DNN_CUDA=ON -D CUDA_ARCH_BIN=8.6 -D CUDA_ARCH_PTX=8.6 -D OpenCL_LIBRARY=/usr/local/cuda-11.7/lib64/libOpenCL.so -D OpenCL_INCLUDE_DIR=/usr/local/cuda-11.7/include/ ..
cuda-11.7 cudnn- so.8 opencv-4.5.1
Did you check the build information before building and installing OpenCV? If not, you can still check the build information using the OpenCV function getBuildInformation(). To find your OpenCV configuration, create a C++ file, add the following code to it, and execute the file:
#include <opencv2/opencv.hpp>
int main(void)
{
std::cout << cv::getBuildInformation() << std::endl;
}
Reference: https://learnopencv.com/get-opencv-build-information-getbuildinformation/
Once you have the build information, check the Python3 options (usually found at the bottom of the output). OpenCV Python bindings have not been generated if the install path is unspecified.
That means OpenCV has to be built again with the proper Python3 addresses.
The following options need to be added to the CMake command:
-D PYTHON_EXECUTABLE=$(which python3)
-D OPENCV_PYTHON3_INSTALL_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
-D PYTHON3_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())")
-D PYTHON3_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
Then, run a clean build, and check the configuration page for the correct Python3 options. A step-by-step guide is posted by learnopencv for installing OpenCV DNN module with GPU support on Linux.

how to Install OpenCv on my home directory in Ubuntu

I am trying to compile and install OpenCV on my home directory (so I can have several versions installed)
I have this option when I am calling cmak:
-D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/home/mans/local/opencv -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_INF_ENGINE=ON -D ENABLE_CXX11=ON
but when I build the code and try to install it, I am getting this error:
-- Install configuration: "Release"
CMake Error at cmake_install.cmake:41 (file):
file cannot create directory: /usr/local/share/licenses/opencv4. Maybe
need administrative privileges.
Makefile:61: recipe for target 'install' failed
make: *** [install] Error 1
As I want to install on my home directory, I can not use
sudo make install
as it will install openCV on root and I don't want to do this.
Edit
I am using this bash script to build and install OpenCV from git repository.
WITH_INF_ENGINE=true # should be buildwith Intel Inference Engineen
workingDir="$HOME/local"
downloadDir="$workingDir/downloadedFiles"
if [ ! -d "$workingDir" ]; then
mkdir "$workingDir"
fi
cd $workingDir
git clone https://github.com/opencv/opencv $downloadDir/opencv
cd $downloadDir/opencv
mkdir build
cd build
cmakeParameters="-D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=$workingDir/opencv -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON "
if $WITH_INF_ENGINE; then
source /opt/intel/computer_vision_sdk/bin/setupvars.sh
cmakeParameters="$cmakeParameters -D WITH_INF_ENGINE=ON -D ENABLE_CXX11=ON"
fi
echo "$cmakeParameters"
cmake "$cmakeParameters" ..
make -j $(nproc)
make install

Getting CMake Error with Protobuf Library in the configuration of OpenCV in Raspberry Pi

I followed this tutorial to install OpenCV and all the steps worked until I reached the Install part. I did the following:
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.3.0/modules \
-D BUILD_EXAMPLES=ON ..
The command performed several tests and showed the General configuration for OpenCV 3.3.0 but at the end I got the following error:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
Protobuf_LIBRARY
linked by target "opencv_dnn_modern" in directory /home/pi/opencv_contrib-3.3.0/modules/dnn_modern
-- Configuring incomplete, errors occurred!
See also "/home/pi/opencv-3.3.0/build/CMakeFiles/CMakeOutput.log".
See also "/home/pi/opencv-3.3.0/build/CMakeFiles/CMakeError.log".
I have a opencv_contrib-3.3.0 directory though instead of opencv_contrib that's why I included the -3.3.0 in the make.
I solved the issue through the following steps:
Deleting the build folder in the opencv directory
Recreating the build folder: mkdir build
Moving to that build directory: cd build
Adding the following line in the make: -D BUILD_opencv_dnn_modern=OFF
and running it as follows:
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D BUILD_opencv_dnn_modern=OFF \
-D ENABLE_NEON=ON \
-D ENABLE_VFPV3=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.3.0/modules \
-D BUILD_EXAMPLES=ON ..

issues in installing opencv

i wanted to compile the Opencv for the first using the following commands
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.1.0/modules \
-D PYTHON_EXECUTABLE=~/.virtualenvs/cv/bin/python \
-D BUILD_EXAMPLES=ON ..
but i am getting the following error
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:128 (project):
No CMAKE_CXX_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "/home/siddhartha/opencv-3.3.0/build/CMakeFiles/CMakeOutput.log".
See also "/home/siddhartha/opencv-3.3.0/build/CMakeFiles/CMakeError.log".
(cv) siddhartha#wipro:~/opencv-3.3.0/build$
anyone has any idea how to solve this issue .

Resources