From 66f00f3a4ab0d6681f43ae1acf29a938a94fc04e Mon Sep 17 00:00:00 2001 From: David Li Date: Wed, 8 Jun 2022 15:32:48 -0400 Subject: [PATCH 1/4] ARROW-16788: [C++] Remove hardening flags gRPC doesn't support --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 4518576b569..a46ef9791e9 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -3657,8 +3657,21 @@ macro(build_grpc) # Yuck, see https://stackoverflow.com/a/45433229/776560 string(REPLACE ";" "|" GRPC_PREFIX_PATH_ALT_SEP "${GRPC_CMAKE_PREFIX}") + # Negate warnings that gRPC cannot build under + # See https://github.com/grpc/grpc/issues/29417 + set(GRPC_C_FLAGS + "${EP_C_FLAGS} -Wno-attributes -Wno-format-security -Wno-unknown-warning-option") + set(GRPC_CXX_FLAGS + "${EP_CXX_FLAGS} -Wno-attributes -Wno-format-security -Wno-unknown-warning-option") + string(REPLACE "-Wformat-security" "" GRPC_C_FLAGS "${GRPC_C_FLAGS}") + string(REPLACE "-Wformat-security" "" GRPC_CXX_FLAGS "${GRPC_CXX_FLAGS}") + set(GRPC_CMAKE_ARGS "${EP_COMMON_CMAKE_ARGS}" + "-DCMAKE_C_FLAGS=${GRPC_C_FLAGS}" + "-DCMAKE_CXX_FLAGS=${GRPC_CXX_FLAGS}" + "-DCMAKE_C_FLAGS_${UPPERCASE_BUILD_TYPE}=${GRPC_C_FLAGS}" + "-DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${GRPC_CXX_FLAGS}" -DCMAKE_PREFIX_PATH='${GRPC_PREFIX_PATH_ALT_SEP}' -DgRPC_ABSL_PROVIDER=package -DgRPC_BUILD_CSHARP_EXT=OFF From 4628035a6d2f4ffa93b6c01658b51057fa1c1318 Mon Sep 17 00:00:00 2001 From: David Li Date: Wed, 8 Jun 2022 19:43:57 -0400 Subject: [PATCH 2/4] Address feedback --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index a46ef9791e9..cce92d48d1d 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -3657,14 +3657,15 @@ macro(build_grpc) # Yuck, see https://stackoverflow.com/a/45433229/776560 string(REPLACE ";" "|" GRPC_PREFIX_PATH_ALT_SEP "${GRPC_CMAKE_PREFIX}") - # Negate warnings that gRPC cannot build under - # See https://github.com/grpc/grpc/issues/29417 - set(GRPC_C_FLAGS - "${EP_C_FLAGS} -Wno-attributes -Wno-format-security -Wno-unknown-warning-option") - set(GRPC_CXX_FLAGS - "${EP_CXX_FLAGS} -Wno-attributes -Wno-format-security -Wno-unknown-warning-option") - string(REPLACE "-Wformat-security" "" GRPC_C_FLAGS "${GRPC_C_FLAGS}") - string(REPLACE "-Wformat-security" "" GRPC_CXX_FLAGS "${GRPC_CXX_FLAGS}") + if(NOT MSVC) + # Negate warnings that gRPC cannot build under + # See https://github.com/grpc/grpc/issues/29417 + set(GRPC_C_FLAGS + "${EP_C_FLAGS} -Wno-attributes -Wno-format-security -Wno-unknown-warning-option") + set(GRPC_CXX_FLAGS + "${EP_CXX_FLAGS} -Wno-attributes -Wno-format-security -Wno-unknown-warning-option" + ) + endif() set(GRPC_CMAKE_ARGS "${EP_COMMON_CMAKE_ARGS}" From 2c6623285c1e89880fd9720b4c7b259f5c8ffa33 Mon Sep 17 00:00:00 2001 From: David Li Date: Wed, 8 Jun 2022 20:00:09 -0400 Subject: [PATCH 3/4] Fix dumb mistake --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index cce92d48d1d..2fe20afe8e4 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -3657,13 +3657,15 @@ macro(build_grpc) # Yuck, see https://stackoverflow.com/a/45433229/776560 string(REPLACE ";" "|" GRPC_PREFIX_PATH_ALT_SEP "${GRPC_CMAKE_PREFIX}") + set(GRPC_C_FLAGS "${EP_C_FLAGS}") + set(GRPC_CXX_FLAGS "${EP_CXX_FLAGS}") if(NOT MSVC) # Negate warnings that gRPC cannot build under # See https://github.com/grpc/grpc/issues/29417 set(GRPC_C_FLAGS - "${EP_C_FLAGS} -Wno-attributes -Wno-format-security -Wno-unknown-warning-option") + "${GRPC_C_FLAGS} -Wno-attributes -Wno-format-security -Wno-unknown-warning-option") set(GRPC_CXX_FLAGS - "${EP_CXX_FLAGS} -Wno-attributes -Wno-format-security -Wno-unknown-warning-option" + "${GRPC_CXX_FLAGS} -Wno-attributes -Wno-format-security -Wno-unknown-warning-option" ) endif() From 8b8a8f93be22777cb324a7b978b5f50b2788e097 Mon Sep 17 00:00:00 2001 From: David Li Date: Wed, 8 Jun 2022 20:22:10 -0400 Subject: [PATCH 4/4] Fix style --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 2fe20afe8e4..8fd070e771d 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -3663,7 +3663,8 @@ macro(build_grpc) # Negate warnings that gRPC cannot build under # See https://github.com/grpc/grpc/issues/29417 set(GRPC_C_FLAGS - "${GRPC_C_FLAGS} -Wno-attributes -Wno-format-security -Wno-unknown-warning-option") + "${GRPC_C_FLAGS} -Wno-attributes -Wno-format-security -Wno-unknown-warning-option" + ) set(GRPC_CXX_FLAGS "${GRPC_CXX_FLAGS} -Wno-attributes -Wno-format-security -Wno-unknown-warning-option" )