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

Compiler warnings when building for Python 3.7 and 3.8 #7930

Closed
dlj-NaN opened this issue Sep 29, 2020 · 2 comments · Fixed by #8339
Closed

Compiler warnings when building for Python 3.7 and 3.8 #7930

dlj-NaN opened this issue Sep 29, 2020 · 2 comments · Fixed by #8339
Assignees
Labels

Comments

@dlj-NaN
Copy link
Contributor

dlj-NaN commented Sep 29, 2020

Example from tox logs:

py37-cpp run-test: commands[1] | python setup.py -q build --cpp_implementation --warnings_as_errors --compile_static_extension
google/protobuf/pyext/message.cc: In function ‘PyObject* google::protobuf::python::cmessage::MergeFromString(google::protobuf::python::CMessage*, PyObject*)’:
google/protobuf/pyext/message.cc:1945:53: error: ‘int PyObject_AsReadBuffer(PyObject*, const void**, Py_ssize_t*)’ is deprecated [-Werror=deprecated-declarations]
   if (PyObject_AsReadBuffer(arg, &data, &data_length) < 0) {
                                                     ^
In file included from /usr/local/include/python3.7m/Python.h:147,
                 from ./google/protobuf/pyext/message.h:37,
                 from google/protobuf/pyext/message.cc:34:
/usr/local/include/python3.7m/abstract.h:489:17: note: declared here
 PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
                 ^~~~~~~~~~~~~~~~~~~~~
google/protobuf/pyext/message.cc:1945:53: error: ‘int PyObject_AsReadBuffer(PyObject*, const void**, Py_ssize_t*)’ is deprecated [-Werror=deprecated-declarations]
   if (PyObject_AsReadBuffer(arg, &data, &data_length) < 0) {
                                                     ^
In file included from /usr/local/include/python3.7m/Python.h:147,
                 from ./google/protobuf/pyext/message.h:37,
                 from google/protobuf/pyext/message.cc:34:
/usr/local/include/python3.7m/abstract.h:489:17: note: declared here
 PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
                 ^~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
error: command 'gcc' failed with exit status 1
ERROR: InvocationError for command /tmp/protobuf/protobuf/python/.tox/py37-cpp/bin/python setup.py -q build --cpp_implementation --warnings_as_errors --compile_static_extension (exited with code 1)
___________________________________ summary ____________________________________
ERROR:   py37-cpp: commands failed

The "new" buffer API is available across all versions we care about, but it will take a little bit of legwork. For now, I think we may want to disable the --warnings_as_errors flag temporarily in our tox config.

@wchargin
Copy link

wchargin commented Oct 9, 2020

This also shows up in downstream Bazel projects that set
--define=use_fast_cpp_protos=true. It causes spam in all of our build
logs, and there’s nothing that we can do about it. Please fix.

(protobuf is currently the cause of all spam in our build logs; among
all our dependencies, it is uniquely poorly behaved.)

@dlj-NaN
Copy link
Contributor Author

dlj-NaN commented Oct 9, 2020

@wchargin It looks like the corresponding flag has been in BUILD for quite some time now: https://github.com/protocolbuffers/protobuf/blame/master/BUILD#L88

Can you verify what version your WORKSPACE uses for the protobuf library, and what compiler you're using?

shadchin added a commit to shadchin/protobuf that referenced this issue Feb 24, 2021
"Old" buffer API will removed in Python 3.10. This is also fix protocolbuffers#7930.
shadchin added a commit to shadchin/protobuf that referenced this issue Feb 24, 2021
"Old" buffer API will removed in Python 3.10. This is also fix protocolbuffers#7930.
shadchin added a commit to shadchin/protobuf that referenced this issue Mar 2, 2021
"Old" buffer API will removed in Python 3.10. This is also fix protocolbuffers#7930.
dlj-NaN pushed a commit that referenced this issue Mar 4, 2021
"Old" buffer API will removed in Python 3.10. This is also fix #7930.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants