Ubuntu18.04或gcc7 安装caffe报错的解决方法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/geng333abc/article/details/80151937

Ubuntu18.04或gcc7 报错的解决方法

近来Ubuntu 发布了18.04版本,界面变化很打意识手贱就更新了上去。然后编译的时候先是报告了GCC版本过高,好吧,那安装低版本。在ubuntu18.04里好像只有gcc4.8可以使用于是使用命令sudo apt-get install gcc-4.8进行安装。
然后看看系统中有多少的gcc版本。

ls /usr/bin/gcc*

使用如下命令对数据添加到系统环境自动切换的工具里面

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70

操作完了就可以那个命令进行配置

sudo update-alternatives --config gcc

切换到了gcc4.8以了一下显示后发现在使用NVCC的时候显示了以下一堆的问题!!

PROTOC src/caffe/proto/caffe.proto
NVCC src/caffe/util/math_functions.cu
NVCC src/caffe/util/im2col.cu
NVCC src/caffe/layers/crop_layer.cu
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
NVCC src/caffe/layers/cudnn_conv_layer.cu
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
/usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h(444): error: identifier "nullptr" is undefined

/usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h(444): error: expected a ";"

/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h(235): error: expected a ";"

/usr/include/c++/7/bits/exception.h(63): error: expected a ";"

/usr/include/c++/7/bits/exception.h(69): error: expected a ";"

/usr/include/c++/7/exception(49): error: expected a ";"

/usr/include/c++/7/exception(57): error: expected a ";"

/usr/include/c++/7/exception(67): error: expected a "{"

/usr/include/c++/7/bits/cxxabi_init_exception.h(63): error: expected a "{"

/usr/include/c++/7/typeinfo(99): error: expected a ";"

/usr/include/c++/7/typeinfo(187): error: not a class or struct name

/usr/include/c++/7/typeinfo(190): error: expected a ";"

/usr/include/c++/7/typeinfo(197): error: expected a ";"

/usr/include/c++/7/typeinfo(204): error: not a class or struct name

/usr/include/c++/7/typeinfo(207): error: expected a ";"

/usr/include/c++/7/typeinfo(214): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(63): error: function "__cxxabiv1::std::current_exception" returns incomplete type "__cxxabiv1::std::__exception_ptr::exception_ptr"

/usr/include/c++/7/bits/exception_ptr.h(63): error: expected a "{"

/usr/include/c++/7/bits/exception_ptr.h(73): error: namespace "__cxxabiv1::std" has no member "rethrow_exception"

/usr/include/c++/7/bits/exception_ptr.h(83): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(85): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(86): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(88): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(90): error: declaration is incompatible with previous "__cxxabiv1::std::current_exception"
(63): here

/usr/include/c++/7/bits/exception_ptr.h(90): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(90): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(91): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(93): error: namespace "__cxxabiv1::std" has no member "make_exception_ptr"

/usr/include/c++/7/bits/exception_ptr.h(93): error: a template friend declaration cannot be declared in a local class

/usr/include/c++/7/bits/exception_ptr.h(93): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(96): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(98): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(101): error: incomplete type is not allowed

/usr/include/c++/7/bits/exception_ptr.h(101): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(122): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(132): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(149): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(150): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(153): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(158): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(159): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(162): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(163): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(166): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(167): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(179): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(214): error: expected a ";"

/usr/include/c++/7/bits/move.h(46): error: identifier "constexpr" is undefined

/usr/include/c++/7/bits/move.h(46): error: "_Tp" is not a function or static data member

/usr/include/c++/7/bits/move.h(51): error: expected a ";"

/usr/include/c++/7/type_traits(71): error: identifier "constexpr" is undefined

/usr/include/c++/7/type_traits(71): error: template parameter "_Tp" may not be redeclared in this scope

/usr/include/c++/7/type_traits(71): error: expected a ";"

/usr/include/c++/7/type_traits(72): error: member "__cxxabiv1::std::integral_constant<_Tp, __v>::_Tp" is not a type name

/usr/include/c++/7/type_traits(73): error: member "__cxxabiv1::std::integral_constant<_Tp, __v>::_Tp" is not a type name

/usr/include/c++/7/type_traits(74): error: identifier "constexpr" is undefined

/usr/include/c++/7/type_traits(74): error: expected a ";"

/usr/include/c++/7/type_traits(84): error: identifier "constexpr" is undefined

/usr/include/c++/7/type_traits(84): error: "_Tp" is not a function or static data member

/usr/include/c++/7/type_traits(93): error: expected a declaration

/usr/include/c++/7/type_traits(93): error: expected a ";"

/usr/include/c++/7/type_traits(126): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(154): error: __bool_constant is not a template

/usr/include/c++/7/type_traits(154): error: not a class or struct name

/usr/include/c++/7/type_traits(245): error: identifier "char16_t" is undefined

/usr/include/c++/7/type_traits(249): error: identifier "char32_t" is undefined

/usr/include/c++/7/type_traits(249): error: class "__cxxabiv1::std::__is_integral_helper<<error-type>>" has already been defined

/usr/include/c++/7/type_traits(362): error: namespace "__cxxabiv1::std" has no member "size_t"

/usr/include/c++/7/type_traits(463): error: expected a ">"

/usr/include/c++/7/type_traits(467): error: expected a ">"

/usr/include/c++/7/type_traits(475): error: expected a ">"

/usr/include/c++/7/type_traits(479): error: expected a ">"

/usr/include/c++/7/type_traits(487): error: expected a ">"

/usr/include/c++/7/type_traits(491): error: expected a ">"

/usr/include/c++/7/type_traits(499): error: expected a ">"

/usr/include/c++/7/type_traits(503): error: expected a ">"

/usr/include/c++/7/type_traits(511): error: expected a ">"

/usr/include/c++/7/type_traits(515): error: expected a ">"

/usr/include/c++/7/type_traits(523): error: expected a ">"

/usr/include/c++/7/type_traits(527): error: expected a ">"

/usr/include/c++/7/type_traits(535): error: expected a ">"

/usr/include/c++/7/type_traits(539): error: expected a ">"

/usr/include/c++/7/type_traits(547): error: expected a ">"

/usr/include/c++/7/type_traits(551): error: expected a ">"

/usr/include/c++/7/type_traits(561): error: namespace "__cxxabiv1::std" has no member "nullptr_t"

/usr/include/c++/7/type_traits(582): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(588): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(595): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(602): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(612): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(638): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(748): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(762): error: expected a ";"

/usr/include/c++/7/type_traits(777): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(787): error: expected a ")"

/usr/include/c++/7/type_traits(798): error: an explicit template argument list is not allowed on this declaration

/usr/include/c++/7/type_traits(798): error: expected a type specifier

/usr/include/c++/7/type_traits(798): error: function returning function is not allowed

/usr/include/c++/7/type_traits(798): error: expected a ";"

/usr/include/c++/7/type_traits(804): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

Error limit reached.
100 errors detected in the compilation of "/tmp/tmpxft_000018a2_00000000-19_cudnn_conv_layer.compute_61.cpp1.ii".
Compilation terminated.
Makefile:595: recipe for target '.build_release/cuda/src/caffe/layers/cudnn_conv_layer.o' failed
make: *** [.build_release/cuda/src/caffe/layers/cudnn_conv_layer.o] Error 1
make: *** 正在等待未完成的任务....
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
/usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h(444): error: identifier "nullptr" is undefined

/usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h(444): error: expected a ";"

/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h(235): error: expected a ";"

/usr/include/c++/7/bits/exception.h(63): error: expected a ";"

/usr/include/c++/7/bits/exception.h(69): error: expected a ";"

/usr/include/c++/7/exception(49): error: expected a ";"

/usr/include/c++/7/exception(57): error: expected a ";"

/usr/include/c++/7/exception(67): error: expected a "{"

/usr/include/c++/7/bits/cxxabi_init_exception.h(63): error: expected a "{"

/usr/include/c++/7/typeinfo(99): error: expected a ";"

/usr/include/c++/7/typeinfo(187): error: not a class or struct name

/usr/include/c++/7/typeinfo(190): error: expected a ";"

/usr/include/c++/7/typeinfo(197): error: expected a ";"

/usr/include/c++/7/typeinfo(204): error: not a class or struct name

/usr/include/c++/7/typeinfo(207): error: expected a ";"

/usr/include/c++/7/typeinfo(214): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(63): error: function "__cxxabiv1::std::current_exception" returns incomplete type "__cxxabiv1::std::__exception_ptr::exception_ptr"

/usr/include/c++/7/bits/exception_ptr.h(63): error: expected a "{"

/usr/include/c++/7/bits/exception_ptr.h(73): error: namespace "__cxxabiv1::std" has no member "rethrow_exception"

/usr/include/c++/7/bits/exception_ptr.h(83): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(85): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(86): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(88): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(90): error: declaration is incompatible with previous "__cxxabiv1::std::current_exception"
(63): here

/usr/include/c++/7/bits/exception_ptr.h(90): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(90): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(91): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(93): error: namespace "__cxxabiv1::std" has no member "make_exception_ptr"

/usr/include/c++/7/bits/exception_ptr.h(93): error: a template friend declaration cannot be declared in a local class

/usr/include/c++/7/bits/exception_ptr.h(93): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(96): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(98): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(101): error: incomplete type is not allowed

/usr/include/c++/7/bits/exception_ptr.h(101): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(122): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(132): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(149): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(150): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(153): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(158): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(159): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(162): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(163): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(166): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(167): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(179): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(214): error: expected a ";"

/usr/include/c++/7/bits/move.h(46): error: identifier "constexpr" is undefined

/usr/include/c++/7/bits/move.h(46): error: "_Tp" is not a function or static data member

/usr/include/c++/7/bits/move.h(51): error: expected a ";"

/usr/include/c++/7/type_traits(71): error: identifier "constexpr" is undefined

/usr/include/c++/7/type_traits(71): error: template parameter "_Tp" may not be redeclared in this scope

/usr/include/c++/7/type_traits(71): error: expected a ";"

/usr/include/c++/7/type_traits(72): error: member "__cxxabiv1::std::integral_constant<_Tp, __v>::_Tp" is not a type name

/usr/include/c++/7/type_traits(73): error: member "__cxxabiv1::std::integral_constant<_Tp, __v>::_Tp" is not a type name

/usr/include/c++/7/type_traits(74): error: identifier "constexpr" is undefined

/usr/include/c++/7/type_traits(74): error: expected a ";"

/usr/include/c++/7/type_traits(84): error: identifier "constexpr" is undefined

/usr/include/c++/7/type_traits(84): error: "_Tp" is not a function or static data member

/usr/include/c++/7/type_traits(93): error: expected a declaration

/usr/include/c++/7/type_traits(93): error: expected a ";"

/usr/include/c++/7/type_traits(126): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(154): error: __bool_constant is not a template

/usr/include/c++/7/type_traits(154): error: not a class or struct name

/usr/include/c++/7/type_traits(245): error: identifier "char16_t" is undefined

/usr/include/c++/7/type_traits(249): error: identifier "char32_t" is undefined

/usr/include/c++/7/type_traits(249): error: class "__cxxabiv1::std::__is_integral_helper<<error-type>>" has already been defined

/usr/include/c++/7/type_traits(362): error: namespace "__cxxabiv1::std" has no member "size_t"

/usr/include/c++/7/type_traits(463): error: expected a ">"

/usr/include/c++/7/type_traits(467): error: expected a ">"

/usr/include/c++/7/type_traits(475): error: expected a ">"

/usr/include/c++/7/type_traits(479): error: expected a ">"

/usr/include/c++/7/type_traits(487): error: expected a ">"

/usr/include/c++/7/type_traits(491): error: expected a ">"

/usr/include/c++/7/type_traits(499): error: expected a ">"

/usr/include/c++/7/type_traits(503): error: expected a ">"

/usr/include/c++/7/type_traits(511): error: expected a ">"

/usr/include/c++/7/type_traits(515): error: expected a ">"

/usr/include/c++/7/type_traits(523): error: expected a ">"

/usr/include/c++/7/type_traits(527): error: expected a ">"

/usr/include/c++/7/type_traits(535): error: expected a ">"

/usr/include/c++/7/type_traits(539): error: expected a ">"

/usr/include/c++/7/type_traits(547): error: expected a ">"

/usr/include/c++/7/type_traits(551): error: expected a ">"

/usr/include/c++/7/type_traits(561): error: namespace "__cxxabiv1::std" has no member "nullptr_t"

/usr/include/c++/7/type_traits(582): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(588): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(595): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(602): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(612): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(638): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(748): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(762): error: expected a ";"

/usr/include/c++/7/type_traits(777): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(787): error: expected a ")"

/usr/include/c++/7/type_traits(798): error: an explicit template argument list is not allowed on this declaration

/usr/include/c++/7/type_traits(798): error: expected a type specifier

/usr/include/c++/7/type_traits(798): error: function returning function is not allowed

/usr/include/c++/7/type_traits(798): error: expected a ";"

/usr/include/c++/7/type_traits(804): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

Error limit reached.
100 errors detected in the compilation of "/tmp/tmpxft_000018d1_00000000-19_im2col.compute_61.cpp1.ii".
Compilation terminated.
Makefile:595: recipe for target '.build_release/cuda/src/caffe/util/im2col.o' failed
make: *** [.build_release/cuda/src/caffe/util/im2col.o] Error 1
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
/usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h(444): error: identifier "nullptr" is undefined

/usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h(444): error: expected a ";"

/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h(235): error: expected a ";"

/usr/include/c++/7/bits/exception.h(63): error: expected a ";"

/usr/include/c++/7/bits/exception.h(69): error: expected a ";"

/usr/include/c++/7/exception(49): error: expected a ";"

/usr/include/c++/7/exception(57): error: expected a ";"

/usr/include/c++/7/exception(67): error: expected a "{"

/usr/include/c++/7/bits/cxxabi_init_exception.h(63): error: expected a "{"

/usr/include/c++/7/typeinfo(99): error: expected a ";"

/usr/include/c++/7/typeinfo(187): error: not a class or struct name

/usr/include/c++/7/typeinfo(190): error: expected a ";"

/usr/include/c++/7/typeinfo(197): error: expected a ";"

/usr/include/c++/7/typeinfo(204): error: not a class or struct name

/usr/include/c++/7/typeinfo(207): error: expected a ";"

/usr/include/c++/7/typeinfo(214): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(63): error: function "__cxxabiv1::std::current_exception" returns incomplete type "__cxxabiv1::std::__exception_ptr::exception_ptr"

/usr/include/c++/7/bits/exception_ptr.h(63): error: expected a "{"

/usr/include/c++/7/bits/exception_ptr.h(73): error: namespace "__cxxabiv1::std" has no member "rethrow_exception"

/usr/include/c++/7/bits/exception_ptr.h(83): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(85): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(86): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(88): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(90): error: declaration is incompatible with previous "__cxxabiv1::std::current_exception"
(63): here

/usr/include/c++/7/bits/exception_ptr.h(90): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(90): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(91): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(93): error: namespace "__cxxabiv1::std" has no member "make_exception_ptr"

/usr/include/c++/7/bits/exception_ptr.h(93): error: a template friend declaration cannot be declared in a local class

/usr/include/c++/7/bits/exception_ptr.h(93): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(96): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(98): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(101): error: incomplete type is not allowed

/usr/include/c++/7/bits/exception_ptr.h(101): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(122): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(132): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(149): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(150): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(153): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(158): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(159): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(162): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(163): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(166): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(167): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(179): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(214): error: expected a ";"

/usr/include/c++/7/bits/move.h(46): error: identifier "constexpr" is undefined

/usr/include/c++/7/bits/move.h(46): error: "_Tp" is not a function or static data member

/usr/include/c++/7/bits/move.h(51): error: expected a ";"

/usr/include/c++/7/type_traits(71): error: identifier "constexpr" is undefined

/usr/include/c++/7/type_traits(71): error: template parameter "_Tp" may not be redeclared in this scope

/usr/include/c++/7/type_traits(71): error: expected a ";"

/usr/include/c++/7/type_traits(72): error: member "__cxxabiv1::std::integral_constant<_Tp, __v>::_Tp" is not a type name

/usr/include/c++/7/type_traits(73): error: member "__cxxabiv1::std::integral_constant<_Tp, __v>::_Tp" is not a type name

/usr/include/c++/7/type_traits(74): error: identifier "constexpr" is undefined

/usr/include/c++/7/type_traits(74): error: expected a ";"

/usr/include/c++/7/type_traits(84): error: identifier "constexpr" is undefined

/usr/include/c++/7/type_traits(84): error: "_Tp" is not a function or static data member

/usr/include/c++/7/type_traits(93): error: expected a declaration

/usr/include/c++/7/type_traits(93): error: expected a ";"

/usr/include/c++/7/type_traits(126): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(154): error: __bool_constant is not a template

/usr/include/c++/7/type_traits(154): error: not a class or struct name

/usr/include/c++/7/type_traits(245): error: identifier "char16_t" is undefined

/usr/include/c++/7/type_traits(249): error: identifier "char32_t" is undefined

/usr/include/c++/7/type_traits(249): error: class "__cxxabiv1::std::__is_integral_helper<<error-type>>" has already been defined

/usr/include/c++/7/type_traits(362): error: namespace "__cxxabiv1::std" has no member "size_t"

/usr/include/c++/7/type_traits(463): error: expected a ">"

/usr/include/c++/7/type_traits(467): error: expected a ">"

/usr/include/c++/7/type_traits(475): error: expected a ">"

/usr/include/c++/7/type_traits(479): error: expected a ">"

/usr/include/c++/7/type_traits(487): error: expected a ">"

/usr/include/c++/7/type_traits(491): error: expected a ">"

/usr/include/c++/7/type_traits(499): error: expected a ">"

/usr/include/c++/7/type_traits(503): error: expected a ">"

/usr/include/c++/7/type_traits(511): error: expected a ">"

/usr/include/c++/7/type_traits(515): error: expected a ">"

/usr/include/c++/7/type_traits(523): error: expected a ">"

/usr/include/c++/7/type_traits(527): error: expected a ">"

/usr/include/c++/7/type_traits(535): error: expected a ">"

/usr/include/c++/7/type_traits(539): error: expected a ">"

/usr/include/c++/7/type_traits(547): error: expected a ">"

/usr/include/c++/7/type_traits(551): error: expected a ">"

/usr/include/c++/7/type_traits(561): error: namespace "__cxxabiv1::std" has no member "nullptr_t"

/usr/include/c++/7/type_traits(582): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(588): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(595): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(602): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(612): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(638): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(748): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(762): error: expected a ";"

/usr/include/c++/7/type_traits(777): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(787): error: expected a ")"

/usr/include/c++/7/type_traits(798): error: an explicit template argument list is not allowed on this declaration

/usr/include/c++/7/type_traits(798): error: expected a type specifier

/usr/include/c++/7/type_traits(798): error: function returning function is not allowed

/usr/include/c++/7/type_traits(798): error: expected a ";"

/usr/include/c++/7/type_traits(804): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

Error limit reached.
100 errors detected in the compilation of "/tmp/tmpxft_000018e5_00000000-19_crop_layer.compute_61.cpp1.ii".
Compilation terminated.
Makefile:595: recipe for target '.build_release/cuda/src/caffe/layers/crop_layer.o' failed
make: *** [.build_release/cuda/src/caffe/layers/crop_layer.o] Error 1
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
/usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h(444): error: identifier "nullptr" is undefined

/usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h(444): error: expected a ";"

/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h(235): error: expected a ";"

/usr/include/c++/7/bits/exception.h(63): error: expected a ";"

/usr/include/c++/7/bits/exception.h(69): error: expected a ";"

/usr/include/c++/7/exception(49): error: expected a ";"

/usr/include/c++/7/exception(57): error: expected a ";"

/usr/include/c++/7/exception(67): error: expected a "{"

/usr/include/c++/7/bits/cxxabi_init_exception.h(63): error: expected a "{"

/usr/include/c++/7/typeinfo(99): error: expected a ";"

/usr/include/c++/7/typeinfo(187): error: not a class or struct name

/usr/include/c++/7/typeinfo(190): error: expected a ";"

/usr/include/c++/7/typeinfo(197): error: expected a ";"

/usr/include/c++/7/typeinfo(204): error: not a class or struct name

/usr/include/c++/7/typeinfo(207): error: expected a ";"

/usr/include/c++/7/typeinfo(214): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(63): error: function "__cxxabiv1::std::current_exception" returns incomplete type "__cxxabiv1::std::__exception_ptr::exception_ptr"

/usr/include/c++/7/bits/exception_ptr.h(63): error: expected a "{"

/usr/include/c++/7/bits/exception_ptr.h(73): error: namespace "__cxxabiv1::std" has no member "rethrow_exception"

/usr/include/c++/7/bits/exception_ptr.h(83): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(85): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(86): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(88): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(90): error: declaration is incompatible with previous "__cxxabiv1::std::current_exception"
(63): here

/usr/include/c++/7/bits/exception_ptr.h(90): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(90): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(91): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(93): error: namespace "__cxxabiv1::std" has no member "make_exception_ptr"

/usr/include/c++/7/bits/exception_ptr.h(93): error: a template friend declaration cannot be declared in a local class

/usr/include/c++/7/bits/exception_ptr.h(93): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(96): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(98): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(101): error: incomplete type is not allowed

/usr/include/c++/7/bits/exception_ptr.h(101): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(122): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(132): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(149): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(150): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(153): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(158): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(159): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(162): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(163): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(166): error: use of a local type to declare a function

/usr/include/c++/7/bits/exception_ptr.h(167): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(179): error: expected a ";"

/usr/include/c++/7/bits/exception_ptr.h(214): error: expected a ";"

/usr/include/c++/7/bits/move.h(46): error: identifier "constexpr" is undefined

/usr/include/c++/7/bits/move.h(46): error: "_Tp" is not a function or static data member

/usr/include/c++/7/bits/move.h(51): error: expected a ";"

/usr/include/c++/7/type_traits(71): error: identifier "constexpr" is undefined

/usr/include/c++/7/type_traits(71): error: template parameter "_Tp" may not be redeclared in this scope

/usr/include/c++/7/type_traits(71): error: expected a ";"

/usr/include/c++/7/type_traits(72): error: member "__cxxabiv1::std::integral_constant<_Tp, __v>::_Tp" is not a type name

/usr/include/c++/7/type_traits(73): error: member "__cxxabiv1::std::integral_constant<_Tp, __v>::_Tp" is not a type name

/usr/include/c++/7/type_traits(74): error: identifier "constexpr" is undefined

/usr/include/c++/7/type_traits(74): error: expected a ";"

/usr/include/c++/7/type_traits(84): error: identifier "constexpr" is undefined

/usr/include/c++/7/type_traits(84): error: "_Tp" is not a function or static data member

/usr/include/c++/7/type_traits(93): error: expected a declaration

/usr/include/c++/7/type_traits(93): error: expected a ";"

/usr/include/c++/7/type_traits(126): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(154): error: __bool_constant is not a template

/usr/include/c++/7/type_traits(154): error: not a class or struct name

/usr/include/c++/7/type_traits(245): error: identifier "char16_t" is undefined

/usr/include/c++/7/type_traits(249): error: identifier "char32_t" is undefined

/usr/include/c++/7/type_traits(249): error: class "__cxxabiv1::std::__is_integral_helper<<error-type>>" has already been defined

/usr/include/c++/7/type_traits(362): error: namespace "__cxxabiv1::std" has no member "size_t"

/usr/include/c++/7/type_traits(463): error: expected a ">"

/usr/include/c++/7/type_traits(467): error: expected a ">"

/usr/include/c++/7/type_traits(475): error: expected a ">"

/usr/include/c++/7/type_traits(479): error: expected a ">"

/usr/include/c++/7/type_traits(487): error: expected a ">"

/usr/include/c++/7/type_traits(491): error: expected a ">"

/usr/include/c++/7/type_traits(499): error: expected a ">"

/usr/include/c++/7/type_traits(503): error: expected a ">"

/usr/include/c++/7/type_traits(511): error: expected a ">"

/usr/include/c++/7/type_traits(515): error: expected a ">"

/usr/include/c++/7/type_traits(523): error: expected a ">"

/usr/include/c++/7/type_traits(527): error: expected a ">"

/usr/include/c++/7/type_traits(535): error: expected a ">"

/usr/include/c++/7/type_traits(539): error: expected a ">"

/usr/include/c++/7/type_traits(547): error: expected a ">"

/usr/include/c++/7/type_traits(551): error: expected a ">"

/usr/include/c++/7/type_traits(561): error: namespace "__cxxabiv1::std" has no member "nullptr_t"

/usr/include/c++/7/type_traits(582): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(588): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(595): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(602): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(612): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(638): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(748): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(762): error: expected a ";"

/usr/include/c++/7/type_traits(777): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

/usr/include/c++/7/type_traits(787): error: expected a ")"

/usr/include/c++/7/type_traits(798): error: an explicit template argument list is not allowed on this declaration

/usr/include/c++/7/type_traits(798): error: expected a type specifier

/usr/include/c++/7/type_traits(798): error: function returning function is not allowed

/usr/include/c++/7/type_traits(798): error: expected a ";"

/usr/include/c++/7/type_traits(804): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator)

Error limit reached.
100 errors detected in the compilation of "/tmp/tmpxft_000018ec_00000000-19_math_functions.compute_61.cpp1.ii".
Compilation terminated.
Makefile:595: recipe for target '.build_release/cuda/src/caffe/util/math_functions.o' failed
make: *** [.build_release/cuda/src/caffe/util/math_functions.o] Error 1

后来发现,MD! NVCC调用的是g++,这样的话,g++还是7版本呢!,改过来了就好了!

编译完了在最后出现了这个毛病:

CXX/LD -o .build_release/tools/extract_features.bin
CXX tools/upgrade_net_proto_text.cpp
CXX tools/compute_image_mean.cpp
CXX tools/upgrade_net_proto_binary.cpp
.build_release/tools/extract_features.o:在函数‘std::string* google::MakeCheckOpString<int, int>(int const&, int const&, char const*)’中:
extract_features.cpp:(.text._ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc]+0x43):对‘google::base::CheckOpMessageBuilder::NewString()’未定义的引用
.build_release/tools/extract_features.o:在函数‘std::string* google::MakeCheckOpString<unsigned long, unsigned long>(unsigned long const&, unsigned long const&, char const*)’中:
extract_features.cpp:(.text._ZN6google17MakeCheckOpStringImmEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringImmEEPSsRKT_RKT0_PKc]+0x44):对‘google::base::CheckOpMessageBuilder::NewString()’未定义的引用
.build_release/tools/extract_features.o:在函数‘int feature_extraction_pipeline<float>(int, char**)’中:
extract_features.cpp:(.text._Z27feature_extraction_pipelineIfEiiPPc[_Z27feature_extraction_pipelineIfEiiPPc]+0xfc):对‘caffe::Net<float>::Net(std::string const&, caffe::Phase, int, std::vector<std::string, std::allocator<std::string> > const*)’未定义的引用
extract_features.cpp:(.text._Z27feature_extraction_pipelineIfEiiPPc[_Z27feature_extraction_pipelineIfEiiPPc]+0x161):对‘caffe::Net<float>::CopyTrainedLayersFrom(std::string)’未定义的引用
extract_features.cpp:(.text._Z27feature_extraction_pipelineIfEiiPPc[_Z27feature_extraction_pipelineIfEiiPPc]+0x599):对‘caffe::Net<float>::has_blob(std::string const&) const’未定义的引用
extract_features.cpp:(.text._Z27feature_extraction_pipelineIfEiiPPc[_Z27feature_extraction_pipelineIfEiiPPc]+0x8a4):对‘caffe::db::GetDB(std::string const&)’未定义的引用
extract_features.cpp:(.text._Z27feature_extraction_pipelineIfEiiPPc[_Z27feature_extraction_pipelineIfEiiPPc]+0xb28):对‘caffe::Net<float>::blob_by_name(std::string const&) const’未定义的引用
extract_features.cpp:(.text._Z27feature_extraction_pipelineIfEiiPPc[_Z27feature_extraction_pipelineIfEiiPPc]+0xc41):对‘google::protobuf::internal::fixed_address_empty_string’未定义的引用
extract_features.cpp:(.text._Z27feature_extraction_pipelineIfEiiPPc[_Z27feature_extraction_pipelineIfEiiPPc]+0x1255):对‘google::protobuf::MessageLite::SerializeToString(std::string*) const’未定义的引用
.build_release/lib/libcaffe.so:对‘google::protobuf::internal::NameOfEnum(google::protobuf::EnumDescriptor const*, int)’未定义的引用
.build_release/lib/libcaffe.so:对‘caffe::BlockingQueue<caffe::Batch<double>*>::pop(std::string const&)’未定义的引用
.build_release/lib/libcaffe.so:对‘caffe::BlockingQueue<caffe::Batch<float>*>::pop(std::string const&)’未定义的引用
collect2: error: ld returned 1 exit status
Makefile:626: recipe for target '.build_release/tools/extract_features.bin' failed
make: *** [.build_release/tools/extract_features.bin] Error 1
make: *** 正在等待未完成的任务....

真是步步是坑啊!!!

make clean 
make -j4

没关系大侠我重新来过嘛!

但是神奇的又报了以下一堆错误:

make
CXX/LD -o .build_release/tools/extract_features.bin
.build_release/tools/extract_features.o:在函数‘std::string* google::MakeCheckOpString<int, int>(int const&, int const&, char const*)’中:
extract_features.cpp:(.text._ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc]+0x43):对‘google::base::CheckOpMessageBuilder::NewString()’未定义的引用
.build_release/tools/extract_features.o:在函数‘std::string* google::MakeCheckOpString<unsigned long, unsigned long>(unsigned long const&, unsigned long const&, char const*)’中:
extract_features.cpp:(.text._ZN6google17MakeCheckOpStringImmEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringImmEEPSsRKT_RKT0_PKc]+0x44):对‘google::base::CheckOpMessageBuilder::NewString()’未定义的引用
collect2: error: ld returned 1 exit status
Makefile:626: recipe for target '.build_release/tools/extract_features.bin' failed
make: *** [.build_release/tools/extract_features.bin] Error 1

这个后来才发现apt-get 安装的glog、gflag、leveldb都不行啊!
必须要下载源代码编译安装!
先要卸载以下的包,不然编译的不能被找到!

sudo apt-get remove libgflags-dev
sudo apt-get remove libgoogle-glog-dev
sudo apt-get remove libleveldb-dev 

然后

# glog
wget https://github.com/google/glog/archive/v0.3.3.tar.gz
tar zxvf v0.3.3.tar.gz
cd glog-0.3.3
./configure
make && make install
# gflags
wget https://github.com/schuhschuh/gflags/archive/master.zip
unzip master.zip
cd gflags-master
mkdir build && cd build
export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=1
make && make install
# lmdb
git clone https://github.com/LMDB/lmdb
cd lmdb/libraries/liblmdb
make && make install

这个时候make 是可以编译过去的

但是!!!make pycaffe编译不过去!!!

这里要想编译过去pycaffe 需要把gcc和g++再改回到 7 版本

MD! 一晚上就耗费在这里了!

阅读更多

没有更多推荐了,返回首页