简体   繁体   中英

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

I'm trying to compile caffe following this guide: 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

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM