From 85ee959b4ddf87ec7bae57c8790d2512a53a6779 Mon Sep 17 00:00:00 2001 From: Andrea Debernardi Date: Sun, 25 Oct 2026 15:44:46 +0100 Subject: [PATCH] fix(build): link DuckDB static extensions with GNU ld --- .github/workflows/ci.yml | 4 +++- .tabularium | 2 +- Cargo.lock | 2 +- Cargo.toml | 2 +- build.rs | 9 ++++++++- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33ecb0c..c8137f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,9 @@ jobs: - uses: actions/checkout@v7 - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 - - run: cargo build --locked + # Exercise GNU ld's archive ordering, including the Linux ARM64 release case. + - name: Build with GNU ld + run: cargo rustc --locked -- -C link-arg=-fuse-ld=bfd - run: cargo test --locked --all-targets audit: diff --git a/.tabularium b/.tabularium index 840aaea..685ba9f 100644 --- a/.tabularium +++ b/.tabularium @@ -1,7 +1,7 @@ { "id": "hackernews", "name": "Hacker News", - "version": "0.1.2", + "version": "0.1.3", "kind": "driver", "description": "Query Hacker News stories, comments, users and polls as SQL tables using the public API.", "engine": "hackernews", diff --git a/Cargo.lock b/Cargo.lock index 9ec37e3..aa4e208 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1563,7 +1563,7 @@ dependencies = [ [[package]] name = "tabularis-hackernews-plugin" -version = "0.1.2" +version = "0.1.3" dependencies = [ "duckdb", "futures", diff --git a/Cargo.toml b/Cargo.toml index 7976808..bdb2fb4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tabularis-hackernews-plugin" -version = "0.1.2" +version = "0.1.3" edition = "2021" [dependencies] diff --git a/build.rs b/build.rs index 8f1fe5e..f331614 100644 --- a/build.rs +++ b/build.rs @@ -1,5 +1,12 @@ fn main() { - if std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default() == "windows" { + let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default(); + if target_os == "windows" { println!("cargo:rustc-link-lib=rstrtmgr"); } + + if target_os == "linux" && std::env::var("CARGO_CFG_TARGET_ENV").unwrap_or_default() == "gnu" { + // DuckDB's static extension registrar is linked after its implementation. + // GNU ld needs the symbol up front to extract it from the earlier archive. + println!("cargo:rustc-link-arg=-Wl,--undefined=duckdb_register_static_extensions"); + } }