choonkiatlee / qemu-raspbian

MIT License
5 stars 0 forks source link

Errors building pytorch v1.4.0 #1

Open Ja1Zhou opened 2 years ago

Ja1Zhou commented 2 years ago

Hi, I was trying to build pytorch v1.4.0 from source using this docker image, and following the steps in this blog. Yet, I get the following errors. It seems that something with protobuf has gone wrong. I noticed

# Fix from: https://github.com/pytorch/pytorch/issues/22564
root@b0571199906e:/# git submodule update --remote third_party/protobuf

in the blog, yet I didn't manage to solve my problem. It would be nice if you could give some advice~

In file included from /root/pytorch/third_party/onnx/onnx/defs/shape_inference.h:4,
                 from /root/pytorch/third_party/onnx/onnx/defs/schema.h:24,
                 from /root/pytorch/caffe2/onnx/torch_ops/./schema.h:4,
                 from /root/pytorch/caffe2/onnx/torch_ops/defs.cc:4:
/root/pytorch/third_party/onnx/onnx/proto_utils.h: In function ‘bool onnx_torch::ParseProtoFromBytes(Proto*, const char*, size_t)’:
/root/pytorch/third_party/onnx/onnx/proto_utils.h:34:66: error: no matching function for call to ‘google::protobuf::io::CodedInputStream::SetTotalBytesLimit(long long int, long long int)’
   coded_stream.SetTotalBytesLimit((2048LL << 20) - 1, 512LL << 20);
                                                                  ^
In file included from /root/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.pb.h:23,
                 from /root/pytorch/build/third_party/onnx/onnx/onnx-ml.pb.h:2,
                 from /root/pytorch/third_party/onnx/onnx/onnx_pb.h:50,
                 from /root/pytorch/third_party/onnx/onnx/defs/data_type_utils.h:11,
                 from /root/pytorch/third_party/onnx/onnx/defs/schema.h:21,
                 from /root/pytorch/caffe2/onnx/torch_ops/./schema.h:4,
                 from /root/pytorch/caffe2/onnx/torch_ops/defs.cc:4:
/root/pytorch/third_party/protobuf/src/google/protobuf/io/coded_stream.h:406:8: note: candidate: ‘void google::protobuf::io::CodedInputStream::SetTotalBytesLimit(int)’
   void SetTotalBytesLimit(int total_bytes_limit);
        ^~~~~~~~~~~~~~~~~~
/root/pytorch/third_party/protobuf/src/google/protobuf/io/coded_stream.h:406:8: note:   candidate expects 1 argument, 2 provided
In file included from /root/pytorch/third_party/onnx/onnx/defs/shape_inference.h:4,
                 from /root/pytorch/third_party/onnx/onnx/defs/schema.h:24,
                 from /root/pytorch/caffe2/onnx/torch_ops/./schema.h:4,
                 from /root/pytorch/caffe2/onnx/torch_ops/schema.cc:1:
/root/pytorch/third_party/onnx/onnx/proto_utils.h: In function ‘bool onnx_torch::ParseProtoFromBytes(Proto*, const char*, size_t)’:
/root/pytorch/third_party/onnx/onnx/proto_utils.h:34:66: error: no matching function for call to ‘google::protobuf::io::CodedInputStream::SetTotalBytesLimit(long long int, long long int)’
   coded_stream.SetTotalBytesLimit((2048LL << 20) - 1, 512LL << 20);
                                                                  ^
In file included from /root/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.pb.h:23,
                 from /root/pytorch/build/third_party/onnx/onnx/onnx-ml.pb.h:2,
                 from /root/pytorch/third_party/onnx/onnx/onnx_pb.h:50,
                 from /root/pytorch/third_party/onnx/onnx/defs/data_type_utils.h:11,
                 from /root/pytorch/third_party/onnx/onnx/defs/schema.h:21,
                 from /root/pytorch/caffe2/onnx/torch_ops/./schema.h:4,
                 from /root/pytorch/caffe2/onnx/torch_ops/schema.cc:1:
/root/pytorch/third_party/protobuf/src/google/protobuf/io/coded_stream.h:406:8: note: candidate: ‘void google::protobuf::io::CodedInputStream::SetTotalBytesLimit(int)’
   void SetTotalBytesLimit(int total_bytes_limit);
        ^~~~~~~~~~~~~~~~~~
/root/pytorch/third_party/protobuf/src/google/protobuf/io/coded_stream.h:406:8: note:   candidate expects 1 argument, 2 provided
In file included from /root/pytorch/third_party/onnx/onnx/defs/shape_inference.h:4,
                 from /root/pytorch/third_party/onnx/onnx/defs/schema.h:24,
                 from /root/pytorch/third_party/onnx/onnx/defs/controlflow/old.cc:4:
/root/pytorch/third_party/onnx/onnx/proto_utils.h: In function ‘bool onnx_torch::ParseProtoFromBytes(Proto*, const char*, size_t)’:
/root/pytorch/third_party/onnx/onnx/proto_utils.h:34:66: error: no matching function for call to ‘google::protobuf::io::CodedInputStream::SetTotalBytesLimit(long long int, long long int)’
   coded_stream.SetTotalBytesLimit((2048LL << 20) - 1, 512LL << 20);
                                                                  ^
In file included from /root/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.pb.h:23,
                 from /root/pytorch/build/third_party/onnx/onnx/onnx-ml.pb.h:2,
                 from /root/pytorch/third_party/onnx/onnx/onnx_pb.h:50,
                 from /root/pytorch/third_party/onnx/onnx/defs/data_type_utils.h:11,
                 from /root/pytorch/third_party/onnx/onnx/defs/schema.h:21,
                 from /root/pytorch/third_party/onnx/onnx/defs/controlflow/old.cc:4:
/root/pytorch/third_party/protobuf/src/google/protobuf/io/coded_stream.h:406:8: note: candidate: ‘void google::protobuf::io::CodedInputStream::SetTotalBytesLimit(int)’
   void SetTotalBytesLimit(int total_bytes_limit);
        ^~~~~~~~~~~~~~~~~~
/root/pytorch/third_party/protobuf/src/google/protobuf/io/coded_stream.h:406:8: note:   candidate expects 1 argument, 2 provided
In file included from /root/pytorch/third_party/onnx/onnx/defs/shape_inference.h:4,
                 from /root/pytorch/third_party/onnx/onnx/defs/schema.h:24,
                 from /root/pytorch/third_party/onnx/onnx/defs/controlflow/defs.cc:4:
/root/pytorch/third_party/onnx/onnx/proto_utils.h: In function ‘bool onnx_torch::ParseProtoFromBytes(Proto*, const char*, size_t)’:
/root/pytorch/third_party/onnx/onnx/proto_utils.h:34:66: error: no matching function for call to ‘google::protobuf::io::CodedInputStream::SetTotalBytesLimit(long long int, long long int)’
   coded_stream.SetTotalBytesLimit((2048LL << 20) - 1, 512LL << 20);
                                                                  ^
In file included from /root/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.pb.h:23,
                 from /root/pytorch/build/third_party/onnx/onnx/onnx-ml.pb.h:2,
                 from /root/pytorch/third_party/onnx/onnx/onnx_pb.h:50,
                 from /root/pytorch/third_party/onnx/onnx/defs/data_type_utils.h:11,
                 from /root/pytorch/third_party/onnx/onnx/defs/schema.h:21,
                 from /root/pytorch/third_party/onnx/onnx/defs/controlflow/defs.cc:4:
/root/pytorch/third_party/protobuf/src/google/protobuf/io/coded_stream.h:406:8: note: candidate: ‘void google::protobuf::io::CodedInputStream::SetTotalBytesLimit(int)’
   void SetTotalBytesLimit(int total_bytes_limit);
        ^~~~~~~~~~~~~~~~~~
/root/pytorch/third_party/protobuf/src/google/protobuf/io/coded_stream.h:406:8: note:   candidate expects 1 argument, 2 provided
In file included from /root/pytorch/third_party/onnx/onnx/defs/shape_inference.h:4,
                 from /root/pytorch/third_party/onnx/onnx/defs/schema.h:24,
                 from /root/pytorch/third_party/onnx/onnx/checker.h:7,
                 from /root/pytorch/third_party/onnx/onnx/common/model_helpers.cc:5:
/root/pytorch/third_party/onnx/onnx/proto_utils.h: In function ‘bool onnx_torch::ParseProtoFromBytes(Proto*, const char*, size_t)’:
/root/pytorch/third_party/onnx/onnx/proto_utils.h:34:66: error: no matching function for call to ‘google::protobuf::io::CodedInputStream::SetTotalBytesLimit(long long int, long long int)’
   coded_stream.SetTotalBytesLimit((2048LL << 20) - 1, 512LL << 20);
                                                                  ^
In file included from /root/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.pb.h:23,
                 from /root/pytorch/build/third_party/onnx/onnx/onnx-ml.pb.h:2,
                 from /root/pytorch/third_party/onnx/onnx/onnx_pb.h:50,
                 from /root/pytorch/third_party/onnx/onnx/onnx-operators_pb.h:6,
                 from /root/pytorch/third_party/onnx/onnx/common/model_helpers.h:9,
                 from /root/pytorch/third_party/onnx/onnx/common/model_helpers.cc:4:
/root/pytorch/third_party/protobuf/src/google/protobuf/io/coded_stream.h:406:8: note: candidate: ‘void google::protobuf::io::CodedInputStream::SetTotalBytesLimit(int)’
   void SetTotalBytesLimit(int total_bytes_limit);
        ^~~~~~~~~~~~~~~~~~
/root/pytorch/third_party/protobuf/src/google/protobuf/io/coded_stream.h:406:8: note:   candidate expects 1 argument, 2 provided
In file included from /root/pytorch/third_party/onnx/onnx/defs/shape_inference.h:4,
                 from /root/pytorch/third_party/onnx/onnx/defs/schema.h:24,
                 from /root/pytorch/third_party/onnx/onnx/checker.h:7,
                 from /root/pytorch/third_party/onnx/onnx/checker.cc:1:
/root/pytorch/third_party/onnx/onnx/proto_utils.h: In function ‘bool onnx_torch::ParseProtoFromBytes(Proto*, const char*, size_t)’:
/root/pytorch/third_party/onnx/onnx/proto_utils.h:34:66: error: no matching function for call to ‘google::protobuf::io::CodedInputStream::SetTotalBytesLimit(long long int, long long int)’
   coded_stream.SetTotalBytesLimit((2048LL << 20) - 1, 512LL << 20);
                                                                  ^
In file included from /root/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.pb.h:23,
                 from /root/pytorch/build/third_party/onnx/onnx/onnx-ml.pb.h:2,
                 from /root/pytorch/third_party/onnx/onnx/onnx_pb.h:50,
                 from /root/pytorch/third_party/onnx/onnx/onnx-operators_pb.h:6,
                 from /root/pytorch/third_party/onnx/onnx/defs/attr_proto_util.h:6,
                 from /root/pytorch/third_party/onnx/onnx/defs/function.h:11,
                 from /root/pytorch/third_party/onnx/onnx/checker.h:6,
                 from /root/pytorch/third_party/onnx/onnx/checker.cc:1:
/root/pytorch/third_party/protobuf/src/google/protobuf/io/coded_stream.h:406:8: note: candidate: ‘void google::protobuf::io::CodedInputStream::SetTotalBytesLimit(int)’
   void SetTotalBytesLimit(int total_bytes_limit);
        ^~~~~~~~~~~~~~~~~~
/root/pytorch/third_party/protobuf/src/google/protobuf/io/coded_stream.h:406:8: note:   candidate expects 1 argument, 2 provided
make[2]: *** [third_party/onnx/CMakeFiles/onnx.dir/build.make:76: third_party/onnx/CMakeFiles/onnx.dir/__/__/caffe2/onnx/torch_ops/schema.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [third_party/onnx/CMakeFiles/onnx.dir/build.make:63: third_party/onnx/CMakeFiles/onnx.dir/__/__/caffe2/onnx/torch_ops/defs.cc.o] Error 1
make[2]: *** [third_party/onnx/CMakeFiles/onnx.dir/build.make:141: third_party/onnx/CMakeFiles/onnx.dir/onnx/common/model_helpers.cc.o] Error 1
make[2]: *** [third_party/onnx/CMakeFiles/onnx.dir/build.make:193: third_party/onnx/CMakeFiles/onnx.dir/onnx/defs/controlflow/old.cc.o] Error 1
make[2]: *** [third_party/onnx/CMakeFiles/onnx.dir/build.make:180: third_party/onnx/CMakeFiles/onnx.dir/onnx/defs/controlflow/defs.cc.o] Error 1
make[2]: *** [third_party/onnx/CMakeFiles/onnx.dir/build.make:89: third_party/onnx/CMakeFiles/onnx.dir/onnx/checker.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:754: third_party/onnx/CMakeFiles/onnx.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
Traceback (most recent call last):
  File "setup.py", line 755, in <module>
    build_deps()
  File "setup.py", line 316, in build_deps
    cmake=cmake)
  File "/root/pytorch/tools/build_pytorch_libs.py", line 62, in build_caffe2
    cmake.build(my_env)
  File "/root/pytorch/tools/setup_helpers/cmake.py", line 335, in build
    self.run(build_args, my_env)
  File "/root/pytorch/tools/setup_helpers/cmake.py", line 141, in run
    check_call(command, cwd=self.build_dir, env=env)
  File "/usr/lib/python3.7/subprocess.py", line 347, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '8']' returned non-zero exit status 2.
Ja1Zhou commented 2 years ago

my environment variables are

USE_NCCL=OFF
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
USE_QNNPACK=0
MAX_JOBS=8
SHLVL=1
TERM=xterm
HOME=/root
USE_CUDNN=0
USE_CUDA=0
USE_DISTRIBUTED=0
PWD=/root/pytorch
USE_METAL=0
USE_NNPACK=0
USE_MKLDNN=0
BUILD_CAFFE2_OPS=0
BUILD_TEST=0