PyTorch 1.3.1 build fails on C++ error

Dear all,

I try to build from source PyTorch 1.3.1. I gave a try both with gcc (from my system (RHEL 7), so gcc 4.8.5) and with a recent Intel compiler (icc 2019.0.5.281 that is more or less the latest release of Intel 2019 compiler) and I run in the same error.

Here is the compilation error I get:

/usr/include/c++/4.8.2/functional:2450:7: error: ‘std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = caffe2::OnnxifiOp<Context>::buildBackendAndGraph(caffe2::Workspace*, const std::vector<long unsigned int>&, const string&) [with Context = caffe2::CPUContext; std::string = std::basic_string<char>]::__lambda27; <template-parameter-2-2> = void; _Res = std::shared_ptr<caffe2::onnx::BackendGraphInfo>; _ArgTypes = {}]’, declared using local type ‘caffe2::OnnxifiOp<Context>::buildBackendAndGraph(caffe2::Workspace*, const std::vector<long unsigned int>&, const string&) [with Context = caffe2::CPUContext; std::string = std::basic_string<char>]::__lambda27’, is used but never defined [-fpermissive]
       function<_Res(_ArgTypes...)>::

I build with the following command line:

BLAS=MKL python3 setup.py bdist_wheel

(Well, Actually it is a bit more complicated because for some reason it fails to detect the MKL library, so I launch the following, that crashes, then I go in build/ directory and launch the Cmake command line provided by setup.py adding -DINTEL_MKL_DIR=$MKLROOT with $MKLROOT the root directory of my MKL installation, but in the end it does the same.)

Few months ago I was able to build (also from source) PyTorch 1.2.0 without any major issue on the same system (and with gcc compiler from my RHEL 7 system).

Any help would be appreciated!

A quick add: I realised I had an inconsistency (the libc used above is from 4.8.2) so I corrected it (to use the right libc) but it changed nothing.