Ask Your Question
0

OpenCV 3.x does not compile for Ubuntu 16

asked 2018-04-18 09:18:13 -0600

timur gravatar image

updated 2018-04-19 06:50:39 -0600

berak gravatar image

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 ...
(more)
edit retag flag offensive close merge delete

Comments

not enough information, to help you.

please add the cmake output, and the first few errors.

berak gravatar imageberak ( 2018-04-18 09:25:00 -0600 )edit

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.

StevenPuttemans gravatar imageStevenPuttemans ( 2018-04-19 04:58:17 -0600 )edit
1

Hi @berak, I have added a detailed summary of the cmake errors on the original question above.

timur gravatar imagetimur ( 2018-04-19 05:36:27 -0600 )edit

could you also add the cmake output ?

the errors you show, are from preliminary tests, they might not be relevant

berak gravatar imageberak ( 2018-04-19 05:46:33 -0600 )edit

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.

timur gravatar imagetimur ( 2018-04-19 05:54:23 -0600 )edit

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.

timur gravatar imagetimur ( 2018-04-19 06:42:19 -0600 )edit

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...

StevenPuttemans gravatar imageStevenPuttemans ( 2018-04-19 06:57:50 -0600 )edit

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?

timur gravatar imagetimur ( 2018-04-19 07:18:28 -0600 )edit

Thanks. I'll take a look at this now.

timur gravatar imagetimur ( 2018-04-19 08:19:04 -0600 )edit

1 answer

Sort by » oldest newest most voted
1

answered 2018-04-19 07:44:43 -0600

@timur, that can all be true, but I just launched a clean docker image here of ubuntu 16.04, and built master and 3.4 without any problems. So there must be something different in your setups. Those flags are heavily tested on OpenCV build bots and they never triggered issues before.

edit flag offensive delete link more

Comments

You can find the relevant docker file right here: https://github.com/StevenPuttemans/do... Might want to have a look at what might be missing for you?

StevenPuttemans gravatar imageStevenPuttemans ( 2018-04-19 07:46:39 -0600 )edit
1

Okay, managed to get it working now. it was one of the dependencies that I was missing.

timur gravatar imagetimur ( 2018-04-19 08:32:14 -0600 )edit

had to be something like that :) nice to see it solved!

StevenPuttemans gravatar imageStevenPuttemans ( 2018-04-19 08:36:12 -0600 )edit

can you specify which dependency caused all this? Curious!

StevenPuttemans gravatar imageStevenPuttemans ( 2018-04-19 08:37:38 -0600 )edit

Thanks a lot for you help, greatly appreciated :)

timur gravatar imagetimur ( 2018-04-19 09:41:53 -0600 )edit
1

Some of the cmake switches pointing to TBB were missing:

DTBB_ENV_INCLUDE=/usr/include -DTBB_ENV_LIB=/usr/lib/x86_64-linux-gnu/libtbb.so -DTBB_VER_FILE=/usr/include/tbb/tbb_stddef.h

Also some of the OpenCV dependencies were missing. I just installed everything on your Docker; so I don't know which ones were missing and previously breaking the build.

timur gravatar imagetimur ( 2018-04-19 10:30:08 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-04-18 09:18:13 -0600

Seen: 4,663 times

Last updated: Apr 19 '18