BVLC / caffe

Caffe: a fast open framework for deep learning.
http://caffe.berkeleyvision.org/
Other
34.12k stars 18.69k forks source link

fail to build under ubuntu 15.10 #3259

Open tommy87 opened 9 years ago

tommy87 commented 9 years ago

i'm unable to build caffe unter ubuntu 15.10. I had no problems with previous versions of ubuntu and i tried to build caffe version 0.13, 0.14 and the master branch...

for building a have disabled CUDNN and also tried to disable CNMEM and build_python

build log:

[  0%] Running C++/Python protocol buffer compiler on /usr/local/etc/caffe-0.13/src/caffe/proto/caffe.proto
Scanning dependencies of target proto
[  1%] Building CXX object src/caffe/CMakeFiles/proto.dir/**/**/include/caffe/proto/caffe.pb.cc.o
Linking CXX static library ../../lib/libproto.a
[  1%] Built target proto
[  1%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_im2col_layer.cu.o
[  2%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_inner_product_layer.cu.o
[  2%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_relu_layer.cu.o
[  4%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_cudnn_lcn_layer.cu.o
[  4%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_softmax_loss_layer.cu.o
^Csrc/caffe/CMakeFiles/caffe.dir/build.make:2071: recipe for target 'src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_softmax_loss_layer.cu.o' failed
make[2]: **\* [src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_softmax_loss_layer.cu.o] Interrupt
CMakeFiles/Makefile2:187: recipe for target 'src/caffe/CMakeFiles/caffe.dir/all' failed
make[1]: **\* [src/caffe/CMakeFiles/caffe.dir/all] Interrupt
Makefile:116: recipe for target 'all' failed
make: **\* [all] Interrupt
mag@mag-raven:/usr/local/etc/build_caffe-0.13$ sudo make
[  1%] Built target proto
[  1%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_softmax_loss_layer.cu.o
[  2%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_euclidean_loss_layer.cu.o
[  2%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_slice_layer.cu.o
[  4%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_dropout_layer.cu.o
[  4%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_lrn_layer.cu.o
[  5%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_bnll_layer.cu.o
[  5%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_silence_layer.cu.o
[  7%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_softmax_layer.cu.o
[  7%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_base_data_layer.cu.o
[  8%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_exp_layer.cu.o
[  8%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_split_layer.cu.o
[ 10%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_cudnn_pooling_layer.cu.o
[ 10%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_hdf5_output_layer.cu.o
[ 11%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_absval_layer.cu.o
[ 12%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_cudnn_conv_layer.cu.o
[ 12%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_cudnn_softmax_layer.cu.o
[ 14%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_contrastive_loss_layer.cu.o
[ 14%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_prelu_layer.cu.o
[ 15%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_cudnn_sigmoid_layer.cu.o
[ 15%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_cudnn_tanh_layer.cu.o
[ 17%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_sigmoid_layer.cu.o
[ 17%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_sigmoid_cross_entropy_loss_layer.cu.o
[ 18%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_concat_layer.cu.o
[ 18%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_eltwise_layer.cu.o
[ 20%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_pooling_layer.cu.o
[ 20%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_mvn_layer.cu.o
[ 21%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_cudnn_lrn_layer.cu.o
[ 21%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_threshold_layer.cu.o
[ 22%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_cudnn_relu_layer.cu.o
[ 22%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_tanh_layer.cu.o
[ 24%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_power_layer.cu.o
[ 25%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_deconv_layer.cu.o
[ 25%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_hdf5_data_layer.cu.o
[ 27%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_conv_layer.cu.o
[ 27%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/util/cuda_compile_generated_math_functions.cu.o
[ 28%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/util/cuda_compile_generated_im2col.cu.o
Scanning dependencies of target caffe
[ 30%] Building CXX object src/caffe/CMakeFiles/caffe.dir/common.cpp.o
[ 30%] Building CXX object src/caffe/CMakeFiles/caffe.dir/internal_thread.cpp.o
[ 31%] Building CXX object src/caffe/CMakeFiles/caffe.dir/data_reader.cpp.o
[ 31%] Building CXX object src/caffe/CMakeFiles/caffe.dir/blob.cpp.o
[ 32%] Building CXX object src/caffe/CMakeFiles/caffe.dir/net.cpp.o
[ 32%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/cudnn_softmax_layer.cpp.o
[ 34%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/threshold_layer.cpp.o
[ 34%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/bnll_layer.cpp.o
[ 35%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/window_data_layer.cpp.o
[ 35%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/memory_data_layer.cpp.o
[ 37%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/cudnn_relu_layer.cpp.o
[ 38%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/neuron_layer.cpp.o
[ 38%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/relu_layer.cpp.o
[ 40%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/split_layer.cpp.o
[ 40%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/base_data_layer.cpp.o
[ 41%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/data_layer.cpp.o
[ 41%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/power_layer.cpp.o
[ 42%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/absval_layer.cpp.o
[ 42%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/im2col_layer.cpp.o
[ 44%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/cudnn_conv_layer.cpp.o
[ 44%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/argmax_layer.cpp.o
[ 45%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/contrastive_loss_layer.cpp.o
[ 45%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/cudnn_pooling_layer.cpp.o
[ 47%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/prelu_layer.cpp.o
[ 47%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/multinomial_logistic_loss_layer.cpp.o
[ 48%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/exp_layer.cpp.o
[ 48%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/spp_layer.cpp.o
[ 50%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/dummy_data_layer.cpp.o
[ 51%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/eltwise_layer.cpp.o
[ 51%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/softmax_layer.cpp.o
[ 52%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/base_conv_layer.cpp.o
[ 52%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/deconv_layer.cpp.o
[ 54%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/lrn_layer.cpp.o
[ 54%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/infogain_loss_layer.cpp.o
[ 55%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/cudnn_lcn_layer.cpp.o
[ 55%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/cudnn_lrn_layer.cpp.o
[ 57%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/cudnn_sigmoid_layer.cpp.o
[ 57%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/hdf5_data_layer.cpp.o
[ 58%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/flatten_layer.cpp.o
[ 58%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/accuracy_layer.cpp.o
[ 60%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/loss_layer.cpp.o
[ 60%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/pooling_layer.cpp.o
[ 61%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/sigmoid_cross_entropy_loss_layer.cpp.o
[ 61%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/tanh_layer.cpp.o
[ 62%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/silence_layer.cpp.o
[ 64%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/softmax_loss_layer.cpp.o
[ 64%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/euclidean_loss_layer.cpp.o
[ 65%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/conv_layer.cpp.o
[ 65%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/concat_layer.cpp.o
[ 67%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/inner_product_layer.cpp.o
[ 67%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/slice_layer.cpp.o
[ 68%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/image_data_layer.cpp.o
[ 68%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/hdf5_output_layer.cpp.o
[ 70%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/mvn_layer.cpp.o
[ 70%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/hinge_loss_layer.cpp.o
[ 71%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/sigmoid_layer.cpp.o
[ 71%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/reshape_layer.cpp.o
[ 72%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/dropout_layer.cpp.o
[ 72%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/cudnn_tanh_layer.cpp.o
[ 74%] Building CXX object src/caffe/CMakeFiles/caffe.dir/syncedmem.cpp.o
[ 74%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layer_factory.cpp.o
[ 75%] Building CXX object src/caffe/CMakeFiles/caffe.dir/parallel.cpp.o
[ 77%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/upgrade_proto.cpp.o
[ 77%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/db.cpp.o
[ 78%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/math_functions.cpp.o
[ 78%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/io.cpp.o
[ 80%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/cudnn.cpp.o
[ 80%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/benchmark.cpp.o
[ 81%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/blocking_queue.cpp.o
[ 81%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/im2col.cpp.o
[ 82%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/insert_splits.cpp.o
[ 82%] Building CXX object src/caffe/CMakeFiles/caffe.dir/solver.cpp.o
[ 84%] Building CXX object src/caffe/CMakeFiles/caffe.dir/data_transformer.cpp.o
Linking CXX shared library ../../lib/libcaffe-nv.so
[ 87%] Built target caffe
Scanning dependencies of target caffe.bin
[ 87%] Building CXX object tools/CMakeFiles/caffe.bin.dir/caffe.cpp.o
Linking CXX executable caffe
../lib/libcaffe-nv.so.0.13.2: undefined reference to `caffe::BlockingQueue<caffe::Batch<double>*>::pop(std::string const&)'
../lib/libcaffe-nv.so.0.13.2: undefined reference to`google::base::CheckOpMessageBuilder::NewString()'
../lib/libcaffe-nv.so.0.13.2: undefined reference to `caffe::BlockingQueuecaffe::Batch<float_>::pop(std::string const&)'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/caffe.bin.dir/build.make:120: recipe for target 'tools/caffe-0.13.2' failed
make[2]: *_\* [tools/caffe-0.13.2] Error 1
CMakeFiles/Makefile2:373: recipe for target 'tools/CMakeFiles/caffe.bin.dir/all' failed
make[1]: **\* [tools/CMakeFiles/caffe.bin.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
make: **\* [all] Error 2
xiaowei-hu commented 9 years ago

i had the same problem

tommy87 commented 9 years ago

After some investigations i figured out, that it was a problem of the new GCC version. Most of the libs are now comiled against GCC 5 but CUDA with GCC > 4.9 is not supported.

One workaround is to get the latest CUDA version (>= 7.5) edit the CUDA header (i forget the name of the header...) and replace the GCC error line with a warning or remove it complitly. After that CUDA can be comilied against GCC 5.

But i get runtime errors....im not sure if its because of a wrong driver or of the GCC 5 version of CUDA....but for stability im now using Ubunut 14.04

Edit: its in line 113 in /usr/local/cuda/include/host_config.h

kangyong commented 9 years ago

fail to build under ubuntu 15.10....

[  1%] Built target proto
.......
[ 80%] Built target caffe
Linking CXX executable caffe
CMakeFiles/caffe.bin.dir/caffe.cpp.o: In function `main':
caffe.cpp:(.text.startup+0x108): undefined reference to`google::SetUsageMessage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/caffe.bin.dir/caffe.cpp.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >* google::MakeCheckOpString<int, int>(int const&, int const&, char const*)':
caffe.cpp:(.text._ZN6google17MakeCheckOpStringIiiEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIiiEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc]+0x50): undefined reference to`google::base::CheckOpMessageBuilder::NewString[abi:cxx11]()'
CMakeFiles/caffe.bin.dir/caffe.cpp.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >* google::MakeCheckOpString<unsigned long, int>(unsigned long const&, int const&, char const*)':
caffe.cpp:(.text._ZN6google17MakeCheckOpStringImiEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc[_ZN6google17MakeCheckOpStringImiEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc]+0x50): undefined reference to`google::base::CheckOpMessageBuilder::NewString[abi:cxx11]()'
CMakeFiles/caffe.bin.dir/caffe.cpp.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >* google::MakeCheckOpString<int, float>(int const&, float const&, char const*)':
caffe.cpp:(.text._ZN6google17MakeCheckOpStringIifEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIifEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc]+0x56): undefined reference to`google::base::CheckOpMessageBuilder::NewString[abi:cxx11]()'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/caffe.bin.dir/build.make:115: recipe for target 'tools/caffe' failed
make[2]: **\* [tools/caffe] Error 1
CMakeFiles/Makefile2:373: recipe for target 'tools/CMakeFiles/caffe.bin.dir/all' failed
make[1]: **\* [tools/CMakeFiles/caffe.bin.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
make: **\* [all] Error 2
hogwild commented 9 years ago

I have the same problem

hogwild commented 9 years ago

There is one possible solution from the following link: https://groups.google.com/forum/#!msg/caffe-users/a6TDx89IByY/49ZD6rtyCwAJ

tommy87 commented 9 years ago

Thats exactly what i wrote further up. But to make it easier to find, the part which must be edited is in line 113 in /usr/local/cuda/include/host_config.h

juliebernauer commented 8 years ago

An additional step is required. One has to force GCC to use the old ABI (see https://gcc.gnu.org/gcc-5/changes.html#libstdcxx for details) with the flag -D_GLIBCXX_USE_CXX11_ABI=0 in the Makefile.

samuelcolvin commented 8 years ago

Having the same problem. Is there a reasonable work around for this. Eg. does altering line 113 of host_config.h really fix the problem or does it cause runtime errors?

@juliebernauer is the additional setup you refer to a work around in itself or is it in addition to editing host_config.h?

Would be great if the was a proper fix so caffe could be installed on the latest version of ubuntu.

juliebernauer commented 8 years ago

The line 113 change is needed for CUDA 7.5 to work with GCC5.x since this is an unsupported compiler -> this is needed to compile (first message). The additional step I mentioned is needed too in addition to editing host_config.h so as to be able to link (i.e. have a caffe executable), this is due to a change in C++ -> this is needed for linking (fixing the issue described in kangyong commented on Nov 5, 2015)

Once that is done, caffe runs with CUDA and cuDNN. This also works on Debian stretch.

PapaMadeleine2022 commented 6 years ago

@juliebernauer but how to add the flag -D_GLIBCXX_USE_CXX11_ABI=0 in the Makefile?