Skip to content

Commit 56621bc

Browse files
hackgnarclaude
andcommitted
Fix armv6 cross link: rpath-link for libdbus's transitive libsystemd
The arm-unknown-linux-gnueabihf cross image uses a crosstool-NG toolchain that is not multiarch-aware, so its linker did not search /usr/lib/arm-linux-gnueabihf for libdbus-1.so's NEEDED libsystemd.so.0 (GNU ld uses -rpath-link, not -L, for transitive shared-lib deps). Add -rpath-link via RUSTFLAGS for the armv6 target only; armv7/aarch64 use the Debian multiarch gcc and are unaffected. Pure link-arg, so ARMv6 codegen is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 9878742 commit 56621bc

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,22 @@ jobs:
6161
# that would force a newer ISA. armhf shares the arm-linux-gnueabihf
6262
# multiarch ABI dir with armv7, so libdbus + strip are identical;
6363
# only the codegen differs. arm_arch asserts ARMv6 in verify below.
64+
#
65+
# rustflags: this target's cross image uses a crosstool-NG toolchain
66+
# (/x-tools/...) that is NOT multiarch-aware, so its linker does not
67+
# search /usr/lib/arm-linux-gnueabihf for libdbus's transitive
68+
# NEEDED libsystemd.so.0. -L is never used for transitive shlib deps;
69+
# only -rpath-link is. Point it at the multiarch dir so libsystemd
70+
# (a hard dep of libdbus-1-3, already installed there) resolves.
71+
# Set ONLY on this target — armv7/aarch64 use the Debian multiarch
72+
# gcc which finds it by default, so they stay untouched.
6473
- artifact: gratttool-linux-armv6
6574
target: arm-unknown-linux-gnueabihf
6675
cross: true
6776
strip: arm-linux-gnueabihf-strip
6877
pkg_config_path: /usr/lib/arm-linux-gnueabihf/pkgconfig
6978
arm_arch: v6
79+
rustflags: "-C link-arg=-Wl,-rpath-link,/usr/lib/arm-linux-gnueabihf"
7080

7181
steps:
7282
- uses: actions/checkout@v4
@@ -113,6 +123,10 @@ jobs:
113123
PKG_CONFIG_ALLOW_CROSS: "1"
114124
PKG_CONFIG_SYSROOT_DIR: /
115125
PKG_CONFIG_PATH: ${{ matrix.pkg_config_path }}
126+
# Empty for targets that don't set matrix.rustflags (no-op); only the
127+
# armv6 target sets it, to add -rpath-link for libdbus's transitive
128+
# libsystemd. Passed into the cross container via Cross.toml passthrough.
129+
RUSTFLAGS: ${{ matrix.rustflags }}
116130
run: cross build --release --locked --target ${{ matrix.target }}
117131

118132
# Don't assume the cross link worked — prove libdbus actually got linked.

Cross.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ passthrough = [
1919
"PKG_CONFIG_ALLOW_CROSS",
2020
"PKG_CONFIG_PATH",
2121
"PKG_CONFIG_SYSROOT_DIR",
22+
# RUSTFLAGS carries the armv6 -rpath-link (see release.yml); harmless/empty
23+
# for the other targets.
24+
"RUSTFLAGS",
2225
]
2326

2427
[target.aarch64-unknown-linux-gnu]

0 commit comments

Comments
 (0)