protocolbuffers/protobuf

Generated C++ code with dllexport_decl and deprecated incompatible with GCC 12 or older

Opened this issue · 0 comments

cho-m commented

What version of protobuf and what language are you using?
Version: v29.0
Language: C++

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

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

What did you do?
Steps to reproduce the behavior:

  1. Build Protobuf v29.0 release
  2. Generate C++ code with option deprecated = true and --cpp_out=dllexport_decl=...
  3. Use GCC 11 (or 12) to compile resulting code
  4. See syntax errors

Specifically seen when building Apache Arrow but a minimal .proto should also work.

What did you expect to see
Successful compilation.

Or at least a documented mention of minimum GCC change. I would have thought https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md applied based on https://protobuf.dev/support/version-support/#changes

What did you see instead?

Compilation failure (most likely from 23aada2). Seen while updating to Protobuf 29 in Homebrew Homebrew/homebrew-core#199285

apache-arrow-18.1.0/build/src/arrow/flight/sql/FlightSql.pb.h:6442:31: error: expected identifier before ‘[’ token
 6442 | class ARROW_FLIGHT_SQL_EXPORT [[deprecated]] ActionCancelQueryResult final
      |                               ^

Anything else we should know about your project / environment

Building in Homebrew environment.

May be related to https://developers.redhat.com/articles/2023/06/21/new-c-features-gcc-13#additional_updates which mentions GCC 13 is the first release to support mixing of GNU and standard attributes.

No compilation issues on GCC 13 or 14.