diff --git a/src/main/cpp/CMakeLists.txt b/src/main/cpp/CMakeLists.txt index 21b42344d..3f95f2f21 100644 --- a/src/main/cpp/CMakeLists.txt +++ b/src/main/cpp/CMakeLists.txt @@ -78,7 +78,9 @@ set(VELOX_SOURCE_URL FetchContent_Declare( velox URL ${VELOX_SOURCE_URL} - URL_HASH MD5=${VELOX_SOURCE_URL_MD5}) + URL_HASH MD5=${VELOX_SOURCE_URL_MD5} + PATCH_COMMAND ${CMAKE_COMMAND} -E chdir patch -p1 -i + "${VELOX_PATCH_DIR}/iconfig-gcc-bug-103186.patch") FetchContent_MakeAvailable(velox) # Import JniHelpers. diff --git a/src/main/cpp/cmake/patches/velox/iconfig-gcc-bug-103186.patch b/src/main/cpp/cmake/patches/velox/iconfig-gcc-bug-103186.patch new file mode 100644 index 000000000..4ff619f85 --- /dev/null +++ b/src/main/cpp/cmake/patches/velox/iconfig-gcc-bug-103186.patch @@ -0,0 +1,38 @@ +--- a/velox/common/config/IConfig.h ++++ b/velox/common/config/IConfig.h +@@ -35,9 +35,7 @@ + std::optional get( + const std::string& key, + const std::function& toT = +- [](auto /* unused */, auto value) { +- return folly::to(value); +- }) const { ++ defaultToT) const { + if (auto val = access(key)) { + return toT(key, *val); + } +@@ -49,9 +47,7 @@ + const std::string& key, + const T& defaultValue, + const std::function& toT = +- [](auto /* unused */, auto value) { +- return folly::to(value); +- }) const { ++ defaultToT) const { + if (auto val = access(key)) { + return toT(key, *val); + } +@@ -65,6 +61,13 @@ + + private: + virtual std::optional access(const std::string& key) const = 0; ++ // Do not inline this member function as lambda. Otherwise, a GCC bug ++ // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103186 might be triggered ++ // with GCC 11.1 and 11.2. ++ template ++ static T defaultToT(std::string /* unused */, std::string value) { ++ return folly::to(value); ++ } + }; + + } // namespace facebook::velox::config diff --git a/src/main/cpp/velox-ref-md5.txt b/src/main/cpp/velox-ref-md5.txt index 9910302a2..3f72b0162 100644 --- a/src/main/cpp/velox-ref-md5.txt +++ b/src/main/cpp/velox-ref-md5.txt @@ -1 +1 @@ -db3b302b3e465f7c8bdf2b1fd89e081b +ec8bf87e9bea7d28c0be20d758e4cd08 diff --git a/src/main/cpp/velox-ref.txt b/src/main/cpp/velox-ref.txt index 5d6a89850..d1b6587d6 100644 --- a/src/main/cpp/velox-ref.txt +++ b/src/main/cpp/velox-ref.txt @@ -1 +1 @@ -62a76362bcfc296a7c35506ad72b1d625c68f682 +45a03a6a0009c5343ad3421fb9f0c7275e9c8ec6