Skip to content

Commit 2f658ec

Browse files
authored
chore: simplify rpath handling (#3592)
Signed-off-by: Alexander Droste <[email protected]>
1 parent 9b6ab6a commit 2f658ec

File tree

5 files changed

+28
-17
lines changed

5 files changed

+28
-17
lines changed

.cargo/config.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
[target.'cfg(target_family="unix")']
22
rustflags = [
33
"-C", "force-frame-pointers=yes",
4-
# Add dynamic DuckDB library directory to runtime search path.
5-
"-C", "link-arg=-Wl,-rpath,$ORIGIN/../duckdb-v1.3.0",
6-
"-C", "link-arg=-Wl,-rpath,$ORIGIN/../../duckdb-v1.3.0",
7-
"-C", "link-arg=-Wl,-rpath,@executable_path/../duckdb-v1.3.0",
8-
"-C", "link-arg=-Wl,-rpath,@executable_path/../../duckdb-v1.3.0"
94
]
105

116
[target.wasm32-unknown-unknown]

.github/workflows/bench-pr.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ jobs:
131131
shell: bash
132132
env:
133133
RUST_BACKTRACE: full
134-
LD_LIBRARY_PATH: target/duckdb-v1.3.0
135134
run: |
136135
target/release_debug/${{ matrix.benchmark.id }} -d gh-json | tee ${{ matrix.benchmark.id }}.json
137136

.github/workflows/sql-benchmarks.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ jobs:
140140
shell: bash
141141
env:
142142
RUST_BACKTRACE: full
143-
LD_LIBRARY_PATH: target/duckdb-v1.3.0
144143
run: |
145144
# Generate data, running each query once to make sure they don't panic.
146145
target/release_debug/${{ matrix.binary_name }} --targets datafusion:parquet -i1 -d gh-json --skip-duckdb-build
@@ -172,7 +171,6 @@ jobs:
172171
OTEL_EXPORTER_OTLP_ENDPOINT: '${{ secrets.OTEL_EXPORTER_OTLP_ENDPOINT }}'
173172
OTEL_EXPORTER_OTLP_HEADERS: '${{ secrets.OTEL_EXPORTER_OTLP_HEADERS }}'
174173
OTEL_RESOURCE_ATTRIBUTES: 'bench-name=${{ matrix.id }}'
175-
LD_LIBRARY_PATH: target/duckdb-v1.3.0
176174
run: |
177175
target/release_debug/${{ matrix.binary_name }} \
178176
-d gh-json \
@@ -191,7 +189,6 @@ jobs:
191189
OTEL_EXPORTER_OTLP_ENDPOINT: '${{ secrets.OTEL_EXPORTER_OTLP_ENDPOINT }}'
192190
OTEL_EXPORTER_OTLP_HEADERS: '${{ secrets.OTEL_EXPORTER_OTLP_HEADERS }}'
193191
OTEL_RESOURCE_ATTRIBUTES: 'bench-name=${{ matrix.id }}'
194-
LD_LIBRARY_PATH: target/duckdb-v1.3.0
195192
run: |
196193
target/release_debug/${{ matrix.binary_name }} \
197194
--use-remote-data-dir ${{ matrix.remote_storage }} \

bench-vortex/build.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#![allow(clippy::unwrap_used)]
2+
#![allow(clippy::expect_used)]
3+
use std::env;
4+
use std::path::PathBuf;
5+
6+
/// Adds a dynamic linker runtime path pointing to the DuckDB dylib dir.
7+
///
8+
/// Setting an absolute rpath, if required by multiple binaries, is the most
9+
/// robust solution compared to using relative paths in terms of
10+
/// `-rpath,$ORIGIN` or `-rpath,@executable_path`.
11+
///
12+
/// Using an absolute rpath implies that binaries linking against the dynamic
13+
/// DuckDB library are never published.
14+
///
15+
/// Note that the rpath set in vortex-duckdb-ext's build.rs is not inherited by
16+
/// crates linking against it which is why consumers must set a rpath on their end.
17+
///
18+
/// The dynamic DuckDB library is preferred over the static version, as DuckDB's
19+
/// static lib is not self-contained. This means that it includes symbols which
20+
/// are not defined as part of the static library.
21+
fn main() {
22+
const DUCKDB_VERSION: &str = "v1.3.0";
23+
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
24+
let target_dir = manifest_dir.parent().unwrap().join("target");
25+
let lib_path = target_dir.join(format!("duckdb-{DUCKDB_VERSION}"));
26+
println!("cargo:rustc-link-arg=-Wl,-rpath,{}", lib_path.display());
27+
}

vortex-duckdb-ext/build.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,7 @@ const DUCKDB_BASE_URL: &str = "https://github.com/duckdb/duckdb/releases/downloa
88

99
fn download_duckdb_archive() -> Result<PathBuf, Box<dyn std::error::Error>> {
1010
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?);
11-
let workspace_root = manifest_dir
12-
.parent()
13-
.ok_or("Failed to get workspace root")?;
14-
15-
let target_dir = env::var("CARGO_TARGET_DIR")
16-
.map(PathBuf::from)
17-
.unwrap_or_else(|_| workspace_root.join("target"));
18-
11+
let target_dir = manifest_dir.parent().unwrap().join("target");
1912
let duckdb_dir = target_dir.join(format!("duckdb-{DUCKDB_VERSION}"));
2013

2114
let target = env::var("TARGET")?;

0 commit comments

Comments
 (0)