Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 825
Thijser Avatar asked Sep 01 '25 16:09

Thijser


1 Answers

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

like image 80
Thijser Avatar answered Sep 04 '25 06:09

Thijser