OpenLightingProject / ola

The Open Lighting Architecture - The Travel Adaptor for the Lighting Industry
https://www.openlighting.org/ola/
Other
647 stars 205 forks source link

Cannot find the protoc header files #1980

Open ImNoahDev opened 1 month ago

ImNoahDev commented 1 month ago

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?

jcelerier commented 1 month ago

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