转载:https://blog.csdn.net/thesby/article/details/50512886

 

编译caffe-master时遇到的问题,__float128未定义,使用到cuda版本为7.5.18,boost为1.60,gcc为4.8,opencv为3.1,操作系统为ubuntu14.04,报错如下:

/usr/local/include/boost/config/suffix.hpp(510): error: identifier "__float128" is undefined

1 error detected in the compilation of "/tmp/tmpxft_00003571_00000000-16_threshold_layer.compute_50.cpp1.ii".
make: *** [.build_release/cuda/src/caffe/layers/threshold_layer.o] Error 1
make: *** Waiting for unfinished jobs....
/usr/local/include/boost/config/suffix.hpp(510): error: identifier "__float128" is undefined

1 error detected in the compilation of "/tmp/tmpxft_00003578_00000000-16_batch_reindex_layer.compute_50.cpp1.ii".
make: *** [.build_release/cuda/src/caffe/layers/batch_reindex_layer.o] Error 1
/usr/local/include/boost/config/suffix.hpp(510): error: identifier "__float128" is undefined

1 error detected in the compilation of "/tmp/tmpxft_0000357f_00000000-16_reduction_layer.compute_50.cpp1.ii".
make: *** [.build_release/cuda/src/caffe/layers/reduction_layer.o] Error 1
/usr/local/include/boost/config/suffix.hpp(510): error: identifier "__float128" is undefined

1 error detected in the compilation of "/tmp/tmpxft_00003588_00000000-16_softmax_layer.compute_50.cpp1.ii".
make: *** [.build_release/cuda/src/caffe/layers/softmax_layer.o] Error 1

 

问题在于boost到gcc.h头文件定义存在bug。解决方法就是:

sudo gedit /usr/local/include/boost/config/compiler/gcc.hpp
1
把第156行到内容由

#if defined(_GLIBCXX_USE_FLOAT128) && !defined(__STRICT_ANSI__)
1
修改为:

#if defined(_GLIBCXX_USE_FLOAT128) && !defined(__STRICT_ANSI__) && !defined(__CUDACC__)
---------------------