Can not compile opencv3 with cuda7.5

asked 2016-05-22 00:51:30 -0600

hi there I am trying to compile opencv3 (latest) with CUDA 7.5 but it gives the following error

[ 86%] Built target opencv_python2

[ 86%] Built target opencv_python3 [ 86%] Building CXX object apps/traincascade/CMakeFiles/opencv_traincascade.dir/mergevec.cpp.o In file included from /home/unnirajendran/opencv/apps/traincascade/_cvcommon.h:45:0, from /home/unnirajendran/opencv/apps/traincascade/_cvhaartraining.h:51, from /home/unnirajendran/opencv/apps/traincascade/mergevec.cpp:8: /home/unnirajendran/opencv/modules/core/include/opencv2/core/core.hpp:45:2: error: #error this is a compatibility header which should not be used inside the OpenCV library #error this is a compatibility header which should not be used inside the OpenCV library ^ In file included from /usr/include/opencv2/core/internal.hpp:53:0, from /home/unnirajendran/opencv/apps/traincascade/_cvcommon.h:46, from /home/unnirajendran/opencv/apps/traincascade/_cvhaartraining.h:51, from /home/unnirajendran/opencv/apps/traincascade/mergevec.cpp:8: /home/unnirajendran/opencv/modules/core/include/opencv2/core/core.hpp:45:2: error: #error this is a compatibility header which should not be used inside the OpenCV library #error this is a compatibility header which should not be used inside the OpenCV library ^ /home/unnirajendran/opencv/apps/traincascade/mergevec.cpp: In function ‘void icvMergeVecs(char, const char, int, int, int)’: /home/unnirajendran/opencv/apps/traincascade/mergevec.cpp:102:73: warning: ignoring return value of ‘size_t fread(void, size_t, size_t, FILE)’, declared with attribute warn_unused_result [-Wunused-result] fread( &invec.count, sizeof( invec.count ) , 1, invec.input ); ^ /home/unnirajendran/opencv/apps/traincascade/mergevec.cpp:103:73: warning: ignoring return value of ‘size_t fread(void, size_t, size_t, FILE)’, declared with attribute warn_unused_result [-Wunused-result] fread( &invec.vecsize, sizeof( invec.vecsize ), 1, invec.input ); ^ /home/unnirajendran/opencv/apps/traincascade/mergevec.cpp:104:53: warning: ignoring return value of ‘size_t fread(void, size_t, size_t, FILE)’, declared with attribute warn_unused_result [-Wunused-result] fread( &tmp, sizeof( tmp ), 1, invec.input ); ^ /home/unnirajendran/opencv/apps/traincascade/mergevec.cpp:105:53: warning: ignoring return value of ‘size_t fread(void, size_t, size_t, FILE)’, declared with attribute warn_unused_result [-Wunused-result] fread( &tmp, sizeof( tmp ), 1, invec.input ); ^ /home/unnirajendran/opencv/apps/traincascade/mergevec.cpp:128:73: warning: ignoring return value of ‘size_t fread(void, size_t, size_t, FILE)’, declared with attribute warn_unused_result [-Wunused-result] fread( &invec.count, sizeof( invec.count ) , 1, invec.input ); ^ /home/unnirajendran/opencv/apps/traincascade/mergevec.cpp:129:73: warning: ignoring return value of ‘size_t fread(void, size_t, size_t, FILE)’, declared with attribute warn_unused_result [-Wunused-result] fread( &invec.vecsize, sizeof( invec.vecsize ), 1, invec.input ); ^ /home/unnirajendran/opencv/apps/traincascade/mergevec.cpp:130:53: warning: ignoring return value of ‘size_t fread(void, size_t, size_t, FILE)’, declared with attribute warn_unused_result [-Wunused-result] fread( &tmp, sizeof( tmp ), 1, invec.input ); ^ /home/unnirajendran/opencv/apps/traincascade/mergevec.cpp:131:53: warning: ignoring return value of ‘size_t fread(void, size_t, size_t, FILE)’, declared with attribute warn_unused_result [-Wunused-result] fread( &tmp, sizeof( tmp ), 1, invec.input ); ^ apps/traincascade/CMakeFiles/opencv_traincascade.dir/build.make:169: recipe for target 'apps/traincascade/CMakeFiles/opencv_traincascade.dir/mergevec.cpp.o' failed make[2]: * [apps/traincascade ... (more)

edit retag flag offensive close merge delete

Comments

as I see your system is linux, can you give some more information about distribution, and gcc version. Most likely your cuda is not supported from your gcc version for that reason you cannot compile it. In that case what you could do it either downgrade your gcc or disable cuda in opencv cmake file. The latter can be done with -D with_CUDA=OFF if I remember correctly.

theodore gravatar imagetheodore ( 2016-05-22 18:13:28 -0600 )edit

gcc version is 4.4 and would it help if i downgrade gcc version ,if so then which gcc version should i use

arpit1997 gravatar imagearpit1997 ( 2016-05-23 00:51:10 -0600 )edit

actually your gcc version might be too old now that you are saying that you have 4.4, try to upgrade maybe? From a quick search:

  • As of the CUDA 4.1 release, gcc 4.5 is now supported. gcc 4.6 and 4.7 are unsupported.
  • As of the CUDA 5.0 release, gcc 4.6 is now supported. gcc 4.7 are unsupported.
  • As of the CUDA 6.0 release, gcc 4.7 is now supported.
  • As of the CUDA 7.0 release, gcc 4.8 is fully supported, with 4.9 support on Ubuntu 14.04 and Fedora 21
  • As of the CUDA 7.5 release, gcc 4.8 is fully supported, with 4.9 support on Ubuntu 14.04 and Fedora 21
theodore gravatar imagetheodore ( 2016-05-23 03:22:10 -0600 )edit