OpenCV 3.x does not compile for Ubuntu 16
We have tried to compile OpenCV 3.4 on Ubuntu but with no success.
The compilation fails on cmake. We keep fixing the errors, but it just keeps throwing up more and more errors. We have made sure we have installed the dependencies required.
Can someone please provide a place we can get a compiling version of OpenCV 3.x for Ubuntu?
Out cmake options:
---------------------------------
ubuntu@machine:~/app/opencv/build$ cmake -D BUILD_TIFF=ON -D WITH_CUDA=OFF -D ENABLE_AVX=OFF -D WITH_OPENGL=ON -D WITH_OPENCL=OFF -D WITH_IPP=OFF -D WITH_TBB=ON -D BUILD_TBB=ON -D WITH_EIGEN=OFF -D WITH_V4L=OFF -D WITH_VTK=OFF -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D WITH_FFMPEG=ON -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=/opt/opencv_contrib/modules ..
---------------------------------
There are lots of errors and when we fix one, it throws another after another.... a bottomless well of errors.
Can someone please provide us with a compiled version?
Thanks in advance.
Tim & team
ADDED: Compilation errors
(1) I get compilation switch errors for
‘-Wmissing-prototypes’
‘-Wstrict-prototypes’ .
--------------------------
Build output check failed: Regex: 'command line option .* is valid for .* but not for C++' Output line: 'cc1plus: warning: command line option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++' Compilation failed: source file: '/home/ubuntu/app/opencv/build/CMakeFiles/CMakeTmp/src.cxx'
check option: ' -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -W
gravatar imagetimur (51 mins ago)edit
-----------------------------------
(2) Also errors:
"valid for C++/ObjC++ but not for C"
for switches
‘-Wsign-promo’
‘-Wsuggest-override’
‘-Wno-delete-non-virtual-dtor’
‘-fvisibility-inlines-hidden’
(3) Also errors:
'cc1plus: warning: unrecognized command line option
for
‘-Wno-unnamed-type-template-args’'
‘-Wno-implicit-fallthrough’
‘-Wno-unused-private-field’
‘-Wno-tautological-undefined-compare’
‘-Wno-shorten-64-to-32’
‘-Wno-enum-compare-switch’
‘-Wno-inconsistent-missing-override’
‘-Wno-unused-private-field’
(4) Also "not recognising INT8, INT16, INT32 "error which arises from 3rd party module 3rdparty/libtiff/CMakeLists.txt (line 166)
#Nonstandard int types
if(NOT MSVC)
check_type_size(INT8 int8)
set(HAVE_INT8 ${INT8})
check_type_size(INT16 int16)
set(HAVE_INT16 ${INT16})
check_type_size(INT32 int32)
set(HAVE_INT32 ${INT32})
endif()
--------------------- Error -------------------------------------------
Determining size of INT8 failed with the following output:
Change Dir: /home/ubuntu/app/opencv/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_ef0b7/fast"
/usr/bin/make -f CMakeFiles/cmTC_ef0b7.dir/build.make CMakeFiles/cmTC_ef0b7.dir/build
make[1]: Entering directory '/home/ubuntu/app/opencv/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_ef0b7.dir/int8.c.o
/usr/bin/cc -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -
Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -fPIE -o CMakeFiles/cmTC_ef0b7.dir/int8.c.o -c /home/ubuntu/app/opencv/build/CMakeFiles/CheckTypeSize/int8.c
/home/ubuntu/app/opencv/build/CMakeFiles/CheckTypeSize/int8.c:17:22: error: ‘INT8’ undeclared here (not in a function)
#define SIZE (sizeof(INT8))
CMAKE OUTPUT
ubuntu@ip-172-31-19-76:~/app/opencv/build cd ..;rm -rf build; mkdir build; cd build/ubuntu@ip-172-31-19-76:~/app/opencv/build cmake -D BUILD_TIFF=ON -D WITH_CUDA=OFF -D ENABLE_AVX=OFF -D WITH_OPENGL=ON -D WITH_OPENCL=OFF -D WITH_IPP ...
not enough information, to help you.
please add the cmake output, and the first few errors.
Forget my previous remark/answer -__(x_x)__- I was mixing up OpenCV and Caffe, which is depending on OpenCV. The issue was actually at the Caffe side, not the OpenCV one.
Hi @berak, I have added a detailed summary of the cmake errors on the original question above.
could you also add the cmake output ?
the errors you show, are from preliminary tests, they might not be relevant
Hi @StevenPuttmans, I have upgraded the gcc/g++ compilers to version 6.3.0 20170519
and am now compiling with the "g++ -std=c++11" switch.
I have had no problems building UC Berkeley's Caffe either, b.t.w.
Hi @berak, I have added the 'cmake' output to the end of my post. Very difficult to format very long text. Unfortunately, cmake does not create the Makefile system because of the errors logged. So I cannot do a 'make' build.
Could you give
cmake-gui
a chance? Its more verbose on what is actually wrong and will keep visualizing the fields in red that cause issues...The issues are clearly outlined in this log file also. I have summarised them at the top of my post. I have got rid of first 9 of those issues by removing the compilation switches which are not really needed.
The remaining switches are not in the code section, but are auto-generated into the cmake build and it is not clear from where. The problems are from switch
-Wno-tautological-undefined-compare’
down.
Also the capitalised INT8, INT16, INT32 are definitions from Windows. So why are they compiling for Linux in the 3rd party module?
Thanks. I'll take a look at this now.