From f6d40072458d51250154a76ae5606c6a02927d0b Mon Sep 17 00:00:00 2001 From: Junwang Zhao Date: Sat, 2 May 2026 20:28:31 +0800 Subject: [PATCH 1/2] fix: repair shared package linkage and export scan builder symbols 1. Update the shared installation interface to depend on the static nanoarrow target, since vendored libraries are built only as static artifacts(see prepare_fetchcontent). 2. Switch the example build to use shared libraries to surface linkage issues. This revealed that `TableScanBuilder` symbols are not exported. Explicitly export the `TableScanBuilder` template instantiations so that shared-library consumers can successfully link against `Build()`. --- example/CMakeLists.txt | 4 ++-- src/iceberg/CMakeLists.txt | 2 +- src/iceberg/iceberg_export.h | 2 +- src/iceberg/table_scan.cc | 6 +++--- src/iceberg/table_scan.h | 10 +++++++++- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 837ed7d7c..0e04accec 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -26,5 +26,5 @@ find_package(iceberg CONFIG REQUIRED) add_executable(demo_example demo_example.cc) -target_link_libraries(demo_example PRIVATE iceberg::iceberg_bundle_static - iceberg::iceberg_rest_static) +target_link_libraries(demo_example PRIVATE iceberg::iceberg_bundle_shared + iceberg::iceberg_rest_shared) diff --git a/src/iceberg/CMakeLists.txt b/src/iceberg/CMakeLists.txt index 603c35343..34d7f1edd 100644 --- a/src/iceberg/CMakeLists.txt +++ b/src/iceberg/CMakeLists.txt @@ -149,7 +149,7 @@ list(APPEND "$,iceberg::roaring,roaring::roaring>") list(APPEND ICEBERG_SHARED_INSTALL_INTERFACE_LIBS - "$,iceberg::nanoarrow_shared,$,nanoarrow::nanoarrow_shared,nanoarrow::nanoarrow_static>>" + "$,iceberg::nanoarrow_static,$,nanoarrow::nanoarrow_shared,nanoarrow::nanoarrow_static>>" "$,iceberg::nlohmann_json,$,nlohmann_json::nlohmann_json,nlohmann_json::nlohmann_json>>" "$,iceberg::roaring,roaring::roaring>") diff --git a/src/iceberg/iceberg_export.h b/src/iceberg/iceberg_export.h index 8d7a35f27..2463fbeaf 100644 --- a/src/iceberg/iceberg_export.h +++ b/src/iceberg/iceberg_export.h @@ -53,5 +53,5 @@ # define ICEBERG_TEMPLATE_EXPORT # define ICEBERG_TEMPLATE_CLASS_EXPORT ICEBERG_EXPORT -# define ICEBERG_EXTERN_TEMPLATE_CLASS_EXPORT ICEBERG_TEMPLATE_EXPORT +# define ICEBERG_EXTERN_TEMPLATE_CLASS_EXPORT ICEBERG_TEMPLATE_CLASS_EXPORT #endif diff --git a/src/iceberg/table_scan.cc b/src/iceberg/table_scan.cc index 2195482bb..f61bd3a0c 100644 --- a/src/iceberg/table_scan.cc +++ b/src/iceberg/table_scan.cc @@ -535,9 +535,9 @@ Result> TableScanBuilder::Build() { } // Explicit template instantiations -template class TableScanBuilder; -template class TableScanBuilder; -template class TableScanBuilder; +template class ICEBERG_TEMPLATE_EXPORT TableScanBuilder; +template class ICEBERG_TEMPLATE_EXPORT TableScanBuilder; +template class ICEBERG_TEMPLATE_EXPORT TableScanBuilder; TableScan::TableScan(std::shared_ptr metadata, std::shared_ptr schema, std::shared_ptr file_io, diff --git a/src/iceberg/table_scan.h b/src/iceberg/table_scan.h index 064825d82..307946e6c 100644 --- a/src/iceberg/table_scan.h +++ b/src/iceberg/table_scan.h @@ -28,6 +28,7 @@ #include #include "iceberg/arrow_c_data.h" +#include "iceberg/iceberg_export.h" #include "iceberg/result.h" #include "iceberg/table_metadata.h" #include "iceberg/type_fwd.h" @@ -252,7 +253,7 @@ concept IsIncrementalScan = std::is_base_of_v, T> /// \brief Builder class for creating TableScan instances. template -class ICEBERG_EXPORT TableScanBuilder : public ErrorCollector { +class ICEBERG_TEMPLATE_CLASS_EXPORT TableScanBuilder : public ErrorCollector { public: /// \brief Constructs a TableScanBuilder for the given table. /// \param metadata Current table metadata. @@ -524,4 +525,11 @@ class ICEBERG_EXPORT IncrementalChangelogScan using IncrementalScan::IncrementalScan; }; +extern template class ICEBERG_EXTERN_TEMPLATE_CLASS_EXPORT + TableScanBuilder; +extern template class ICEBERG_EXTERN_TEMPLATE_CLASS_EXPORT + TableScanBuilder; +extern template class ICEBERG_EXTERN_TEMPLATE_CLASS_EXPORT + TableScanBuilder; + } // namespace iceberg From a0149326f472e697a21b98771d79a465abf7c0c3 Mon Sep 17 00:00:00 2001 From: Junwang Zhao Date: Sun, 3 May 2026 08:30:29 +0800 Subject: [PATCH 2/2] fix: normalize nanoarrow build interface selection --- src/iceberg/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/iceberg/CMakeLists.txt b/src/iceberg/CMakeLists.txt index 34d7f1edd..62882d587 100644 --- a/src/iceberg/CMakeLists.txt +++ b/src/iceberg/CMakeLists.txt @@ -132,13 +132,13 @@ set(ICEBERG_SHARED_INSTALL_INTERFACE_LIBS) list(APPEND ICEBERG_STATIC_BUILD_INTERFACE_LIBS - nanoarrow::nanoarrow_static + "$,nanoarrow::nanoarrow_static,$,nanoarrow::nanoarrow_static,nanoarrow::nanoarrow_shared>>" nlohmann_json::nlohmann_json roaring::roaring ZLIB::ZLIB) list(APPEND ICEBERG_SHARED_BUILD_INTERFACE_LIBS - nanoarrow::nanoarrow_shared + "$,nanoarrow::nanoarrow_static,$,nanoarrow::nanoarrow_shared,nanoarrow::nanoarrow_static>>" nlohmann_json::nlohmann_json roaring::roaring ZLIB::ZLIB)