Cannot find the protoc header files
Hello,
I am trying to build OLA from source on macos (M2) but when running ./configure I run into this problem:
checking for protoc... /Users/user1/miniconda3/bin/protoc
checking protoc version... 25.3.0
checking for google/protobuf/compiler/command_line_interface.h... no
configure: error: Cannot find the protoc header files
I have tried various ways of installing protobuf but I cannot seem to fix it, can anyone help?
The problem is that the build system forces C++11 while nowadays every compiler defaults to C++17 at least - Xcode has been defaulting to C++20 for two years now, C++11 is older than C++98 was when C++11 was released :)
In particular, recent versions of protoc require abseil which requires at least C++14:
configure:26189: checking protoc version
configure:26216: result: 28.2.0
configure:26240: checking for google/protobuf/compiler/command_line_interface.h
configure:26240: g++ -c -g -O2 -std=gnu++11 conftest.cpp >&5
In file included from /usr/include/absl/base/config.h:92,
from /usr/include/absl/base/attributes.h:37,
from /usr/include/absl/container/btree_map.h:58,
from /usr/include/google/protobuf/compiler/command_line_interface.h:25,
from conftest.cpp:178:
/usr/include/absl/base/policy_checks.h:79:2: error: #error "C++ versions less than C++14 are not supported."
79 | #error "C++ versions less than C++14 are not supported."
| ^~~~~
In file included from /usr/include/absl/base/internal/raw_logging.h:27,
from /usr/include/absl/container/internal/btree.h:61,
from /usr/include/absl/container/btree_map.h:59:
/usr/include/absl/base/log_severity.h: In function 'constexpr const char* absl::lts_20240722::LogSeverityName(LogSeverity)':
--
configure:26245: error: Cannot find the protoc header files
I would suggest removing the forced -std=gnu++11 and let the compiler use their default (more recent) standard
The problem is also that OLA fails to compile against current version of protobuf. You are using protobuf 25.3.0, latest version support is protobuf 21.x. See also https://github.com/OpenLightingProject/ola/issues/1867 and even more relevant https://github.com/OpenLightingProject/ola/issues/1879.
I'd suggest to close this issue and keep the discussion in #1879