I am trying to install openCV for C++ on ubuntu. I am using this document . But step of compilation fails. The log of make is as follow:
$make
[ 0%] Built target opencv_core_pch_dephelp
[ 0%] Built target pch_Generate_opencv_core
[ 3%] Built target opencv_core
[ 4%] Built target opencv_ts_pch_dephelp
[ 4%] Built target pch_Generate_opencv_ts
[ 4%] Built target opencv_flann_pch_dephelp
[ 5%] Built target pch_Generate_opencv_flann
[ 5%] Built target opencv_flann
[ 5%] Built target opencv_imgproc_pch_dephelp
[ 5%] Built target pch_Generate_opencv_imgproc
[ 9%] Built target opencv_imgproc
[ 9%] Automoc for target opencv_highgui
[ 9%] Built target opencv_highgui_automoc
[ 9%] Automoc for target opencv_highgui_pch_dephelp
[ 9%] Built target opencv_highgui_pch_dephelp_automoc
[ 9%] Built target opencv_highgui_pch_dephelp
[ 9%] Built target pch_Generate_opencv_highgui
[ 9%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir /src/window_QT.cpp.o
In file included from /home/src/OpenCV/opencv-2.4.13/modules/highgui/src/window_QT.cpp:47:0:
/home/src/OpenCV/opencv-2.4.13/modules/highgui/src/window_QT.h:46:20: fatal error: QtOpenGL: No such file or directory
#include <QtOpenGL>
^
compilation terminated.
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_QT.cpp.o] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2
Could you please help me to fix this compilation problem?
I avoided the compilation error by runnuing:
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_QT=ON -D WITH_OPENGL=ON ..
Instead of :
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
Related
I have cloned kivy-ios:
git clone https://github.com/kivy/kivy-ios.git
cd kivy-ios/
python3 -m venv venv
. venv/bin/activate
pip install -e .
pip install cython
And when try toolchain build python3 kivy, I get this error:
[DEBUG ] In file included from crypto/rand/rand_unix.c:38:
[DEBUG ] /usr/include/CommonCrypto/CommonRandom.h:35:9: error: unknown type name
[DEBUG ] 'CCCryptorStatus'
[DEBUG ] typedef CCCryptorStatus CCRNGStatus;
[DEBUG ] ^
[DEBUG ] crypto/rand/rand_unix.c:385:47: error: use of undeclared identifier 'kCCSuccess'
[DEBUG ] if (CCRandomGenerateBytes(buf, buflen) == kCCSuccess)
[DEBUG ] ^
[DEBUG ] 2 errors generated.
This file was downloading with
[DEBUG ] x openssl-1.1.1l/crypto/rand/rand_unix.c
is it a problem with openssl-1.1.1l ???
I have tried to build kivy for IOS, but i could not success.
I'm quite a noob using cmake and compilers, I have compiled opencv-4.4.0 with contrib on my desktop, while facing the issue opencv2/intensity_transform.hpp: No such file or directory when I'm trying to include such file using:
#include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/intensity_transform.hpp>
#include <opencv2/imgproc.hpp>
#include "opencv2/imgcodecs.hpp"
The opencv is installed to default /usr/local directory, so opencv2 could be found in /usr/local/include/ directory. Only intensity_transform failed, with error message:
Scanning dependencies of target srobot
[ 25%] Building CXX object src/CMakeFiles/srobot.dir/img_aug_OPENCV/image_enhance_by_opencv.cpp.o
${ROOD_DIR}/src/img_aug_OPENCV/image_enhance_by_opencv.cpp:4:10: fatal error: opencv2/intensity_transform.hpp: No such file or directory
#include <opencv2/intensity_transform.hpp>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
src/CMakeFiles/srobot.dir/build.make:62: recipe for target 'src/CMakeFiles/srobot.dir/img_aug_OPENCV/image_enhance_by_opencv.cpp.o' failed
make[2]: *** [src/CMakeFiles/srobot.dir/img_aug_OPENCV/image_enhance_by_opencv.cpp.o] Error 1
CMakeFiles/Makefile2:85: recipe for target 'src/CMakeFiles/srobot.dir/all' failed
make[1]: *** [src/CMakeFiles/srobot.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Here is the CMakeLists.txt:
# CMakeLists from src directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
add_definitions(-DUSE_OPENCV)
# using mkl/cuda
set(MKL_DIR /opt/intel/mkl)
set(CUDA_DIR /usr/local/cuda)
include_directories(${MKL_DIR}/include ${CUDA_DIR}/include ${PROJECT_SOURCE_DIR}/src)
link_directories(${MKL_DIR}/lib/intel64 ${CUDA_DIR}/lib64)
# this command recursively add *.cpp files in src and add them to list: srcs
file(GLOB_RECURSE srcs ${PROJECT_SOURCE_DIR}/src/img_aug_OPENCV/image_enhance_by_opencv.cpp)
message(STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR})
message(STATUS "srcs: " ${srcs})
add_library(srobot SHARED ${srcs})
set(OPENCV_LIBS opencv_core opencv_imgproc opencv_imgcodecs)
target_link_libraries(srobot mkl_core ${OPENCV_LIBS})
Actually I'm facing this with original opencv-3.5.4, it is also installed from source. Here is the cmake commands I used:
cmake \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D WITH_CUDA=ON \
-D BUILD_opencv_cudacodec=OFF \
-D ENABLE_PRECOMPILED_HEADERS=OFF\
-D ENABLE_FAST_MATH=1 \
-D CUDA_FAST_MATH=1 \
-D WITH_CUBLAS=1 \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=ON \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_EXTRA_MODULES_PATH=/home/ubuntu/Installation/opencv_contrib-4.4.0/modules/ \
-D PYTHON_EXECUTABLE=/home/ubuntu/anaconda3/envs/tf2/bin/python \
-D BUILD_TIFF=ON ..
And system info:
Ubuntu 18.04;
CUDA 10.0.0;
I will provide more sys info if necessary. Is this related to platform? It seems that source code was from Windows platform. Help needed!
Now I am developing iphone app.
I created xcodescript.sh.
But build failed.
Error message is:
xcodescript.sh: line 2:
: command not found
xcodescript.sh: line 31: syntax error: unexpected end of file
Command PhaseScriptExecution failed with a nonzero exit code
And My xcodescript.sh content is:
#!/bin/sh
BIN_DIR="bin"
if [ ! -d "$BIN_DIR" ]; then
mkdir -p "$BIN_DIR"
fi
BIN_DIR_TMP="bin_tmp"
if [ ! -d "$BIN_DIR_TMP" ]; then
mkdir -p "$BIN_DIR_TMP"
fi
DST_DIR1="./../wfchat/Frameworks"
if [ ! -d "$DST_DIR1" ]; then
mkdir -p "$DST_DIR1"
fi
DST_DIR2="./../wfuikit/Frameworks"
if [ ! -d "$DST_DIR2" ]; then
mkdir -p "$DST_DIR2"
fi
cp -af ${BUILT_PRODUCTS_DIR}/${TARGET_NAME}.framework/
${BIN_DIR_TMP}/${PLATFORM_NAME}-${TARGET_NAME}.framework
cp -af ${BUILT_PRODUCTS_DIR}/${TARGET_NAME}.framework/ ${BIN_DIR}/${TARGET_NAME}.framework
lipo -create $BIN_DIR_TMP/*-${TARGET_NAME}.framework/${TARGET_NAME} -output
${BIN_DIR}/${TARGET_NAME}.framework/${TARGET_NAME}
cp -af ${BIN_DIR}/* ${DST_DIR1}/
cp -af ${BIN_DIR}/* ${DST_DIR2}/
Please help me. Thanks and Regards
I'm trying to make a build of OpenCV 4.0.0 on my Raspberry Pi 3B+, and keep running into this issue:
[ 83%] Building CXX object modules/stitching/CMakeFiles/opencv_perf_stitching.dir/perf/opencl/perf_stitch.cpp.o
c++: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
modules/stitching/CMakeFiles/opencv_perf_stitching.dir/build.make:62: recipe for target 'modules/stitching/CMakeFiles/opencv_perf_stitching.dir/perf/opencl/perf_stitch.cpp.o' failed
make[2]: *** [modules/stitching/CMakeFiles/opencv_perf_stitching.dir/perf/opencl/perf_stitch.cpp.o] Error 4
CMakeFiles/Makefile2:23142: recipe for target 'modules/stitching/CMakeFiles/opencv_perf_stitching.dir/all' failed
make[1]: *** [modules/stitching/CMakeFiles/opencv_perf_stitching.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
This is the make/build portion of the script I'm running:
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
-D PYTHON_EXECUTABLE=~/.virtualenvs/py3cv4/bin/python \
-D WITH_GSTREAMER=ON \
-D WITH_FFMPEG=ON \
-D WITH_OPENMP=ON \
-D BUILD_EXAMPLES=ON ..
echo ""
echo "======================="
echo "Building OpenCV..."
make -j4
sudo make install
sudo ldconfig
I read somewhere that I should change the make -j4 command to not use all four cores, because I'm running out of memory. I tried make -j1, but still got the same error at the same spot. I'm going to try again with just plain make, but delete all the pre-built stuff that's in there and start over from scratch to see if that helps.
Turns out I needed to entirely delete the build I had created and rebuild it with a single core instead of all four, as it was using up too much memory. I deleted my /opencv/build/ directory and then did make with no -j command, and it worked fine. It took a really long time (5+ hours), but it did complete successfully. Now I just have to figure out why I can't import cv2...
Guys am trying to install OpenCV 3.3.1 on Raspbian stretch Noobs on Pi model B
I am following this tutorial.
But when i type
cmake
-D CMAKE_BUILD_TYPE=RELEASE \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_EXTRA_MODULES_PATH= ~/Opencv_contrib-3.3.1/modules \
-D BUILD_opencv_python3=yes \
-D BUILD_EXAMPLES=ON \
-D WITH_CUDA=OFF.. `
And then i type make -j2
To get this error
[ 7%] building cxx object 3rsparty/openexr/CMakeFiles/IlmImf.dir/IlmImf/ ImfZipcompressor.cpp.o
[ 7%] linking cxx static library.. /lib/libIlmImf.a
[ 7%] built target IlmImf
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
What's the problem?
I found that the problem was in this line
/home/pi/opencv3.3.1/3rdparty/carotene/src/absdiff.cpp:42:22: fatal error: common.hpp: no such file or directory
#include "common.hpp"
I 've gone through the directory and opened absdiff.cpp to find #include "common.hpp"
But no file called common.hpp in the same directory so i copied common.hpp from
/home/pi/opencv/3rd party/carotene/src/
Which i cloned using this code
git clone https://github.com/Itseez/opencv.git opencv
I don't know why opencv-3.3.1 doesn't have it or just an issue during the download...
Or just re-download opencv-3.3.1 again