From aff63306e0a2844907b06c5d2de1339e597b794f Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Thu, 20 Jan 2022 12:47:57 +0100 Subject: [PATCH 1/2] ARROW-15388: [C++] Avoid including absl from flatbuffers There may be an incomplete/broken copy of the Abseil library lying around (for example because of a race condition while installing it as a bundled library). Since absl is only used by Flatbuffers to provide a string_view facility, use our own vendored string_view instead. --- cpp/thirdparty/flatbuffers/README.md | 44 +++++++++++++++++++ .../flatbuffers/include/flatbuffers/base.h | 8 ++-- 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 cpp/thirdparty/flatbuffers/README.md diff --git a/cpp/thirdparty/flatbuffers/README.md b/cpp/thirdparty/flatbuffers/README.md new file mode 100644 index 000000000000..f99980a1e641 --- /dev/null +++ b/cpp/thirdparty/flatbuffers/README.md @@ -0,0 +1,44 @@ + + +This directory contains a vendored version of Flatbuffers +(unknown changeset), with the following patch for ARROW-15388: + +```diff +diff --git a/cpp/thirdparty/flatbuffers/include/flatbuffers/base.h b/cpp/thirdparty/flatbuffers/include/flatbuffers/base.h +index 955738067..f8277b3e9 100644 +--- a/cpp/thirdparty/flatbuffers/include/flatbuffers/base.h ++++ b/cpp/thirdparty/flatbuffers/include/flatbuffers/base.h +@@ -212,11 +212,11 @@ namespace flatbuffers { + typedef std::experimental::string_view string_view; + } + #define FLATBUFFERS_HAS_STRING_VIEW 1 +- // Check for absl::string_view +- #elif __has_include("absl/strings/string_view.h") +- #include "absl/strings/string_view.h" ++ // Check for arrow::util::string_view ++ #elif __has_include("arrow/util/string_view.h") ++ #include "arrow/util/string_view.h" + namespace flatbuffers { +- typedef absl::string_view string_view; ++ typedef arrow::util::string_view string_view; + } + #define FLATBUFFERS_HAS_STRING_VIEW 1 + #endif +``` diff --git a/cpp/thirdparty/flatbuffers/include/flatbuffers/base.h b/cpp/thirdparty/flatbuffers/include/flatbuffers/base.h index 955738067234..f8277b3e9c6c 100644 --- a/cpp/thirdparty/flatbuffers/include/flatbuffers/base.h +++ b/cpp/thirdparty/flatbuffers/include/flatbuffers/base.h @@ -212,11 +212,11 @@ namespace flatbuffers { typedef std::experimental::string_view string_view; } #define FLATBUFFERS_HAS_STRING_VIEW 1 - // Check for absl::string_view - #elif __has_include("absl/strings/string_view.h") - #include "absl/strings/string_view.h" + // Check for arrow::util::string_view + #elif __has_include("arrow/util/string_view.h") + #include "arrow/util/string_view.h" namespace flatbuffers { - typedef absl::string_view string_view; + typedef arrow::util::string_view string_view; } #define FLATBUFFERS_HAS_STRING_VIEW 1 #endif From 61e51033087a1a4cd9cc85599be7de966845b648 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Thu, 20 Jan 2022 16:14:13 +0100 Subject: [PATCH 2/2] Remove arrow::util::string_view fallback --- cpp/thirdparty/flatbuffers/README.md | 16 +++++++--------- .../flatbuffers/include/flatbuffers/base.h | 7 ------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/cpp/thirdparty/flatbuffers/README.md b/cpp/thirdparty/flatbuffers/README.md index f99980a1e641..e955adba4ceb 100644 --- a/cpp/thirdparty/flatbuffers/README.md +++ b/cpp/thirdparty/flatbuffers/README.md @@ -22,23 +22,21 @@ This directory contains a vendored version of Flatbuffers ```diff diff --git a/cpp/thirdparty/flatbuffers/include/flatbuffers/base.h b/cpp/thirdparty/flatbuffers/include/flatbuffers/base.h -index 955738067..f8277b3e9 100644 +index 955738067..fccce42f6 100644 --- a/cpp/thirdparty/flatbuffers/include/flatbuffers/base.h +++ b/cpp/thirdparty/flatbuffers/include/flatbuffers/base.h -@@ -212,11 +212,11 @@ namespace flatbuffers { +@@ -212,13 +212,6 @@ namespace flatbuffers { typedef std::experimental::string_view string_view; } #define FLATBUFFERS_HAS_STRING_VIEW 1 - // Check for absl::string_view - #elif __has_include("absl/strings/string_view.h") - #include "absl/strings/string_view.h" -+ // Check for arrow::util::string_view -+ #elif __has_include("arrow/util/string_view.h") -+ #include "arrow/util/string_view.h" - namespace flatbuffers { +- namespace flatbuffers { - typedef absl::string_view string_view; -+ typedef arrow::util::string_view string_view; - } - #define FLATBUFFERS_HAS_STRING_VIEW 1 +- } +- #define FLATBUFFERS_HAS_STRING_VIEW 1 #endif + #endif // __has_include + #endif // !FLATBUFFERS_HAS_STRING_VIEW ``` diff --git a/cpp/thirdparty/flatbuffers/include/flatbuffers/base.h b/cpp/thirdparty/flatbuffers/include/flatbuffers/base.h index f8277b3e9c6c..fccce42f68aa 100644 --- a/cpp/thirdparty/flatbuffers/include/flatbuffers/base.h +++ b/cpp/thirdparty/flatbuffers/include/flatbuffers/base.h @@ -212,13 +212,6 @@ namespace flatbuffers { typedef std::experimental::string_view string_view; } #define FLATBUFFERS_HAS_STRING_VIEW 1 - // Check for arrow::util::string_view - #elif __has_include("arrow/util/string_view.h") - #include "arrow/util/string_view.h" - namespace flatbuffers { - typedef arrow::util::string_view string_view; - } - #define FLATBUFFERS_HAS_STRING_VIEW 1 #endif #endif // __has_include #endif // !FLATBUFFERS_HAS_STRING_VIEW