Description
What version of protobuf and what language are you using?
Version: main
Language: C++
What operating system (Linux, Windows, ...) and version?
macOS Sonoma 14.6.1 (23G93) - Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000 arm64
FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
What runtime / compiler are you using (e.g., python version or gcc version)
macOS: Apple clang version 15.0.0 (clang-1500.3.9.4)
FreeBSD: FreeBSD clang version 18.1.5
What did you do?
Trying to use protobuf (latest HomeBrew and BSD ports version) for building syslog-ng on macOS and FreeBSD using clang with grpc support.
Also built protobuf from source (main branch), the same result.
Steps to reproduce the behavior:
- Try to build syslog-ng (https://github.com/syslog-ng/syslog-ng) master branch using cmake with grpc support
- During the configure phase one will see the following error
CMake Error at /usr/local/lib/cmake/protobuf/protobuf-targets.cmake:42 (message):
Some (but not all) targets in this export set were already defined.
Targets Defined: protobuf::libprotobuf-lite, protobuf::libprotobuf,
protobuf::libprotoc, protobuf::protoc
Targets not yet defined: protobuf::libupb, protobuf::protoc-gen-upb,
protobuf::protoc-gen-upbdefs, protobuf::protoc-gen-upb_minitable
Anything else we should know about your project / environment
The error is caused by the unnecessarily forced libupb
targets in the ${INSTALL_TARGET}/lib/cmake/protobuf/protobuf-targets.cmake
file.
Some projects, like syslog-ng might not use libupb
at all.
Removing any references to the
protobuf::libupb, protobuf::protoc-gen-upb, protobuf::protoc-gen-upbdefs, protobuf::protoc-gen-upb_minitable
targets will solve the issue, syslog-ng can be built perfectly with grpc support
Please make libupb
usage optional (probably a build option like -Dprotobuf_USE_LIBUPB=OFF
could do the trick).