microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
14.68k stars 2.93k forks source link

Crosscompiling using VS2017 from Windows for Raspberrypi4 #7962

Open nyanmn opened 3 years ago

nyanmn commented 3 years ago

I am crosscompiling onnxruntime from windows using vs2017 for Rpi4. I follow the instructions from here.

When I do .\build.bat --config MinSizeRel --update --build --arm in vs2017 command prompt, I have error as follows.

D:\RobotCompetition\onnxruntime\onnxruntime\core/providers/cpu/reduction/reduction_ops.h(215): error C2440: '<function-style-cast>': cannot convert from 'initializer list'
 to 'Eigen::Map<Eigen::Array<T,-1,1,,-1,1>,0,Eigen::Stride<0,0>>' [D:\RobotCompetition\onnxruntime\build\Windows\MinSizeRel\onnxruntime_providers.vcxproj]
          with
          [
              T=int64_t
          ] (compiling source file D:\RobotCompetition\onnxruntime\onnxruntime\core\providers\cpu\reduction\reduction_ops.cc)
  D:\RobotCompetition\onnxruntime\onnxruntime\core/providers/cpu/reduction/reduction_ops.h(215): note: No constructor could take the source type, or constructor overload r
  esolution was ambiguous (compiling source file D:\RobotCompetition\onnxruntime\onnxruntime\core\providers\cpu\reduction\reduction_ops.cc)
  D:\RobotCompetition\onnxruntime\onnxruntime\core/providers/cpu/reduction/reduction_ops.h(204): note: while compiling class template member function 'void onnxruntime::Re
  duceAggregatorSum<int64_t,T>::FastReduceRK(const onnxruntime::Tensor &,const std::vector<int64_t,std::allocator<_Ty>> &,onnxruntime::Tensor &,onnxruntime::concurrency::T
  hreadPool *)'
          with
          [
              T=int64_t,
              _Ty=int64_t
          ] (compiling source file D:\RobotCompetition\onnxruntime\onnxruntime\core\providers\cpu\reduction\reduction_ops.cc)
  D:\RobotCompetition\onnxruntime\onnxruntime\core\providers\cpu\reduction\reduction_ops.cc(923): note: see reference to function template instantiation 'void onnxruntime:
  :ReduceAggregatorSum<int64_t,T>::FastReduceRK(const onnxruntime::Tensor &,const std::vector<int64_t,std::allocator<_Ty>> &,onnxruntime::Tensor &,onnxruntime::concurrency
  ::ThreadPool *)' being compiled
          with
          [
              T=int64_t,
              _Ty=int64_t
          ]
  D:\RobotCompetition\onnxruntime\onnxruntime\core\providers\cpu\reduction\reduction_ops.cc(911): note: see reference to class template instantiation 'onnxruntime::ReduceA
  ggregatorSum<int64_t,T>' being compiled
          with
          [
              T=int64_t
          ]
  D:\RobotCompetition\onnxruntime\onnxruntime\core\providers\cpu\reduction\reduction_ops.cc(889): note: while compiling class template member function 'std::unique_ptr<onn
  xruntime::Tensor,std::default_delete<_Ty>> onnxruntime::ReduceSum<int64_t>::Impl(const onnxruntime::Tensor &,const std::vector<int64_t,std::allocator<__int64>> &,onnxrun
  time::AllocatorPtr,onnxruntime::concurrency::ThreadPool *,bool,const onnxruntime::TensorShape *)'
          with
          [
              _Ty=onnxruntime::Tensor
          ]
  D:\RobotCompetition\onnxruntime\onnxruntime\core\providers\cpu\reduction\reduction_ops.cc(182): note: see reference to class template instantiation 'onnxruntime::ReduceS
  um<int64_t>' being compiled
D:\RobotCompetition\onnxruntime\onnxruntime\core/providers/cpu/reduction/reduction_ops.h(215): error C2440: '<function-style-cast>': cannot convert from 'initializer list'
 to 'Eigen::Map<const Eigen::Array<T,-1,1,,-1,1>,0,Eigen::Stride<0,0>>' [D:\RobotCompetition\onnxruntime\build\Windows\MinSizeRel\onnxruntime_providers.vcxproj]
          with
          [
              T=int64_t
          ] (compiling source file D:\RobotCompetition\onnxruntime\onnxruntime\core\providers\cpu\reduction\reduction_ops.cc)

Then build process stops as

File "D:\RobotCompetition\onnxruntime\\tools\ci_build\build.py", line 2190, in <module>
    sys.exit(main())
  File "D:\RobotCompetition\onnxruntime\\tools\ci_build\build.py", line 2114, in main
    build_targets(args, cmake_path, build_dir, configs, num_parallel_jobs, args.target)
  File "D:\RobotCompetition\onnxruntime\\tools\ci_build\build.py", line 1084, in build_targets
    run_subprocess(cmd_args, env=env)
  File "D:\RobotCompetition\onnxruntime\\tools\ci_build\build.py", line 582, in run_subprocess
    return run(*args, cwd=cwd, capture_stdout=capture_stdout, shell=shell, env=my_env)
  File "D:\RobotCompetition\onnxruntime\tools\python\util\run.py", line 44, in run
    env=env, shell=shell)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 512, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['C:\\Program Files\\CMake\\bin\\cmake.EXE', '--build', 'D:\\RobotCompetition\\onnxruntime\\\\build\\Windows\\MinSizeRel', '--config', 'MinSizeRel']' returned non-zero exit status 1.

How can I solve issue?

snnn commented 3 years ago

What's the compiler version?