This is an automated email from the ASF dual-hosted git repository.
kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new 814537433f GH-47554: [C++] Fix Meson Parquet symbol visibility issues
(#47556)
814537433f is described below
commit 814537433f09b58ebe68b820f66edd954807b2d5
Author: William Ayd <[email protected]>
AuthorDate: Sun Sep 14 01:49:50 2025 -0400
GH-47554: [C++] Fix Meson Parquet symbol visibility issues (#47556)
### Rationale for this change
This fixes symbol export visibility issues with the Parquet option enabled
### What changes are included in this PR?
Updates to the Meson configuration, and one definition to get symbol
exports to work
### Are these changes tested?
Yes
### Are there any user-facing changes?
No
* GitHub Issue: #47554
Authored-by: Will Ayd <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
---
cpp/src/arrow/meson.build | 3 +--
cpp/src/arrow/util/byte_stream_split_internal.h | 5 ++--
cpp/src/arrow/util/visibility.h | 11 +++++++-
cpp/src/parquet/meson.build | 34 +++++++++++++++++++++----
4 files changed, 43 insertions(+), 10 deletions(-)
diff --git a/cpp/src/arrow/meson.build b/cpp/src/arrow/meson.build
index a04fdf88c2..e3490b2bb4 100644
--- a/cpp/src/arrow/meson.build
+++ b/cpp/src/arrow/meson.build
@@ -488,8 +488,7 @@ arrow_lib = library(
include_directories: arrow_includes,
dependencies: arrow_deps,
install: true,
- # TODO: re-enable symbol visibility
- #gnu_symbol_visibility: 'inlineshidden',
+ gnu_symbol_visibility: 'inlineshidden',
cpp_shared_args: ['-DARROW_EXPORTING'],
)
diff --git a/cpp/src/arrow/util/byte_stream_split_internal.h
b/cpp/src/arrow/util/byte_stream_split_internal.h
index 3125857f69..333730c004 100644
--- a/cpp/src/arrow/util/byte_stream_split_internal.h
+++ b/cpp/src/arrow/util/byte_stream_split_internal.h
@@ -452,8 +452,9 @@ inline void ByteStreamSplitDecodeScalarDynamic(const
uint8_t* data, int width,
}
template <int kNumStreams>
-void ByteStreamSplitDecodeSimdDispatch(const uint8_t* data, int width, int64_t
num_values,
- int64_t stride, uint8_t* out);
+ARROW_EXPORT void ByteStreamSplitDecodeSimdDispatch(const uint8_t* data, int
width,
+ int64_t num_values,
int64_t stride,
+ uint8_t* out);
extern template ARROW_TEMPLATE_EXPORT void
ByteStreamSplitDecodeSimdDispatch<2>(
const uint8_t*, int, int64_t, int64_t, uint8_t*);
diff --git a/cpp/src/arrow/util/visibility.h b/cpp/src/arrow/util/visibility.h
index 22fbd2bbeb..67988071c9 100644
--- a/cpp/src/arrow/util/visibility.h
+++ b/cpp/src/arrow/util/visibility.h
@@ -67,6 +67,15 @@
# ifndef ARROW_NO_EXPORT
# define ARROW_NO_EXPORT [[gnu::visibility("hidden")]]
# endif
+// The C++ language does not have clear rules for how to export explicit
template
+// instantiations, and clang/gcc have differing syntax. See
+// https://github.com/llvm/llvm-project/issues/29464 and
+// https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0537r0.html
+# if defined(__clang__)
+# define ARROW_TEMPLATE_EXPORT
+# else
+# define ARROW_TEMPLATE_EXPORT ARROW_EXPORT
+# endif
# else
// Not C++, or not gcc/clang
# ifndef ARROW_EXPORT
@@ -75,10 +84,10 @@
# ifndef ARROW_NO_EXPORT
# define ARROW_NO_EXPORT
# endif
+# define ARROW_TEMPLATE_EXPORT
# endif
# define ARROW_FRIEND_EXPORT
-# define ARROW_TEMPLATE_EXPORT
// [[gnu::visibility("default")]] even when #included by a non-arrow source
# define ARROW_FORCE_EXPORT [[gnu::visibility("default")]]
diff --git a/cpp/src/parquet/meson.build b/cpp/src/parquet/meson.build
index d7878c2518..e6ff43a0ba 100644
--- a/cpp/src/parquet/meson.build
+++ b/cpp/src/parquet/meson.build
@@ -89,7 +89,7 @@ endif
parquet_deps = [arrow_dep, rapidjson_dep, thrift_dep]
-if needs_parquet_encryption or get_option('parquet_require_encryption') ==
'auto'
+if needs_parquet_encryption or get_option('parquet_require_encryption').auto()
openssl_dep = dependency('openssl', required: needs_parquet_encryption)
else
openssl_dep = disabler()
@@ -120,8 +120,7 @@ parquet_lib = library(
'arrow-parquet',
sources: parquet_srcs,
dependencies: parquet_deps,
- # TODO: enable hidden visibility by default
- #gnu_symbol_visibility: 'inlineshidden',
+ gnu_symbol_visibility: 'inlineshidden',
)
parquet_dep = declare_dependency(link_with: parquet_lib)
@@ -269,7 +268,27 @@ if needs_parquet_encryption
}
endif
-parquet_test_dep = [parquet_dep, arrow_test_dep, thrift_dep]
+if get_option('default_library') != 'static'
+ parquet_test_support_lib = static_library(
+ 'parquet-test-support',
+ sources: files('../generated/parquet_types.cpp'),
+ dependencies: [thrift_dep],
+ include_directories: include_directories('..'),
+ )
+ parquet_test_support_dep = declare_dependency(
+ link_with: [parquet_test_support_lib],
+ )
+else
+ parquet_test_support_dep = declare_dependency()
+endif
+
+
+parquet_test_dep = [
+ parquet_dep,
+ parquet_test_support_dep,
+ arrow_test_dep,
+ thrift_dep,
+]
foreach key, val : parquet_tests
test_name = 'parquet-@0@'.format(key)
@@ -301,7 +320,12 @@ parquet_benchmarks = {
'size_stats_benchmark': {'sources':
files('arrow/size_stats_benchmark.cc')},
}
-parquet_benchmark_dep = [parquet_dep, arrow_benchmark_dep, thrift_dep]
+parquet_benchmark_dep = [
+ parquet_dep,
+ parquet_test_support_dep,
+ arrow_benchmark_dep,
+ thrift_dep,
+]
foreach key, val : parquet_benchmarks
benchmark_name = 'parquet-@0@'.format(key)