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

error: static_assert failed due to requirement '201103L >= 201402L' "Protobuf only supports C++14 and newer." #2522

Closed
BinaryRyan opened this issue Jan 25, 2024 · 1 comment

Comments

@BinaryRyan
Copy link

BinaryRyan commented Jan 25, 2024

Describe the bug (description bug)

After successfully compiling protobuf, I attempted to compile brpc, but it kept reporting that my compiler doesn't support C++14. I didn't encounter this error when compiling protobuf, and I'm not sure where this 201103L is coming from.

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_COMPILER /usr/bin/g++)


if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
    if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8)
        message(FATAL_ERROR "GCC is too old, please install a newer version supporting C++17")
    endif()
elseif((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
    if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5)
        message(FATAL_ERROR "Clang is too old, please install a newer version supporting C++17")
    endif()
else()
    message(WARNING "You are using an unsupported compiler ${CMAKE_CXX_COMPILER_ID}! Compilation has only been tested with Clang and GCC.")
endif()
......
include(googletest)
include(benchmark)
include(leveldb)
include(gflags)
include(jsoncpp)
include(abseil)
include(protobuf)
if(UNIX OR APPLE)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -std=c++17")
endif()

message(STATUS "CMAKE_CXX_FLAGS:${CMAKE_CXX_FLAGS}")
include(brpc)
set(FETCHCONTENT_BASE_DIR ${CMAKE_BINARY_DIR}/third-party)
FetchContent_Declare(
  brpc
  URL ${BRPC_URL}
)

FetchContent_GetProperties(brpc)
if(NOT brpc_POPULATED)
  FetchContent_Populate(
    brpc
  )
endif()

ExternalProject_Add(
  brpc_ext
  SOURCE_DIR         "${CMAKE_BINARY_DIR}/third-party/brpc-src"
  BINARY_DIR         "${CMAKE_BINARY_DIR}/third-party/brpc-build"
  CMAKE_ARGS         ${COMMON_FLAGS_CMAKE}
  # Wrap download, configure and build steps in a script to log output
  LOG_DOWNLOAD       ON
  LOG_CONFIGURE      ON
  LOG_BUILD          ON
  TEST_COMMAND       ""
  DEPENDS            protobuf_ext leveldb_ext
)

ExternalProject_Get_Property(brpc_ext source_dir binary_dir)

To Reproduce (复现方法)

Expected behavior (expect )
compile successfully

Versions (version)
OS: macos m1
Compiler: Apple clang version 14.0.0 (clang-1400.0.29.202)
brpc: 1.7
protobuf: 24.4

Additional context/screenshots (more screen shot)

image image image
@wasphin
Copy link
Member

wasphin commented Jan 26, 2024

Protobuf with version >= 22 is not supported by now.

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

2 participants