错误/usr/include/string.h:652:42:错误:生成caffe时未在此作用域中声明“memcpy”

error /usr/include/string.h:652:42: error: ‘memcpy’ was not declared in this scope while building caffe

本文关键字:错误 作用域 声明 memcpy caffe string include usr 生成      更新时间:2023-10-16

我正试图按照本指南编译caffe:https://gist.github.com/wangruohui/679b05fcd1466bb0937f

然而,当我得到太make all时,我得到错误

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

但是/usr/include/string.h甚至不在caffe代码中,那么它给出了什么呢?这是一个紧跟16.04 的ubuntu变体

由于代码源是一个众所周知的repo,我认为问题可能在Makefile或Makefile.config 中

经过长时间浏览各种互联网资源,我通过转到Makefile并更改行来解决这个问题

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

进入

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

对我来说,这是在406