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

protobuf-c 1.4.1 won't build against protobuf 22.1 #544

Closed
fazalmajid opened this issue Mar 10, 2023 · 18 comments
Closed

protobuf-c 1.4.1 won't build against protobuf 22.1 #544

fazalmajid opened this issue Mar 10, 2023 · 18 comments

Comments

@fazalmajid
Copy link

It uses macros like GOOGLE_LOG that were defined in protobuf 21 in the file google/protobuf/stubs/macros.h that no longer exists in 22.1, and this now triggers these build errors.

gsed -i -e 's@\(-I..top_srcdir.\)@\1 -I/usr/local/include@g' protobuf-c-1.4.1/Makefile.am
(cd protobuf-c-1.4.1; ./autogen.sh; env CPPFLAGS="--std=c++20 -I/usr/local/include -Iprotobuf-c -I../protobuf-c" LDFLAGS="-L/usr/local/lib -Wl,-R/usr/local/lib -L/usr/local/ssl/lib -Wl,-R/usr/local/ssl/lib -L/usr/local/lib/amd64 -Wl,-R/usr/local/lib/amd64" PKG_CONFIG_PATH=/usr/local/lib/amd64/pkgconfig ./configure --prefix /usr/local --disable-dependency-tracking)
/bin/sh: ./autogen.sh: not found
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... none
checking for g++... g++
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... none needed
checking dependency style of g++... none
checking whether ln -s works... yes
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for wchar.h... yes
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking whether make supports nested variables... (cached) yes
checking build system type... x86_64-pc-linux-musl
checking host system type... x86_64-pc-linux-musl
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/local/bin/gsed
checking for grep that handles long lines and -e... /usr/local/bin/ggrep
checking for egrep... /usr/local/bin/ggrep -E
checking for fgrep... /usr/local/bin/ggrep -F
checking for ld used by gcc... /usr/x86_64-alpine-linux-musl/bin/ld
checking if the linker (/usr/x86_64-alpine-linux-musl/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking the maximum length of command line arguments... 98304
checking how to convert x86_64-pc-linux-musl file names to x86_64-pc-linux-musl format... func_convert_file_noop
checking how to convert x86_64-pc-linux-musl file names to toolchain format... func_convert_file_noop
checking for /usr/x86_64-alpine-linux-musl/bin/ld option to reload object files... -r
checking for file... file
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64
checking if the linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) supports shared libraries... yes
ggrep: warning: stray \ before -
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether C compiler accepts "-Wc99-c11-compat"... yes
checking whether C compiler accepts "-Werror=incompatible-pointer-types"... yes
checking whether C compiler accepts "-Werror=int-conversion"... yes
checking whether C compiler accepts "-Wnull-dereference"... yes
checking for doxygen... no
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking whether g++ supports C++11 features with -std=c++11... yes
checking for protobuf... yes
checking for google/protobuf/compiler/command_line_interface.h... yes
checking for protoc... /usr/local/bin/protoc
checking if LD -Wl,--version-script works... yes
checking whether self tests are run under valgrind... no
checking whether to build with code coverage support... no
checking whether byte ordering is bigendian... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating protobuf-c/libprotobuf-c.pc
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands

    protobuf-c 1.4.1

        CC:                     gcc
        CFLAGS:                 -g -O2
        CXX:                    g++ -std=c++11
        CXXFLAGS:               -g -O2
        LDFLAGS:                -L/usr/local/lib -Wl,-R/usr/local/lib -L/usr/local/ssl/lib -Wl,-R/usr/local/ssl/lib -L/usr/local/lib/amd64 -Wl,-R/usr/local/lib/amd64
        LIBS:                   

        prefix:                 /usr/local
        sysconfdir:             ${prefix}/etc
        libdir:                 ${exec_prefix}/lib
        includedir:             ${prefix}/include
        pkgconfigdir:           ${libdir}/pkgconfig

        bigendian:              no
        protobuf version:       libprotoc 22.1

gsed -i -e 's/rm -vf/rm -f/g' protobuf-c-1.4.1/Makefile
(cd protobuf-c-1.4.1;  gmake -j 12 MAKEFLAGS='-j 12 V=1')
gmake[2]: Entering directory '/home/majid/build/protobuf-c-1.4.1'
 cd . && /bin/sh /home/majid/build/protobuf-c-1.4.1/build-aux/missing automake-1.16 --foreign Makefile
 cd . && /bin/sh ./config.status Makefile depfiles
config.status: creating Makefile
config.status: executing depfiles commands
/usr/local/bin/protoc -I. -I/usr/local/include --cpp_out=. ./protobuf-c/protobuf-c.proto
/usr/local/bin/protoc -I. -I/usr/local/include --cpp_out=. ./protobuf-c/protobuf-c.proto
/usr/local/bin/protoc -I. -I/usr/local/include --cpp_out=. ./t/test-full.proto
/usr/local/bin/protoc -I. -I/usr/local/include --cpp_out=. ./t/test-full.proto
g++ -std=c++11 -DHAVE_CONFIG_H -I.  -include ./config.h -I. -I/usr/local/include/protobuf-c -I. -I. -I/usr/local/include --std=c++20 -I/usr/local/include -Iprotobuf-c -I../protobuf-c  -I/usr/local/include -g -O2 -c -o protoc-c/protoc_gen_c-c_bytes_field.o `test -f 'protoc-c/c_bytes_field.cc' || echo './'`protoc-c/c_bytes_field.cc
g++ -std=c++11 -DHAVE_CONFIG_H -I.  -include ./config.h -I. -I/usr/local/include/protobuf-c -I. -I. -I/usr/local/include --std=c++20 -I/usr/local/include -Iprotobuf-c -I../protobuf-c  -I/usr/local/include -g -O2 -c -o protoc-c/protoc_gen_c-c_enum.o `test -f 'protoc-c/c_enum.cc' || echo './'`protoc-c/c_enum.cc
g++ -std=c++11 -DHAVE_CONFIG_H -I.  -include ./config.h -I. -I/usr/local/include/protobuf-c -I. -I. -I/usr/local/include --std=c++20 -I/usr/local/include -Iprotobuf-c -I../protobuf-c  -I/usr/local/include -g -O2 -c -o protoc-c/protoc_gen_c-c_enum_field.o `test -f 'protoc-c/c_enum_field.cc' || echo './'`protoc-c/c_enum_field.cc
g++ -std=c++11 -DHAVE_CONFIG_H -I.  -include ./config.h -I. -I/usr/local/include/protobuf-c -I. -I. -I/usr/local/include --std=c++20 -I/usr/local/include -Iprotobuf-c -I../protobuf-c  -I/usr/local/include -g -O2 -c -o protoc-c/protoc_gen_c-c_extension.o `test -f 'protoc-c/c_extension.cc' || echo './'`protoc-c/c_extension.cc
g++ -std=c++11 -DHAVE_CONFIG_H -I.  -include ./config.h -I. -I/usr/local/include/protobuf-c -I. -I. -I/usr/local/include --std=c++20 -I/usr/local/include -Iprotobuf-c -I../protobuf-c  -I/usr/local/include -g -O2 -c -o protoc-c/protoc_gen_c-c_field.o `test -f 'protoc-c/c_field.cc' || echo './'`protoc-c/c_field.cc
g++ -std=c++11 -DHAVE_CONFIG_H -I.  -include ./config.h -I. -I/usr/local/include/protobuf-c -I. -I. -I/usr/local/include --std=c++20 -I/usr/local/include -Iprotobuf-c -I../protobuf-c  -I/usr/local/include -g -O2 -c -o protoc-c/protoc_gen_c-c_file.o `test -f 'protoc-c/c_file.cc' || echo './'`protoc-c/c_file.cc
g++ -std=c++11 -DHAVE_CONFIG_H -I.  -include ./config.h -I. -I/usr/local/include/protobuf-c -I. -I. -I/usr/local/include --std=c++20 -I/usr/local/include -Iprotobuf-c -I../protobuf-c  -I/usr/local/include -g -O2 -c -o protoc-c/protoc_gen_c-c_generator.o `test -f 'protoc-c/c_generator.cc' || echo './'`protoc-c/c_generator.cc
g++ -std=c++11 -DHAVE_CONFIG_H -I.  -include ./config.h -I. -I/usr/local/include/protobuf-c -I. -I. -I/usr/local/include --std=c++20 -I/usr/local/include -Iprotobuf-c -I../protobuf-c  -I/usr/local/include -g -O2 -c -o protoc-c/protoc_gen_c-c_helpers.o `test -f 'protoc-c/c_helpers.cc' || echo './'`protoc-c/c_helpers.cc
g++ -std=c++11 -DHAVE_CONFIG_H -I.  -include ./config.h -I. -I/usr/local/include/protobuf-c -I. -I. -I/usr/local/include --std=c++20 -I/usr/local/include -Iprotobuf-c -I../protobuf-c  -I/usr/local/include -g -O2 -c -o protoc-c/protoc_gen_c-c_message.o `test -f 'protoc-c/c_message.cc' || echo './'`protoc-c/c_message.cc
g++ -std=c++11 -DHAVE_CONFIG_H -I.  -include ./config.h -I. -I/usr/local/include/protobuf-c -I. -I. -I/usr/local/include --std=c++20 -I/usr/local/include -Iprotobuf-c -I../protobuf-c  -I/usr/local/include -g -O2 -c -o protoc-c/protoc_gen_c-c_message_field.o `test -f 'protoc-c/c_message_field.cc' || echo './'`protoc-c/c_message_field.cc
g++ -std=c++11 -DHAVE_CONFIG_H -I.  -include ./config.h -I. -I/usr/local/include/protobuf-c -I. -I. -I/usr/local/include --std=c++20 -I/usr/local/include -Iprotobuf-c -I../protobuf-c  -I/usr/local/include -g -O2 -c -o protoc-c/protoc_gen_c-c_primitive_field.o `test -f 'protoc-c/c_primitive_field.cc' || echo './'`protoc-c/c_primitive_field.cc
g++ -std=c++11 -DHAVE_CONFIG_H -I.  -include ./config.h -I. -I/usr/local/include/protobuf-c -I. -I. -I/usr/local/include --std=c++20 -I/usr/local/include -Iprotobuf-c -I../protobuf-c  -I/usr/local/include -g -O2 -c -o protoc-c/protoc_gen_c-c_service.o `test -f 'protoc-c/c_service.cc' || echo './'`protoc-c/c_service.cc
In file included from protoc-c/c_generator.cc:63:
./protoc-c/c_generator.h:98:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
   98 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from protoc-c/c_extension.cc:63:
./protoc-c/c_extension.h:102:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  102 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./protoc-c/c_file.h:70,
                 from protoc-c/c_generator.cc:69:
./protoc-c/c_field.h:108:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  108 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_field.h:125:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  125 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from protoc-c/c_field.cc:63:
./protoc-c/c_field.h:108:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  108 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_field.h:125:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  125 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from protoc-c/c_field.cc:64:
./protoc-c/c_primitive_field.h:88:60: error: 'int google::protobuf::compiler::c::FieldGenerator::GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(google::protobuf::compiler::c::FieldGenerator)' is private within this context
   88 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator);
      |                                                            ^
./protoc-c/c_field.h:108:3: note: declared private here
  108 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_primitive_field.h:88:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type -fpermissive]
   88 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_file.h:107:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  107 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from protoc-c/c_field.cc:65:
./protoc-c/c_string_field.h:91:57: error: 'int google::protobuf::compiler::c::FieldGenerator::GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(google::protobuf::compiler::c::FieldGenerator)' is private within this context
   91 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringFieldGenerator);
      |                                                         ^
./protoc-c/c_field.h:108:3: note: declared private here
  108 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_string_field.h:91:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
   91 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringFieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from protoc-c/c_field.cc:66:
./protoc-c/c_bytes_field.h:91:56: error: 'int google::protobuf::compiler::c::FieldGenerator::GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(google::protobuf::compiler::c::FieldGenerator)' is private within this context
   91 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(BytesFieldGenerator);
      |                                                        ^
./protoc-c/c_field.h:108:3: note: declared private here
  108 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_bytes_field.h:91:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
   91 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(BytesFieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from protoc-c/c_field.cc:67:
./protoc-c/c_enum_field.h:89:55: error: 'int google::protobuf::compiler::c::FieldGenerator::GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(google::protobuf::compiler::c::FieldGenerator)' is private within this context
   89 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator);
      |                                                       ^
./protoc-c/c_field.h:108:3: note: declared private here
  108 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_enum_field.h:89:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
   89 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from protoc-c/c_field.cc:68:
./protoc-c/c_message_field.h:88:58: error: 'int google::protobuf::compiler::c::FieldGenerator::GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(google::protobuf::compiler::c::FieldGenerator)' is private within this context
   88 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator);
      |                                                          ^
./protoc-c/c_field.h:108:3: note: declared private here
  108 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_message_field.h:88:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
   88 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./protoc-c/c_message_field.h:68,
                 from protoc-c/c_message_field.cc:63:
./protoc-c/c_field.h:108:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  108 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./protoc-c/c_file.h:70,
                 from protoc-c/c_file.cc:64:
./protoc-c/c_field.h:108:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  108 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_field.h:125:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  125 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_message_field.h:88:58: error: 'int google::protobuf::compiler::c::FieldGenerator::GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(google::protobuf::compiler::c::FieldGenerator)' is private within this context
   88 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator);
      |                                                          ^
./protoc-c/c_field.h:108:3: note: declared private here
  108 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_message_field.h:88:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
   88 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_field.h:125:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  125 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./protoc-c/c_enum_field.h:68,
                 from protoc-c/c_enum_field.cc:63:
./protoc-c/c_field.h:108:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  108 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./protoc-c/c_message.h:69,
                 from protoc-c/c_message.cc:66:
./protoc-c/c_field.h:108:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  108 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_file.h:107:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  107 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from protoc-c/c_file.cc:65:
./protoc-c/c_enum.h:110:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  110 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_field.h:125:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  125 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from protoc-c/c_file.cc:66:
./protoc-c/c_service.h:104:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  104 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ServiceGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_field.h:125:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  125 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from protoc-c/c_file.cc:67:
./protoc-c/c_extension.h:102:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  102 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_enum_field.h:89:55: error: 'int google::protobuf::compiler::c::FieldGenerator::GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(google::protobuf::compiler::c::FieldGenerator)' is private within this context
   89 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator);
      |                                                       ^
./protoc-c/c_field.h:108:3: note: declared private here
  108 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_enum_field.h:89:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
   89 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from protoc-c/c_enum.cc:66:
./protoc-c/c_enum.h:110:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  110 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_message.h:140:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  140 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from protoc-c/c_message.cc:67:
./protoc-c/c_enum.h:110:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  110 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from protoc-c/c_message.cc:68:
./protoc-c/c_extension.h:102:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  102 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./protoc-c/c_bytes_field.h:68,
                 from protoc-c/c_bytes_field.cc:63:
./protoc-c/c_field.h:108:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  108 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_field.h:125:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  125 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_bytes_field.h:91:56: error: 'int google::protobuf::compiler::c::FieldGenerator::GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(google::protobuf::compiler::c::FieldGenerator)' is private within this context
   91 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(BytesFieldGenerator);
      |                                                        ^
./protoc-c/c_field.h:108:3: note: declared private here
  108 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_bytes_field.h:91:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
   91 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(BytesFieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./protoc-c/c_primitive_field.h:68,
                 from protoc-c/c_primitive_field.cc:63:
./protoc-c/c_field.h:108:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  108 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_field.h:125:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  125 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_primitive_field.h:88:60: error: 'int google::protobuf::compiler::c::FieldGenerator::GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(google::protobuf::compiler::c::FieldGenerator)' is private within this context
   88 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator);
      |                                                            ^
./protoc-c/c_field.h:108:3: note: declared private here
  108 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./protoc-c/c_primitive_field.h:88:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type -fpermissive]
   88 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from protoc-c/c_service.cc:63:
./protoc-c/c_service.h:104:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  104 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ServiceGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
protoc-c/c_field.cc: In member function 'const google::protobuf::compiler::c::FieldGenerator& google::protobuf::compiler::c::FieldGeneratorMap::get(const google::protobuf::FieldDescriptor*) const':
protoc-c/c_field.cc:234:3: error: 'GOOGLE_CHECK_EQ' was not declared in this scope; did you mean 'ABSL_CHECK_EQ'?
  234 |   GOOGLE_CHECK_EQ(field->containing_type(), descriptor_);
      |   ^~~~~~~~~~~~~~~
      |   ABSL_CHECK_EQ
In file included from protoc-c/c_file.cc:69:
./protoc-c/c_message.h:140:3: error: ISO C++ forbids declaration of 'GOOGLE_DISALLOW_EVIL_CONSTRUCTORS' with no type [-fpermissive]
  140 |   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
protoc-c/c_helpers.cc: In function 'std::set<std::__cxx11::basic_string<char> > google::protobuf::compiler::c::MakeKeywordsMap()':
protoc-c/c_helpers.cc:289:23: error: 'GOOGLE_ARRAYSIZE' was not declared in this scope; did you mean 'ABSL_ARRAYSIZE'?
  289 |   for (int i = 0; i < GOOGLE_ARRAYSIZE(kKeywordList); i++) {
      |                       ^~~~~~~~~~~~~~~~
      |                       ABSL_ARRAYSIZE
protoc-c/c_message.cc: In member function 'void google::protobuf::compiler::c::MessageGenerator::GenerateMessageDescriptor(google::protobuf::io::Printer*, bool)':
protoc-c/c_message.cc:502:22: error: 'DFATAL' was not declared in this scope
  502 |           GOOGLE_LOG(DFATAL) << "Messages can't have default values!";
      |                      ^~~~~~
protoc-c/c_message.cc:502:11: error: 'GOOGLE_LOG' was not declared in this scope
  502 |           GOOGLE_LOG(DFATAL) << "Messages can't have default values!";
      |           ^~~~~~~~~~
protoc-c/c_helpers.cc: In function 'std::string google::protobuf::compiler::c::CEscape(const std::string&)':
protoc-c/c_helpers.cc:551:3: error: 'GOOGLE_DCHECK_GE' was not declared in this scope; did you mean 'ABSL_DCHECK_GE'?
  551 |   GOOGLE_DCHECK_GE(len, 0);
      |   ^~~~~~~~~~~~~~~~
      |   ABSL_DCHECK_GE
protoc-c/c_primitive_field.cc: In member function 'virtual void google::protobuf::compiler::c::PrimitiveFieldGenerator::GenerateStructMembers(google::protobuf::io::Printer*) const':
protoc-c/c_primitive_field.cc:102:53: error: 'FATAL' was not declared in this scope
  102 |     case FieldDescriptor::TYPE_MESSAGE : GOOGLE_LOG(FATAL) << "not a primitive type"; break;
      |                                                     ^~~~~
protoc-c/c_primitive_field.cc:102:42: error: 'GOOGLE_LOG' was not declared in this scope
  102 |     case FieldDescriptor::TYPE_MESSAGE : GOOGLE_LOG(FATAL) << "not a primitive type"; break;
      |                                          ^~~~~~~~~~
protoc-c/c_primitive_field.cc: In member function 'virtual std::string google::protobuf::compiler::c::PrimitiveFieldGenerator::GetDefaultValue() const':
protoc-c/c_primitive_field.cc:146:18: error: 'DFATAL' was not declared in this scope
  146 |       GOOGLE_LOG(DFATAL) << "unexpected CPPTYPE in c_primitive_field";
      |                  ^~~~~~
protoc-c/c_primitive_field.cc:146:7: error: 'GOOGLE_LOG' was not declared in this scope
  146 |       GOOGLE_LOG(DFATAL) << "unexpected CPPTYPE in c_primitive_field";
      |       ^~~~~~~~~~
protoc-c/c_primitive_field.cc: In member function 'virtual void google::protobuf::compiler::c::PrimitiveFieldGenerator::GenerateDescriptorInitializer(google::protobuf::io::Printer*) const':
protoc-c/c_primitive_field.cc:200:53: error: 'FATAL' was not declared in this scope
  200 |     case FieldDescriptor::TYPE_MESSAGE : GOOGLE_LOG(FATAL) << "not a primitive type"; break;
      |                                                     ^~~~~
protoc-c/c_primitive_field.cc:200:42: error: 'GOOGLE_LOG' was not declared in this scope
  200 |     case FieldDescriptor::TYPE_MESSAGE : GOOGLE_LOG(FATAL) << "not a primitive type"; break;
      |                                          ^~~~~~~~~~
gmake[2]: *** [Makefile:1675: protoc-c/protoc_gen_c-c_generator.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[2]: *** [Makefile:1633: protoc-c/protoc_gen_c-c_extension.o] Error 1
gmake[2]: *** [Makefile:1717: protoc-c/protoc_gen_c-c_message_field.o] Error 1
gmake[2]: *** [Makefile:1619: protoc-c/protoc_gen_c-c_enum_field.o] Error 1
gmake[2]: *** [Makefile:1647: protoc-c/protoc_gen_c-c_field.o] Error 1
gmake[2]: *** [Makefile:1661: protoc-c/protoc_gen_c-c_file.o] Error 1
gmake[2]: *** [Makefile:1605: protoc-c/protoc_gen_c-c_enum.o] Error 1
gmake[2]: *** [Makefile:1703: protoc-c/protoc_gen_c-c_message.o] Error 1
gmake[2]: *** [Makefile:1689: protoc-c/protoc_gen_c-c_helpers.o] Error 1
gmake[2]: *** [Makefile:1745: protoc-c/protoc_gen_c-c_service.o] Error 1
gmake[2]: *** [Makefile:1591: protoc-c/protoc_gen_c-c_bytes_field.o] Error 1
gmake[2]: *** [Makefile:1731: protoc-c/protoc_gen_c-c_primitive_field.o] Error 1
gmake[2]: Leaving directory '/home/majid/build/protobuf-c-1.4.1'
gmake[1]: *** [gmakefiles/protobuf-c.mak:33: protobuf-c-1.4.1/protoc-c/protoc-gen-c] Error 2
gmake[1]: Leaving directory '/home/majid/build'
chenxy1988 added a commit to chenxy1988/protobuf-c that referenced this issue Mar 29, 2023
after upgrade the protobuf to 4.22.x, the protobuf-c cannot compile anymore (protobuf-c#544) due to following changes:
1.protobuf using c++14, that cause the command_line_interface.h report error
2.protobuf using abseil-cpp library instead the trace API with GOOGLE_ header
3. removed GOOGLE_DISALLOW_EVIL_CONSTRUCTORS
@kloczek
Copy link

kloczek commented May 10, 2023

I've been trying to build 1.4.1 + 66a0b0d against protobuf 22.5 and ..

[tkloczko@pers-jacek protobuf-c-1.4.1]$ make V=1
/usr/bin/g++ -std=c++11 -std=c++14 -DHAVE_CONFIG_H -I.  -include ./config.h -I./protobuf-c -I. -I.   -DPROTOBUF_USE_DLLS -DNOMINMAX -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -std=c++17 -fno-rtti -fno-exceptions -c -o protoc-c/protoc_gen_c-c_bytes_field.o `test -f 'protoc-c/c_bytes_field.cc' || echo './'`protoc-c/c_bytes_field.cc
In file included from protoc-c/c_bytes_field.cc:64:
./protoc-c/c_helpers.h: In function ‘int google::protobuf::compiler::c::FieldSyntax(const google::protobuf::FieldDescriptor*)’:
./protoc-c/c_helpers.h:175:31: error: ‘google::protobuf::FileDescriptor::Syntax google::protobuf::FileDescriptor::syntax() const’ is private within this context
  175 |   return field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 ? 3 : 2;
      |          ~~~~~~~~~~~~~~~~~~~~~^~
In file included from ./protoc-c/c_field.h:68,
                 from ./protoc-c/c_bytes_field.h:68,
                 from protoc-c/c_bytes_field.cc:63:
/usr/include/google/protobuf/descriptor.h:2631:31: note: declared private here
 2631 | inline FileDescriptor::Syntax FileDescriptor::syntax() const {
      |                               ^~~~~~~~~~~~~~
./protoc-c/c_helpers.h:175:31: warning: ‘google::protobuf::FileDescriptor::Syntax google::protobuf::FileDescriptor::syntax() const’ is deprecated: Syntax is deprecated in favor of editions.  Please use targeted feature helpers instead (e.g. has_presence, is_packed, requires_utf8_validation, etc). [-Wdeprecated-declarations]
  175 |   return field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 ? 3 : 2;
      |          ~~~~~~~~~~~~~~~~~~~~~^~
/usr/include/google/protobuf/descriptor.h:2631:31: note: declared here
 2631 | inline FileDescriptor::Syntax FileDescriptor::syntax() const {
      |                               ^~~~~~~~~~~~~~
./protoc-c/c_helpers.h:175:53: error: ‘google::protobuf::FileDescriptor::Syntax google::protobuf::FileDescriptor::SYNTAX_PROTO3’ is private within this context
  175 |   return field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 ? 3 : 2;
      |                                                     ^~~~~~~~~~~~~
/usr/include/google/protobuf/descriptor.h:1694:5: note: declared private here
 1694 |     SYNTAX_PROTO3 = 3,
      |     ^~~~~~~~~~~~~
make: *** [Makefile:1597: protoc-c/protoc_gen_c-c_bytes_field.o] Error 1

@kloczek
Copy link

kloczek commented Jun 8, 2023

Looks like missing checking dependencies for absl.

@scpeters
Copy link

I built on #548 and have submitted #556 as a possible fix

@sudhank29
Copy link

sudhank29 commented Jun 27, 2023

I built on #548 and have submitted #556 as a possible fix

With protobuf 22.5 built with gcc 13.1, I see errors like this while linking. Any idea why?

CXXLD protoc-c/protoc-gen-c
/usr/local/lib64/libprotoc.a(command_line_interface.cc.o): In function google::protobuf::compiler::CommandLineInterface::Run(int, char const* const*)': command_line_interface.cc:(.text+0x34ec): undefined reference to google::protobuf::compiler::DiskSourceTree::DiskSourceTree()'
command_line_interface.cc:(.text+0x35de): undefined reference to google::protobuf::compiler::SourceTreeDescriptorDatabase::SourceTreeDescriptorDatabase(google::protobuf::compiler::SourceTree*, google::protobuf::DescriptorDatabase*)' /usr/local/lib64/libprotoc.a(command_line_interface.cc.o): In function google::protobuf::compiler::CommandLineInterface::InitializeDiskSourceTree(google::protobuf::compiler::DiskSourceTree*, google::protobuf::DescriptorDatabase*)':
command_line_interface.cc:(.text+0x4418): undefined reference to google::protobuf::compiler::DiskSourceTree::MapPath(std::basic_string_view<char, std::char_traits<char> >, std::basic_string_view<char, std::char_traits<char> >)' /usr/local/lib64/libprotoc.a(command_line_interface.cc.o): In function google::protobuf::compiler::CommandLineInterface::ParseInputFiles(google::protobuf::DescriptorPool*, google::protobuf::compiler::DiskSourceTree*, std::vector<google::protobuf::FileDescriptor const*, std::allocator<google::protobuf::FileDescriptor const*> >)':
command_line_interface.cc:(.text+0x4d61): undefined reference to absl::lts_20230125::StrReplaceAll[abi:cxx11](std::basic_string_view<char, std::char_traits<char> >, std::initializer_list<std::pair<std::basic_string_view<char, std::char_traits<char> >, std::basic_string_view<char, std::char_traits<char> > > >)' /usr/local/lib64/libprotoc.a(command_line_interface.cc.o): In function google::protobuf::compiler::CommandLineInterface::MakeProtoProtoPathRelative(google::protobuf::compiler::DiskSourceTree
, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, google::protobuf::DescriptorDatabase)':
command_line_interface.cc:(.text+0x5040): undefined reference to google::protobuf::compiler::DiskSourceTree::VirtualFileToDiskFile(std::basic_string_view<char, std::char_traits<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)' command_line_interface.cc:(.text+0x5135): undefined reference to google::protobuf::compiler::DiskSourceTree::DiskFileToVirtualFile(std::basic_string_view<char, std::char_traits >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)'
command_line_interface.cc:(.text+0x535c): undefined reference to google::protobuf::compiler::DiskSourceTree::VirtualFileToDiskFile(std::basic_string_view<char, std::char_traits<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)' /usr/local/lib64/libprotoc.a(command_line_interface.cc.o): In function google::protobuf::compiler::CommandLineInterface::GenerateDependencyManifestFile(std::vector<google::protobuf::FileDescriptor const*, std::allocator<google::protobuf::FileDescriptor const*> > const&, absl::lts_20230125::flat_hash_map<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::unique_ptr<google::protobuf::compiler::CommandLineInterface::GeneratorContextImpl, std::default_deletegoogle::protobuf::compiler::CommandLineInterface::GeneratorContextImpl >, absl::lts_20230125::container_internal::StringHash, absl::lts_20230125::container_internal::StringEq, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits, std::allocator > const, std::unique_ptr<google::protobuf::compiler::CommandLineInterface::GeneratorContextImpl, std::default_deletegoogle::protobuf::compiler::CommandLineInterface::GeneratorContextImpl > > > > const&, google::protobuf::compiler::DiskSourceTree*)':
command_line_interface.cc:(.text+0x8ffe): undefined reference to google::protobuf::compiler::DiskSourceTree::VirtualFileToDiskFile(std::basic_string_view<char, std::char_traits<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)' /usr/local/lib64/libprotoc.a(command_line_interface.cc.o): In function google::protobuf::compiler::MultiFileErrorCollector::MultiFileErrorCollector()':
command_line_interface.cc:(.text._ZN6google8protobuf8compiler23MultiFileErrorCollectorC2Ev[_ZN6google8protobuf8compiler23MultiFileErrorCollectorC5Ev]+0x9): undefined reference to vtable for google::protobuf::compiler::MultiFileErrorCollector' /usr/local/lib64/libprotoc.a(command_line_interface.cc.o): In function google::protobuf::compiler::CommandLineInterface::ErrorPrinter::~ErrorPrinter()':
command_line_interface.cc:(.text._ZN6google8protobuf8compiler20CommandLineInterface12ErrorPrinterD2Ev[_ZN6google8protobuf8compiler20CommandLineInterface12ErrorPrinterD5Ev]+0x5a): undefined reference to google::protobuf::compiler::MultiFileErrorCollector::~MultiFileErrorCollector()' /usr/local/lib64/libprotoc.a(command_line_interface.cc.o): In function google::protobuf::compiler::CommandLineInterface::ErrorPrinter::AddErrorOrWarning(std::basic_string_view<char, std::char_traits >, int, int, std::basic_string_view<char, std::char_traits >, std::basic_string_view<char, std::char_traits >, std::ostream&)':
command_line_interface.cc:(.text._ZN6google8protobuf8compiler20CommandLineInterface12ErrorPrinter17AddErrorOrWarningESt17basic_string_viewIcSt11char_traitsIcEEiiS7_S7_RSo[_ZN6google8protobuf8compiler20CommandLineInterface12ErrorPrinter17AddErrorOrWarningESt17basic_string_viewIcSt11char_traitsIcEEiiS7_S7_RSo]+0x66): undefined reference to google::protobuf::compiler::DiskSourceTree::VirtualFileToDiskFile(std::basic_string_view<char, std::char_traits<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)' /usr/local/lib64/libprotoc.a(command_line_interface.cc.o):(.rodata._ZTIN6google8protobuf8compiler20CommandLineInterface12ErrorPrinterE[_ZTIN6google8protobuf8compiler20CommandLineInterface12ErrorPrinterE]+0x18): undefined reference to typeinfo for google::protobuf::compiler::MultiFileErrorCollector'
collect2: error: ld returned 1 exit status
make: *** [Makefile:1226: protoc-c/protoc-gen-c] Error 1

@sudhank29
Copy link

I built on #548 and have submitted #556 as a possible fix

With protobuf 22.5 built with gcc 13.1, I see errors like this while linking. Any idea why?

CXXLD protoc-c/protoc-gen-c /usr/local/lib64/libprotoc.a(command_line_interface.cc.o): In function google::protobuf::compiler::CommandLineInterface::Run(int, char const* const*)': command_line_interface.cc:(.text+0x34ec): undefined reference to google::protobuf::compiler::DiskSourceTree::DiskSourceTree()' command_line_interface.cc:(.text+0x35de): undefined reference to google::protobuf::compiler::SourceTreeDescriptorDatabase::SourceTreeDescriptorDatabase(google::protobuf::compiler::SourceTree*, google::protobuf::DescriptorDatabase*)' /usr/local/lib64/libprotoc.a(command_line_interface.cc.o): In function google::protobuf::compiler::CommandLineInterface::InitializeDiskSourceTree(google::protobuf::compiler::DiskSourceTree*, google::protobuf::DescriptorDatabase*)': command_line_interface.cc:(.text+0x4418): undefined reference to google::protobuf::compiler::DiskSourceTree::MapPath(std::basic_string_view<char, std::char_traits<char> >, std::basic_string_view<char, std::char_traits<char> >)' /usr/local/lib64/libprotoc.a(command_line_interface.cc.o): In function google::protobuf::compiler::CommandLineInterface::ParseInputFiles(google::protobuf::DescriptorPool*, google::protobuf::compiler::DiskSourceTree*, std::vector<google::protobuf::FileDescriptor const*, std::allocator<google::protobuf::FileDescriptor const*> >)': command_line_interface.cc:(.text+0x4d61): undefined reference to absl::lts_20230125::StrReplaceAll[abi:cxx11](std::basic_string_view<char, std::char_traits<char> >, std::initializer_list<std::pair<std::basic_string_view<char, std::char_traits<char> >, std::basic_string_view<char, std::char_traits<char> > > >)' /usr/local/lib64/libprotoc.a(command_line_interface.cc.o): In function google::protobuf::compiler::CommandLineInterface::MakeProtoProtoPathRelative(google::protobuf::compiler::DiskSourceTree, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, google::protobuf::DescriptorDatabase)': command_line_interface.cc:(.text+0x5040): undefined reference to google::protobuf::compiler::DiskSourceTree::VirtualFileToDiskFile(std::basic_string_view<char, std::char_traits<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)' command_line_interface.cc:(.text+0x5135): undefined reference to google::protobuf::compiler::DiskSourceTree::DiskFileToVirtualFile(std::basic_string_view<char, std::char_traits >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)' command_line_interface.cc:(.text+0x535c): undefined reference to google::protobuf::compiler::DiskSourceTree::VirtualFileToDiskFile(std::basic_string_view<char, std::char_traits<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)' /usr/local/lib64/libprotoc.a(command_line_interface.cc.o): In function google::protobuf::compiler::CommandLineInterface::GenerateDependencyManifestFile(std::vector<google::protobuf::FileDescriptor const*, std::allocator<google::protobuf::FileDescriptor const*> > const&, absl::lts_20230125::flat_hash_map<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::unique_ptr<google::protobuf::compiler::CommandLineInterface::GeneratorContextImpl, std::default_deletegoogle::protobuf::compiler::CommandLineInterface::GeneratorContextImpl >, absl::lts_20230125::container_internal::StringHash, absl::lts_20230125::container_internal::StringEq, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits, std::allocator > const, std::unique_ptr<google::protobuf::compiler::CommandLineInterface::GeneratorContextImpl, std::default_deletegoogle::protobuf::compiler::CommandLineInterface::GeneratorContextImpl > > > > const&, google::protobuf::compiler::DiskSourceTree*)': command_line_interface.cc:(.text+0x8ffe): undefined reference to google::protobuf::compiler::DiskSourceTree::VirtualFileToDiskFile(std::basic_string_view<char, std::char_traits<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)' /usr/local/lib64/libprotoc.a(command_line_interface.cc.o): In function google::protobuf::compiler::MultiFileErrorCollector::MultiFileErrorCollector()': command_line_interface.cc:(.text._ZN6google8protobuf8compiler23MultiFileErrorCollectorC2Ev[_ZN6google8protobuf8compiler23MultiFileErrorCollectorC5Ev]+0x9): undefined reference to vtable for google::protobuf::compiler::MultiFileErrorCollector' /usr/local/lib64/libprotoc.a(command_line_interface.cc.o): In function google::protobuf::compiler::CommandLineInterface::ErrorPrinter::~ErrorPrinter()': command_line_interface.cc:(.text._ZN6google8protobuf8compiler20CommandLineInterface12ErrorPrinterD2Ev[_ZN6google8protobuf8compiler20CommandLineInterface12ErrorPrinterD5Ev]+0x5a): undefined reference to google::protobuf::compiler::MultiFileErrorCollector::~MultiFileErrorCollector()' /usr/local/lib64/libprotoc.a(command_line_interface.cc.o): In function google::protobuf::compiler::CommandLineInterface::ErrorPrinter::AddErrorOrWarning(std::basic_string_view<char, std::char_traits >, int, int, std::basic_string_view<char, std::char_traits >, std::basic_string_view<char, std::char_traits >, std::ostream&)': command_line_interface.cc:(.text._ZN6google8protobuf8compiler20CommandLineInterface12ErrorPrinter17AddErrorOrWarningESt17basic_string_viewIcSt11char_traitsIcEEiiS7_S7_RSo[_ZN6google8protobuf8compiler20CommandLineInterface12ErrorPrinter17AddErrorOrWarningESt17basic_string_viewIcSt11char_traitsIcEEiiS7_S7_RSo]+0x66): undefined reference to google::protobuf::compiler::DiskSourceTree::VirtualFileToDiskFile(std::basic_string_view<char, std::char_traits<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)' /usr/local/lib64/libprotoc.a(command_line_interface.cc.o):(.rodata._ZTIN6google8protobuf8compiler20CommandLineInterface12ErrorPrinterE[_ZTIN6google8protobuf8compiler20CommandLineInterface12ErrorPrinterE]+0x18): undefined reference to typeinfo for google::protobuf::compiler::MultiFileErrorCollector' collect2: error: ld returned 1 exit status make: *** [Makefile:1226: protoc-c/protoc-gen-c] Error 1

Is there a known version combination of libprotobuf-c and protobuf that works?
Don't need to be on latest and greatest - anything that supports proto3 (including optional keyword) will do.

@edmonds
Copy link
Member

edmonds commented Jul 3, 2023

Hi,

Please try out the branch in #673 with either protobuf 22.5 or protobuf 23.3.

Thanks!

@kloczek
Copy link

kloczek commented Jul 3, 2023

Is it any chance backport those changes for protobuf 21.x (last version which is not using absl)?

@edmonds
Copy link
Member

edmonds commented Jul 3, 2023

Is it any chance backport those changes for protobuf 21.x (last version which is not using absl)?

The changes in #673 add support for protobuf 22.x and 23.x. They do not remove support for previous versions of protobuf. So there is nothing to backport, we would simply merge #673 and release a new version of protobuf-c.

@jmckenna
Copy link

jmckenna commented Jul 7, 2023

The changes in #673 add support for protobuf 22.x and 23.x. They do not remove support for previous versions of protobuf. So there is nothing to backport, we would simply merge #673 and release a new version of protobuf-c.

@edmonds Let me know if you need help doing this (merge and release). I imagine many (including myself) are needing this. I think at least it should be merged into master, whereas the release can happen later. thanks.

@jmckenna
Copy link

jmckenna commented Jul 7, 2023

Update: I better test the pull request first ha (Windows, CMake), will update that PR with my findings.

@sudhank29
Copy link

sudhank29 commented Jul 27, 2023

Hi,

Please try out the branch in #673 with either protobuf 22.5 or protobuf 23.3.

Thanks!

Could build successfully with protobuf 23.3. Thanks!
Any timeline for this "next" branch to merge to mainline ?

@clementperon
Copy link

@edmonds Confirm, it fixes my issue too. Would be nice to have a new release.

@pkovacs
Copy link

pkovacs commented Oct 26, 2023

I can confirm that this patch also allows protobuf-c to work with protobuf 24. I got the seemingly common missing header error below, but running autoreconf and then re-running configure cleared it up.

$ ./configure --disable-static
...
checking for protobuf... yes
checking for google/protobuf/compiler/command_line_interface.h... no
configure: error: required protobuf header file not found
$ autoreconf
$ ./configure --disable-static
...
checking for protobuf... yes
checking google/protobuf/compiler/command_line_interface.h usability... yes
checking google/protobuf/compiler/command_line_interface.h presence... yes
checking for google/protobuf/compiler/command_line_interface.h... yes
checking for protoc... /usr/bin/protoc
...
$ protoc-c --version
protobuf-c 1.4.1
libprotoc 24.4

@0-wiz-0
Copy link

0-wiz-0 commented Nov 3, 2023

Please make a new release that includes this fix. Thank you.

@Sanrahul02
Copy link

Do we have an update on a release for this issue @0-wiz-0

@ghmj2417
Copy link

Add another one to the list waiting on a release.

@edmonds
Copy link
Member

edmonds commented Nov 26, 2023

Hi, thanks for testing. This should be fixed in the 1.5.0 release.

@edmonds edmonds closed this as completed Nov 26, 2023
@kloczek
Copy link

kloczek commented Nov 26, 2023

I can confirm that 1.5.0 is OK now.
Thank you 👍 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests