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] Build fails with vcpkg due to an incorrect protobuf version. #22750

Open
cyanic-selkie opened this issue Nov 6, 2024 · 4 comments
Open
Labels
build build issues; typically submitted using template contributions welcome lower priority issues for the core ORT teams

Comments

@cyanic-selkie
Copy link

cyanic-selkie commented Nov 6, 2024

Describe the issue

Hi, I am building onnxruntime with vcpkg enabled on an ARM64 Macbook.

Looking at the build logs, I can see the protobuf version being used is 4.25.1

Installing 20/23 protobuf:[email protected]#1...

This causes the error below.

I was under the impression that vcpkg would pick the correct version, not the latest... Is there any way to fix this?

Urgency

No response

Target platform

MacOS

Build script

./build.sh --config Release --parallel --compile_no_warning_as_error --skip_submodule_sync --update --build --build_dir build/macos --use_xcode --cmake_extra_defines CMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake --use_vcpkg

Error / output

...
/path/to/onnxruntime/build/macos/Release/_deps/onnx-build/onnx/onnx-ml.pb.h:17:2: error:
This file was generated by an older version of protoc which is
17 | #error This file was generated by an older version of protoc which is
| ^
/path/to/onnxruntime/build/macos/Release/_deps/onnx-build/onnx/onnx-ml.pb.h:18:2: error:
incompatible with your Protocol Buffer headers. Please
18 | #error incompatible with your Protocol Buffer headers. Please
| ^
/path/to/onnxruntime/build/macos/Release/_deps/onnx-build/onnx/onnx-ml.pb.h:19:2: error:
regenerate this file with a newer version of protoc.
19 | #error regenerate this file with a newer version of protoc.
| ^
...

Visual Studio Version

No response

GCC / Compiler Version

No response

@cyanic-selkie cyanic-selkie added the build build issues; typically submitted using template label Nov 6, 2024
@cyanic-selkie
Copy link
Author

cyanic-selkie commented Nov 6, 2024

This passes when I add

  "overrides": [
    { "name": "protobuf", "version": "3.21.12" },
    { "name": "flatbuffers", "version": "23.5.26" }
  ],

to cmake/vcpkg.json. Otherwise, it installs the latest versions which are incompatible (protobuf > 3.12 and flatbuffers > 23)

@snnn
Copy link
Member

snnn commented Nov 6, 2024

Our CI build has:

--path_to_protoc_exe /Users/runner/work/onnxruntime/onnxruntime/.build/X64-osx/tools/protobuf/protoc

We may need to do some tweaks at https://github.com/microsoft/onnxruntime/blob/main/cmake/external/onnxruntime_external_deps.cmake#L121

I should we should not enter that code path if vcpkg is in-use.

@snnn snnn added the contributions welcome lower priority issues for the core ORT teams label Nov 6, 2024
@cyanic-selkie
Copy link
Author

@snnn I'm not sure I follow. Isn't the actual fix properly setting the allowed versions of the protobuf and flatbuffers dependencies, essentially what I did?

@snnn
Copy link
Member

snnn commented Nov 7, 2024

Either can work.

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 contributions welcome lower priority issues for the core ORT teams
Projects
None yet
Development

No branches or pull requests

2 participants