Using Caffe2 library from PyTorch 1.2 build

Hello, I’ve built PyTorch 1.2 from sources for Arch Linux. C++ programs written with use of can be compiled and linked without any errors. But I can’t link even a simple program for Caffe2 library(, because I’m getting errors:

/usr/bin/ld: /somepath/lib/ undefined reference to `c10::Device::validate()'
/usr/bin/ld: /somepath/lib/ undefined reference to `c10::ThreadPool::ThreadPool(unsigned long, int)' 

My compilation command line looks like this one:

/usr/bin/g++  -msse3 -fopenmp -Wall -Wextra -Wno-unused-parameter -pthread -fopenmp -fPIC -ggdb -O0  -rdynamic  -o caffe2-load -Wl,-rpath,/somepath/lib /somepath/lib/ /somepath/lib64/libprotobuf.a 

I would appreciate for any help.

These sound like c10 functions, maybe you need to link in c10?

Best regards


Thanks, for the suggestion, but linking with the c10 library doesn’t help.

I solved the problem. I modified the c10/core/Device.h and c10/core/Device.cpp files by moving the implementation of Device::validate method to the cpp file. Also I added additional constructor ThreadPool(std::size_t pool_size,int numa_node_id) to the class c10::ThreadPool. It seems that there are some inconsistency in the linkage options for the c10 library.