Skip to content

CMake protobuf_generate is missing cpp_out directory #12450

@scharri

Description

@scharri

What version of protobuf and what language are you using?
v22.2

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

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

What did you do?
Steps to reproduce the behavior:

  1. Clone repository, checkout v22.2, build and install it.
  2. Go into protobuf/example folder, create dir build and go into it.
  3. Call cmake ../ and make
  4. See error

What did you expect to see
I expect that addressbook.proto is compiled by the protoc and resulted .pb.c and .pb.h are available to build add_person.cc

What did you see instead?
When protoc is running on addressbook.proto you get the output: cpp_out: No such file or directory and off course building add_preson.cc fails because addressbook.pb.h is not available.

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

cmake ../
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.13")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /home/stefan/sources/motionConnect/protobuf/examples/build
❯ make
[ 12%] Running cpp protocol buffer compiler on addressbook.proto
make[2]: cpp_out: No such file or directory
[ 25%] Building CXX object CMakeFiles/add_person_cpp.dir/add_person.cc.o
/home/stefan/sources/motionConnect/protobuf/examples/add_person.cc:9:10: fatal error: addressbook.pb.h: No such file or directory
9 | #include "addressbook.pb.h"
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/add_person_cpp.dir/build.make:83: CMakeFiles/add_person_cpp.dir/add_person.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/add_person_cpp.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Anything else we should know about your project / environment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions