New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake caffe cuda build error #6470

Open
mineo210 opened this Issue Jul 17, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@mineo210
Copy link

mineo210 commented Jul 17, 2018

Whenever i write "make all" it throws me this error:

-- Generating done
-- Build files have been written to: /home/groot/caffe/build
[  1%] Built target caffeproto
[  1%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile_1.dir/util/cuda_compile_1_generated_math_functions.cu.o
In file included from /usr/local/cuda-9.2/include/common_functions.h:50:0,
                 from /usr/local/cuda-9.2/include/cuda_runtime.h:115,
                 from <command-line>:0:
/usr/local/cuda-9.2/include/crt/common_functions.h:64:24: error: token ""__CUDACC_VER__ is no longer supported.  Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."" is not valid in preprocessor expressions
 #define __CUDACC_VER__ "__CUDACC_VER__ is no longer supported.  Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."
                        ^
CMake Error at cuda_compile_1_generated_math_functions.cu.o.Release.cmake:222 (message):
  Error generating
  /home/groot/caffe/build/src/caffe/CMakeFiles/cuda_compile_1.dir/util/./cuda_compile_1_generated_math_functions.cu.o


src/caffe/CMakeFiles/caffe.dir/build.make:490: recipe for target 'src/caffe/CMakeFiles/cuda_compile_1.dir/util/cuda_compile_1_generated_math_functions.cu.o' failed
make[2]: *** [src/caffe/CMakeFiles/cuda_compile_1.dir/util/cuda_compile_1_generated_math_functions.cu.o] Error 1
CMakeFiles/Makefile2:267: recipe for target 'src/caffe/CMakeFiles/caffe.dir/all' failed
make[1]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

Tried solutions

I tried chaning CUDA_USE_STATIC_CUDA_RUNTIME to OFF in the ccmake gui but it always turns back to ON.

System configuration

  • Operating system: Ubuntu 17.10
  • Compiler: cmake
  • CUDA version (if applicable): 9.2
  • CUDNN version (if applicable): 7.1.4
@mineo210

This comment has been minimized.

Copy link
Author

mineo210 commented Jul 17, 2018

I fixed this by doing what they actually tell me in the error message which i did not see before /usr/local/cuda-9.2/include/crt/common_functions.h:64:24: error: token ""__CUDACC_VER__ is no longer supported. Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."
but now ive come accros a new one,

[ 87%] Linking CXX shared library ../../lib/libcaffe.so
[ 87%] Built target caffe
Scanning dependencies of target upgrade_solver_proto_text
[ 87%] Building CXX object tools/CMakeFiles/upgrade_solver_proto_text.dir/upgrade_solver_proto_text.cpp.o
[ 88%] Linking CXX executable upgrade_solver_proto_text
/usr/bin/ld: warning: libpng12.so.0, needed by /home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0, not found (try using -rpath or -rpath-link)
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_interlace_handling@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_create_write_struct@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_write_end@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_bgr@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_compression_level@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_get_IHDR@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_get_tRNS@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_read_image@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_palette_to_rgb@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_write_image@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_read_end@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_write_info@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_read_update_info@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_compression_strategy@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_write_fn@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_filter@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_strip_16@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_packing@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_create_info_struct@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_get_io_ptr@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_expand_gray_1_2_4_to_8@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_destroy_write_struct@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_strip_alpha@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_destroy_read_struct@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_create_read_struct@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_read_fn@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_init_io@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_error@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_swap@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_rgb_to_gray@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_tRNS_to_alpha@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_gray_to_rgb@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_IHDR@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_read_info@PNG12_0'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/upgrade_solver_proto_text.dir/build.make:135: recipe for target 'tools/upgrade_solver_proto_text' failed
make[2]: *** [tools/upgrade_solver_proto_text] Error 1
CMakeFiles/Makefile2:457: recipe for target 'tools/CMakeFiles/upgrade_solver_proto_text.dir/all' failed
make[1]: *** [tools/CMakeFiles/upgrade_solver_proto_text.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

any clues?

@homersimpson666666

This comment has been minimized.

Copy link

homersimpson666666 commented Jul 20, 2018

hi, i'm having similar problems w protobuf and opencv. i'm using ubuntu. i had been following instructions here https://yangcha.github.io/Caffe-Conda/ which told me to install opencv w conda.

however i also read something on the net about the 'make all' instruction preferring to look in base libraries (ie those in /usr/lib/...) instead of conda installations. seems like your makefile is configured to look at conda libraaries...i'd suggest uninstalling the conda version and making sure they are installed w sudo apt-get install opencv etc - sorry i don't have the exact package names at the moment..but i'll let you know if i get any further! seems like anything vaguely related to protobuf /opencv needs to have only ONE instance on your machine - that is, if you have a pip or brew or conda installation, make will fail for caffe...i'd check for duplicates

@rambozzz

This comment has been minimized.

Copy link

rambozzz commented Jan 22, 2019

I fixed this by doing what they actually tell me in the error message which i did not see before /usr/local/cuda-9.2/include/crt/common_functions.h:64:24: error: token ""__CUDACC_VER__ is no longer supported. Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."
but now ive come accros a new one,

[ 87%] Linking CXX shared library ../../lib/libcaffe.so
[ 87%] Built target caffe
Scanning dependencies of target upgrade_solver_proto_text
[ 87%] Building CXX object tools/CMakeFiles/upgrade_solver_proto_text.dir/upgrade_solver_proto_text.cpp.o
[ 88%] Linking CXX executable upgrade_solver_proto_text
/usr/bin/ld: warning: libpng12.so.0, needed by /home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0, not found (try using -rpath or -rpath-link)
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_interlace_handling@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_create_write_struct@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_write_end@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_bgr@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_compression_level@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_get_IHDR@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_get_tRNS@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_read_image@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_palette_to_rgb@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_write_image@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_read_end@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_write_info@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_read_update_info@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_compression_strategy@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_write_fn@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_filter@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_strip_16@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_packing@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_create_info_struct@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_get_io_ptr@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_expand_gray_1_2_4_to_8@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_destroy_write_struct@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_strip_alpha@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_destroy_read_struct@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_create_read_struct@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_read_fn@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_init_io@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_error@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_swap@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_rgb_to_gray@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_tRNS_to_alpha@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_gray_to_rgb@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_set_IHDR@PNG12_0'
/home/groot/anaconda2/envs/caffe/lib/libopencv_imgcodecs.so.3.2.0: undefined reference to `png_read_info@PNG12_0'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/upgrade_solver_proto_text.dir/build.make:135: recipe for target 'tools/upgrade_solver_proto_text' failed
make[2]: *** [tools/upgrade_solver_proto_text] Error 1
CMakeFiles/Makefile2:457: recipe for target 'tools/CMakeFiles/upgrade_solver_proto_text.dir/all' failed
make[1]: *** [tools/CMakeFiles/upgrade_solver_proto_text.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

any clues?

Hi, did you manage to solve this issue then? I'm having the same problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment