onnxruntime: windows build error "returned non-zero exit status 1" with VS 2017

I am trying to build from source code following these steps:

 git clone --recursive https://github.com/Microsoft/onnxruntime
 cd onnxruntime
.\build.bat --config Release --build_shared_lib --parallel

However, I get the error below 15-20 mins into the compilation. Could it be related to cmake version? I used to build it with no issue but recently wanted to build with OpenVino EP. For that, I had to update the cmake (version 3.18.0). After that I started to get this error even for windows build.

Traceback (most recent call last):
  File "C:\Software\onnxruntime\\tools\ci_build\build.py", line 2190, in <module>
    sys.exit(main())
  File "C:\Software\onnxruntime\\tools\ci_build\build.py", line 2114, in main
    build_targets(args, cmake_path, build_dir, configs, num_parallel_jobs, args.target)
  File "C:\Software\onnxruntime\\tools\ci_build\build.py", line 1084, in build_targets
    run_subprocess(cmd_args, env=env)
  File "C:\Software\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 "C:\Software\onnxruntime\tools\python\util\run.py", line 44, in run
    env=env, shell=shell)
  File "C:\Users\goksi\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', 'C:\\Software\\onnxruntime\\\\build\\Windows\\Release', '--config', 'Release', '--', '/maxcpucount:12', '/nodeReuse:False']' returned non-zero exit status 1.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (5 by maintainers)

Most upvoted comments

Hello,

I would like to reopen the issue, since using VS 2019 is not an option for me. I have looked into the code and it looks like the compiler is just unable to deal with lambdas properly.

Replacing the lambdas in FastReduceKRK and FastReduceRK inside reduction_ops.h with functors resolves the issues. I don’t think that this would change the performance of these functions.

If there is interest I can share the code.

@elejke if you fix these errors many other will crop up. I started the process and gave up after some 50ish fixes. And since they do not want to support VS2017 (see e.g. #13745), you basically need to fork from this project.

I ended up using the VS2019 binaries in my VS2017 project.