Skip to content

Commit

Permalink
fix compilation issue with gcc13 on cpu (#69785)
Browse files Browse the repository at this point in the history
  • Loading branch information
0x3878f authored Nov 29, 2024
1 parent 418887c commit d5b4b1f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmake/external/brpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,23 @@ set(prefix_path
"${THIRD_PARTY_PATH}/install/gflags|${THIRD_PARTY_PATH}/install/leveldb|${THIRD_PARTY_PATH}/install/snappy|${THIRD_PARTY_PATH}/install/gtest|${THIRD_PARTY_PATH}/install/protobuf|${THIRD_PARTY_PATH}/install/zlib|${THIRD_PARTY_PATH}/install/glog"
)

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND ${CMAKE_CXX_COMPILER_VERSION}
VERSION_GREATER_EQUAL 13.0)
file(TO_NATIVE_PATH ${PADDLE_SOURCE_DIR}/patches/brpc/http2.h.patch
http2_h_patch)
set(BRPC_PATCH_COMMAND_GCC13 git apply ${http2_h_patch})
endif()

# If minimal .a is need, you can set WITH_DEBUG_SYMBOLS=OFF
ExternalProject_Add(
extern_brpc
${EXTERNAL_PROJECT_LOG_ARGS}
SOURCE_DIR ${BRPC_SOURCE_DIR}
PREFIX ${BRPC_PREFIX_DIR}
UPDATE_COMMAND ""
PATCH_COMMAND
COMMAND git checkout -- . && git checkout ${BRPC_TAG}
COMMAND ${BRPC_PATCH_COMMAND_GCC13}
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
Expand Down
12 changes: 12 additions & 0 deletions patches/brpc/http2.h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/src/brpc/http2.h b/src/brpc/http2.h
index 9a40d40d..5da47e60 100644
--- a/src/brpc/http2.h
+++ b/src/brpc/http2.h
@@ -19,6 +19,7 @@
#define BAIDU_RPC_HTTP2_H

#include "brpc/http_status_code.h"
+#include <cstdint>

// To baidu-rpc developers: This is a header included by user, don't depend
// on internal structures, use opaque pointers instead.

0 comments on commit d5b4b1f

Please sign in to comment.