Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Build] onnx-ml.pb.h was generated by a newer version of protoc #18077

Closed
tianleiwu opened this issue Oct 24, 2023 · 2 comments
Closed

[Build] onnx-ml.pb.h was generated by a newer version of protoc #18077

tianleiwu opened this issue Oct 24, 2023 · 2 comments
Labels
build build issues; typically submitted using template ep:CUDA issues related to the CUDA execution provider platform:windows issues related to the Windows platform

Comments

@tianleiwu
Copy link
Contributor

Describe the issue

Build in Windows and encounter errors. I pip installed protobuf version 3.20.3.

The file onnx/onnx-ml.proto is like the following:

// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: onnx/onnx-ml.proto

#ifndef GOOGLE_PROTOBUF_INCLUDED_onnx_2fonnx_2dml_2eproto
#define GOOGLE_PROTOBUF_INCLUDED_onnx_2fonnx_2dml_2eproto

#include <limits>
#include <string>

#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3021000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
...

Urgency

No response

Target platform

windows 11

Build script

IF {%VCToolsVersion%}=={} call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64

set CudaToolkitDir=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8

call .\build.bat --config Release --build_dir .\build --build_shared_lib --parallel --build_wheel ^
            --cmake_generator "Visual Studio 17 2022" ^
            --use_cuda --cuda_version 11.8 --cuda_home "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8" ^
            --cudnn_home C:\nvidia\cudnn-windows-x86_64-8.9.4.25_cuda11-archive ^
            --cmake_extra_defines CMAKE_CUDA_ARCHITECTURES=89 ^
            --cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF  ^
            --skip_tests

Error / output

D:\git\onnxruntime\build\Release\_deps\onnx-build\onnx/onnx-ml.pb.h(12,1): fatal  error C1189: #error:  This file was g
enerated by a newer version of protoc which is (compiling source file D:\git\onnxruntime\onnxruntime\python\onnxruntime
_pybind_schema.cc) [D:\git\onnxruntime\build\Release\onnxruntime_pybind11_state.vcxproj]
D:\git\onnxruntime\build\Release\_deps\onnx-build\onnx/onnx-ml.pb.h(12,1): fatal  error C1189: #error:  This file was g
enerated by a newer version of protoc which is (compiling source file D:\git\onnxruntime\onnxruntime\python\onnxruntime
_pybind_mlvalue.cc) [D:\git\onnxruntime\build\Release\onnxruntime_pybind11_state.vcxproj]
D:\git\onnxruntime\build\Release\_deps\onnx-build\onnx/onnx-ml.pb.h(12,1): fatal  error C1189: #error:  This file was g
enerated by a newer version of protoc which is (compiling source file D:\git\onnxruntime\onnxruntime\python\onnxruntime
_pybind_ortvalue.cc) [D:\git\onnxruntime\build\Release\onnxruntime_pybind11_state.vcxproj]
D:\git\onnxruntime\build\Release\_deps\onnx-build\onnx/onnx-ml.pb.h(12,1): fatal  error C1189: #error:  This file was g
enerated by a newer version of protoc which is (compiling source file D:\git\onnxruntime\onnxruntime\python\onnxruntime
_pybind_sparse_tensor.cc) [D:\git\onnxruntime\build\Release\onnxruntime_pybind11_state.vcxproj]
D:\git\onnxruntime\build\Release\_deps\onnx-build\onnx/onnx-ml.pb.h(12,1): fatal  error C1189: #error:  This file was g
enerated by a newer version of protoc which is (compiling source file D:\git\onnxruntime\onnxruntime\python\onnxruntime
_pybind_iobinding.cc) [D:\git\onnxruntime\build\Release\onnxruntime_pybind11_state.vcxproj]
D:\git\onnxruntime\build\Release\_deps\onnx-build\onnx/onnx-ml.pb.h(12,1): fatal  error C1189: #error:  This file was g
enerated by a newer version of protoc which is (compiling source file D:\git\onnxruntime\onnxruntime\python\onnxruntime
_pybind_state.cc) [D:\git\onnxruntime\build\Release\onnxruntime_pybind11_state.vcxproj]
D:\git\onnxruntime\build\Release\_deps\onnx-build\onnx/onnx-ml.pb.h(12,1): fatal  error C1189: #error:  This file was g
enerated by a newer version of protoc which is (compiling source file D:\git\onnxruntime\onnxruntime\python\onnxruntime
_pybind_state_common.cc) [D:\git\onnxruntime\build\Release\onnxruntime_pybind11_state.vcxproj]

Traceback (most recent call last):
  File "D:\git\onnxruntime\tools\ci_build\build.py", line 2699, in <module>
    sys.exit(main())
  File "D:\git\onnxruntime\tools\ci_build\build.py", line 2592, in main
    build_targets(args, cmake_path, build_dir, configs, num_parallel_jobs, args.target)
  File "D:\git\onnxruntime\tools\ci_build\build.py", line 1496, in build_targets
    run_subprocess(cmd_args, env=env)
  File "D:\git\onnxruntime\tools\ci_build\build.py", line 801, in run_subprocess
    return run(*args, cwd=cwd, capture_stdout=capture_stdout, shell=shell, env=my_env)
  File "D:\git\onnxruntime\tools\python\util\run.py", line 49, in run
    completed_process = subprocess.run(
  File "C:\Users\tianl\.conda\envs\sdxl\lib\subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake\\bin\\cmake.EXE', '--build', '.\\build\\Release', '--config', 'Release', '--', '/maxcpucount:32', '/nodeReuse:False', '/p:CL_MPCount=32']' returned non-zero exit status 1.

Visual Studio Version

2022 (17.7)

GCC / Compiler Version

No response

@tianleiwu tianleiwu added the build build issues; typically submitted using template label Oct 24, 2023
@github-actions github-actions bot added ep:CUDA issues related to the CUDA execution provider platform:windows issues related to the Windows platform labels Oct 24, 2023
@snnn
Copy link
Member

snnn commented Oct 24, 2023

If you are using conda, create a new clean conda env without protobuf C++ packages there .

@tianleiwu
Copy link
Contributor Author

Thanks for the hit.

In my case, creating new conda env did not work. I have to uninstall anaconda (including removing all existing conda envs), then reinstall anaconda and create a new conda env to resolve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build issues; typically submitted using template ep:CUDA issues related to the CUDA execution provider platform:windows issues related to the Windows platform
Projects
None yet
Development

No branches or pull requests

2 participants