Skip to content

Commit f6d4007

Browse files
committed
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()`.
1 parent 4c6f46d commit f6d4007

5 files changed

Lines changed: 16 additions & 8 deletions

File tree

example/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ find_package(iceberg CONFIG REQUIRED)
2626

2727
add_executable(demo_example demo_example.cc)
2828

29-
target_link_libraries(demo_example PRIVATE iceberg::iceberg_bundle_static
30-
iceberg::iceberg_rest_static)
29+
target_link_libraries(demo_example PRIVATE iceberg::iceberg_bundle_shared
30+
iceberg::iceberg_rest_shared)

src/iceberg/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ list(APPEND
149149
"$<IF:$<BOOL:${CROARING_VENDORED}>,iceberg::roaring,roaring::roaring>")
150150
list(APPEND
151151
ICEBERG_SHARED_INSTALL_INTERFACE_LIBS
152-
"$<IF:$<BOOL:${NANOARROW_VENDORED}>,iceberg::nanoarrow_shared,$<IF:$<TARGET_EXISTS:nanoarrow::nanoarrow_shared>,nanoarrow::nanoarrow_shared,nanoarrow::nanoarrow_static>>"
152+
"$<IF:$<BOOL:${NANOARROW_VENDORED}>,iceberg::nanoarrow_static,$<IF:$<TARGET_EXISTS:nanoarrow::nanoarrow_shared>,nanoarrow::nanoarrow_shared,nanoarrow::nanoarrow_static>>"
153153
"$<IF:$<BOOL:${NLOHMANN_JSON_VENDORED}>,iceberg::nlohmann_json,$<IF:$<TARGET_EXISTS:nlohmann_json::nlohmann_json>,nlohmann_json::nlohmann_json,nlohmann_json::nlohmann_json>>"
154154
"$<IF:$<BOOL:${CROARING_VENDORED}>,iceberg::roaring,roaring::roaring>")
155155

src/iceberg/iceberg_export.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,5 @@
5353

5454
# define ICEBERG_TEMPLATE_EXPORT
5555
# define ICEBERG_TEMPLATE_CLASS_EXPORT ICEBERG_EXPORT
56-
# define ICEBERG_EXTERN_TEMPLATE_CLASS_EXPORT ICEBERG_TEMPLATE_EXPORT
56+
# define ICEBERG_EXTERN_TEMPLATE_CLASS_EXPORT ICEBERG_TEMPLATE_CLASS_EXPORT
5757
#endif

src/iceberg/table_scan.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,9 +535,9 @@ Result<std::unique_ptr<ScanType>> TableScanBuilder<ScanType>::Build() {
535535
}
536536

537537
// Explicit template instantiations
538-
template class TableScanBuilder<DataTableScan>;
539-
template class TableScanBuilder<IncrementalAppendScan>;
540-
template class TableScanBuilder<IncrementalChangelogScan>;
538+
template class ICEBERG_TEMPLATE_EXPORT TableScanBuilder<DataTableScan>;
539+
template class ICEBERG_TEMPLATE_EXPORT TableScanBuilder<IncrementalAppendScan>;
540+
template class ICEBERG_TEMPLATE_EXPORT TableScanBuilder<IncrementalChangelogScan>;
541541

542542
TableScan::TableScan(std::shared_ptr<TableMetadata> metadata,
543543
std::shared_ptr<Schema> schema, std::shared_ptr<FileIO> file_io,

src/iceberg/table_scan.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <vector>
2929

3030
#include "iceberg/arrow_c_data.h"
31+
#include "iceberg/iceberg_export.h"
3132
#include "iceberg/result.h"
3233
#include "iceberg/table_metadata.h"
3334
#include "iceberg/type_fwd.h"
@@ -252,7 +253,7 @@ concept IsIncrementalScan = std::is_base_of_v<IncrementalScan<FileScanTask>, T>
252253

253254
/// \brief Builder class for creating TableScan instances.
254255
template <typename ScanType = DataTableScan>
255-
class ICEBERG_EXPORT TableScanBuilder : public ErrorCollector {
256+
class ICEBERG_TEMPLATE_CLASS_EXPORT TableScanBuilder : public ErrorCollector {
256257
public:
257258
/// \brief Constructs a TableScanBuilder for the given table.
258259
/// \param metadata Current table metadata.
@@ -524,4 +525,11 @@ class ICEBERG_EXPORT IncrementalChangelogScan
524525
using IncrementalScan::IncrementalScan;
525526
};
526527

528+
extern template class ICEBERG_EXTERN_TEMPLATE_CLASS_EXPORT
529+
TableScanBuilder<DataTableScan>;
530+
extern template class ICEBERG_EXTERN_TEMPLATE_CLASS_EXPORT
531+
TableScanBuilder<IncrementalAppendScan>;
532+
extern template class ICEBERG_EXTERN_TEMPLATE_CLASS_EXPORT
533+
TableScanBuilder<IncrementalChangelogScan>;
534+
527535
} // namespace iceberg

0 commit comments

Comments
 (0)