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 .
Related
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
Here's my cmake command:
cmake -D CMAKE_BUILD_TYPE=DEBUG\
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D CUDA_ARCH_BIN="6.1" \
-D WITH_TBB=ON \
-D WITH_CUDA=ON \
-D BUILD_opencv_cudacodec=OFF \
-D ENABLE_FAST_MATH=1 \
-D CUDA_FAST_MATH=1 \
-D WITH_CUBLAS=1 \
-D WITH_V4L=ON \
-D WITH_QT=OFF \
-D WITH_OPENGL=ON \
-D WITH_GSTREAMER=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_PC_FILE_NAME=opencv.pc \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_PYTHON3_INSTALL_PATH=~/venv/lib/python3.5/site-packages \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv/opencv_contrib/modules \
-D PYTHON_EXECUTABLE=~/venv/bin/python \
-D PYTHON_DEFAULT_EXECUTABLE=~/venv/bin/python3.5 \
-D BUILD_EXAMPLES=ON ..
Configuring and generating are successful. However, when I tried to compile it. This error appears:
...
/home/jaylo/opencv/modules/dnn/src/cuda/math.hpp(30): error: no operator "+" matches these operands
operand types are: __half2 + __half2
/home/jaylo/opencv/modules/dnn/src/cuda/math.hpp(54): error: no operator "+" matches these operands
operand types are: __half2 + __half2
/home/jaylo/opencv/modules/dnn/src/cuda/math.hpp(119): error: no operator "+" matches these operands
operand types are: __half2 + __half2
3 errors detected in the compilation of "/tmp/tmpxft_000048a8_00000000-6_activations.cpp1.ii".
CMake Error at cuda_compile_1_generated_activations.cu.o.DEBUG-D.cmake:281 (message):
Error generating file
/home/jaylo/opencv/build/modules/dnn/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_activations.cu.o
modules/dnn/CMakeFiles/opencv_dnn.dir/build.make:434: recipe for target 'modules/dnn/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_activations.cu.o' failed
make[2]: *** [modules/dnn/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_activations.cu.o] Error 1
CMakeFiles/Makefile2:4972: recipe for target 'modules/dnn/CMakeFiles/opencv_dnn.dir/all' failed
make[1]: *** [modules/dnn/CMakeFiles/opencv_dnn.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
What is happening here? It seems that it's a syntax error of the openCV code itself.
CUDA 10.0 added native vector arithmetic operators for the __half2 datatype. The CUDA backend for OpenCV DNN makes use of the aforementioned built-in operators.
You will either have to upgrade to CUDA 10.0 to use the CUDA backend of OpenCV DNN or disable it by unmarking OPENCV_DNN_CUDA in CMake options.
Note: The CUDA backend for OpenCV DNN was merged into master a few weeks ago and is not in any release yet. I suspect you have built the master branch instead of OpenCV 4.1.2.
Turns out that using openCV 4.1.0 solves the problem.
I'm trying to install OpenCV on a Raspberry Pi 3 Model B running Buster (July 2019) using this guide. I eventually run into the following error after running the make -j4 command.
/usr/bin/ld: ../../lib/libopencv_core.so.4.1.1: undefined reference to `__atomic_fetch_add_8'
/usr/bin/ld: ../../lib/libopencv_core.so.4.1.1: undefined reference to `__atomic_fetch_sub_8'
/usr/bin/ld: ../../lib/libopencv_core.so.4.1.1: undefined reference to `__atomic_store_8'
/usr/bin/ld: ../../lib/libopencv_core.so.4.1.1: undefined reference to `__atomic_load_8'
/usr/bin/ld: ../../lib/libopencv_core.so.4.1.1: undefined reference to `__atomic_compare_exchange_8'
collect2: error: ld returned 1 exit status
make[2]: *** [modules/core/CMakeFiles/opencv_test_core.dir/build.make:571: bin/opencv_test_core] Error 1
make[1]: *** [CMakeFiles/Makefile2:1459:modules/core/CMakeFiles/opencv_test_core.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
My CMake command is:
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=$cwd/installation/OpenCV-"$cvVersion" \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D WITH_TBB=ON \
-D WITH_V4L=ON \
-D OPENCV_PYTHON3_INSTALL_PATH=$cwd/OpenCV-$cvVersion-py3/lib/python3.5/site-packages \
-D WITH_QT=ON \
-D WITH_OPENGL=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
-D BUILD_EXAMPLES=ON ..
So far, I've run make clean and make to see if a single core installation might help. If it does I will update this post. If it doesn't however, does anyone know how to solve this error?
EDIT: After make clean and make the error still occurred
This problem is also raised here
https://github.com/opencv/opencv/issues/15192
As a workaround try to use cmake option: -DOPENCV_EXTRA_EXE_LINKER_FLAGS=-latomic
You can find an example script here https://gist.github.com/willprice/abe456f5f74aa95d7e0bb81d5a710b60
Edit: I had to call python with
LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1.2.0 python3
in order to import cv2
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 ..
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.