From ec59491855e55c35d953b8c8f6d1b90076f3d9e2 Mon Sep 17 00:00:00 2001 From: "pratik.pugalia@gmail.com" Date: Tue, 26 Aug 2025 15:10:48 -0700 Subject: [PATCH] [native] Build for Gcc14 (#25861) Summary: Fix to support GCC14 build - Replace `{}` with explicit empty container to avoid the following error within optionals. error: converting to 'std::in_place_t' from list would use explicit contructor `{}` leads to copy initialization which is not allowed since in_place_t is marked explicit - Add Import `chrono` in `Duration.h` as gcc14 mandates having it - Correct include directory path for proxygen - Ignore errors associated with template-id-cdtor as gcc14 fails build for constructors having template support Rollback Plan: ``` == NO RELEASE NOTE == ``` Differential Revision: D80784416 Pulled By: pratikpugalia --- presto-native-execution/CMakeLists.txt | 8 +++++++- .../main/operators/tests/BinarySortableSerializerTest.cpp | 2 +- .../presto_cpp/main/operators/tests/BroadcastTest.cpp | 2 +- .../presto_cpp/presto_protocol/core/Duration.h | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/presto-native-execution/CMakeLists.txt b/presto-native-execution/CMakeLists.txt index b85d27d8c691e..d09c9fad6c98b 100644 --- a/presto-native-execution/CMakeLists.txt +++ b/presto-native-execution/CMakeLists.txt @@ -33,6 +33,12 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SCRIPT_CXX_FLAGS}") set(DISABLED_WARNINGS "-Wno-nullability-completeness -Wno-deprecated-declarations") +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "14.0.0") + string(APPEND DISABLED_WARNINGS " -Wno-error=template-id-cdtor") + endif() +endif() + # Important warnings that must be explicitly enabled. set(ENABLE_WARNINGS "-Wreorder") @@ -221,7 +227,7 @@ include_directories(SYSTEM ${FBTHRIFT_INCLUDE_DIR}) set(PROXYGEN_LIBRARIES ${PROXYGEN_HTTP_SERVER} ${PROXYGEN} ${WANGLE} ${FIZZ} ${MVFST_EXCEPTION}) find_path(PROXYGEN_DIR NAMES include/proxygen) -set(PROXYGEN_INCLUDE_DIR "${PROXYGEN_DIR}/include/proxygen") +set(PROXYGEN_INCLUDE_DIR "${PROXYGEN_DIR}/include/") include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR} ${PROXYGEN_INCLUDE_DIR}) include_directories(.) diff --git a/presto-native-execution/presto_cpp/main/operators/tests/BinarySortableSerializerTest.cpp b/presto-native-execution/presto_cpp/main/operators/tests/BinarySortableSerializerTest.cpp index 4db5793e31708..77481b697befb 100644 --- a/presto-native-execution/presto_cpp/main/operators/tests/BinarySortableSerializerTest.cpp +++ b/presto-native-execution/presto_cpp/main/operators/tests/BinarySortableSerializerTest.cpp @@ -1045,7 +1045,7 @@ TEST_F(BinarySortableSerializerTest, ArrayTypeSingleFieldTests) { // null < [] EXPECT_TRUE( singleArrayFieldCompare( - {std::nullopt, {{}}}, velox::core::kAscNullsFirst) < 0); + {std::nullopt, {std::vector>{}}}, velox::core::kAscNullsFirst) < 0); } TEST_F(BinarySortableSerializerTest, RowTypeSingleFieldTests) { diff --git a/presto-native-execution/presto_cpp/main/operators/tests/BroadcastTest.cpp b/presto-native-execution/presto_cpp/main/operators/tests/BroadcastTest.cpp index c685ede460fee..95e63ca080251 100644 --- a/presto-native-execution/presto_cpp/main/operators/tests/BroadcastTest.cpp +++ b/presto-native-execution/presto_cpp/main/operators/tests/BroadcastTest.cpp @@ -272,7 +272,7 @@ TEST_F(BroadcastTest, endToEndSerdeLayout) { runBroadcastTest({data}, {{"c1", "c1", "c2"}}); // Skip all. - runBroadcastTest({data}, {{}}); + runBroadcastTest({data}, {std::vector{}}); } TEST_F(BroadcastTest, endToEndWithNoRows) { diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/Duration.h b/presto-native-execution/presto_cpp/presto_protocol/core/Duration.h index e0aae14020320..0a5bf10f0589f 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/core/Duration.h +++ b/presto-native-execution/presto_cpp/presto_protocol/core/Duration.h @@ -13,6 +13,7 @@ */ #pragma once #include +#include namespace facebook::presto::protocol {