错误/usr/include/string.h:652:42:错误:“memcpy”在构建caffe时没有在这个范围内声明。

时间:2022-04-27 09:48:38

I'm trying to compile caffe following this guide: https://gist.github.com/wangruohui/679b05fcd1466bb0937f

我正试图通过这个指南来编译caffe: https://gist.github.com/wangruohui/679b05fcd1466bb0937f。

However when I get too make all I get the error

然而,当我得到了所有我得到的错误。

NVCC src/caffe/layers/hdf5_data_layer.cu
/usr/include/string.h: In function ‘void* __mempcpy_inline(void*, const void*, size_t)’:
/usr/include/string.h:652:42: error: ‘memcpy’ was not declared in this scope
   return (char *) memcpy (__dest, __src, __n) + __n;
                                          ^
Makefile:585: recipe for target '.build_release/cuda/src/caffe/layers/hdf5_data_layer.o' failed

But /usr/include/string.h isn't even in the caffe code so what gives? This is in an ubuntu variant that closely follows 16.04

但/usr/include/string.h甚至不是在caffe代码中,所以是什么?这是一个ubuntu版本,紧跟在16.04之后。

Seeing as the source of the code is a well known repo I think the problem is probably in the Makefile or the Makefile.config

作为代码的源代码,我认为这个问题可能出现在Makefile或Makefile.config中。

1 个解决方案

#1


7  

After a long time looking through various internet sources I solved this problem by going to the Makefile and changing the line

经过长时间的浏览各种各样的互联网,我解决了这个问题,我去了Makefile并改变了这条线。

NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)

into

NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)

For me this was on line 406

对我来说这是第406行。

#1


7  

After a long time looking through various internet sources I solved this problem by going to the Makefile and changing the line

经过长时间的浏览各种各样的互联网,我解决了这个问题,我去了Makefile并改变了这条线。

NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)

into

NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)

For me this was on line 406

对我来说这是第406行。