Skip to content

Commit 7f1e238

Browse files
committed
Fix linking the new extension loader
1 parent 93bc7ae commit 7f1e238

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

cmake/duckdb_loader.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,13 @@ function(duckdb_add_library target_name)
250250
endfunction()
251251

252252
function(duckdb_link_extensions target_name)
253-
# Link to the DuckDB static library and extensions
254-
target_link_libraries(${target_name}
255-
PRIVATE duckdb_generated_extension_loader)
253+
# Link to the DuckDB static library and extensions We use WHOLE_ARCHIVE
254+
# because duckdb_static calls LoadAllExtensions which is defined in the
255+
# extension loader. Without this, linkers (especially on Linux with
256+
# --as-needed) may drop the extension loader before seeing the reference.
257+
target_link_libraries(
258+
${target_name}
259+
PRIVATE "$<LINK_LIBRARY:WHOLE_ARCHIVE,duckdb_generated_extension_loader>")
256260
if(BUILD_EXTENSIONS)
257261
message(STATUS "Linking DuckDB extensions:")
258262
foreach(ext IN LISTS BUILD_EXTENSIONS)

0 commit comments

Comments
 (0)