protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

protoc failing with CHECK failed: !options_.opensource_runtime error

Open stanguturi opened this issue 3 years ago • 6 comments

Doing a very simple operation:

$ protoc --cpp_out=. -I/usr/share/gocode/src/github.com/containerd/containerd/api/services/containers/v1 -I/usr/share/gocode/src/github.com/gogo/protobuf/protobuf/ -I/usr/share/gocode/src/github.com/gogo/protobuf/ /usr/share/gocode/src/github.com/containerd/containerd/api/services/containers/v1/containers.proto

[libprotobuf FATAL ./google/protobuf/compiler/cpp/cpp_file.h:175] CHECK failed: !options_.opensource_runtime: terminate called after throwing an instance of 'google::protobuf::FatalException' what(): CHECK failed: !options_.opensource_runtime: Aborted (core dumped)

protoc is failing with CHECK failed error. I have no clue about the error.

What version of protobuf and what language are you using? Version: master/v3.6.0/v3.5.0 etc.: v3.14.0

Language: C++/Java/Python/C#/Ruby/PHP/Objective-C/Javascript C++

What operating system (Linux, Windows, ...) and version? Linux

What runtime / compiler are you using (e.g., python version or gcc version) g++

What did you expect to see Expect no errors.

What did you see instead? Finding errors.

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

stanguturi avatar Nov 03 '21 18:11 stanguturi

Weak fields are an old and deprecated internal-only feature that we never open sourced. The import weak syntax only exists to support weak fields, so we have been assuming that it's never used outside of Google. Apparently Gogoprotobuf relies on this syntax, though, and makes use of it here.

acozzette avatar Nov 03 '21 18:11 acozzette

Thanks @acozzette for the update. What is the solution or workaround for our project?

stanguturi avatar Nov 03 '21 19:11 stanguturi

Hey @stanguturi -- Like Adam said, weak imports are a feature that only happened to be exposed in our Github repo while we (internally, at Google) worked towards removing its use. The intent was not for options, but something else entirely.

It looks like the containerd changes have been around since 2017 or so in containerd/containerd@50532f231a29f0c04f7ee62696b78d322a84cf33 ... this seems like a pretty bad situation, since it means they cannot build for C++ (as you now see). Based on Github's search results, it looks like containerd may be the only project that actually relies on weak imports. Most of the other hits are either tests or internal to Go protobufs.

Without getting too far into the details, I don't think this is something we can address in the very near term, although it's an interesting use case. (Very short version: this would violate some correctness preconditions that guard against built-in schema corruption... the error you got was not directly related to this issue.)

I do see that you are working with system-installed protos (under /usr/share/). You can always work around this issue by modifying the files to remove the weak syntax, and use the modified versions to build for C++.

dlj-NaN avatar Nov 05 '21 23:11 dlj-NaN

I do see that you are working with system-installed protos (under /usr/share/). You can always work around this issue by modifying the files to remove the weak syntax, and use the modified versions to build for C++.

Thanks @dlj-NaN Will for your inputs. I will log a bug in containerd project and see if they can fix the code.

stanguturi avatar Nov 11 '21 08:11 stanguturi

Hi @dlj-NaN, @acozzette ,

The protoc version 3.14.0 was giving the errors. But the protoc version 3.6.1 doesn't have any issue. Are there any special command line flags what can be passed to the latest protoc to ignore the issues?

Thanks, Sankar.

stanguturi avatar Nov 30 '21 09:11 stanguturi

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago.

github-actions[bot] avatar Feb 15 '24 10:02 github-actions[bot]

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.

This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.

github-actions[bot] avatar Mar 01 '24 10:03 github-actions[bot]