Skip to content

Commit

Permalink
fix(main/zig): fix warning missing ABI and dynamic linker
Browse files Browse the repository at this point in the history
Closes #20294

Zig uses FHS-type path to guess the ABI and dynamic linker of `env` binary. That leads to a warning like in #20294
  • Loading branch information
mbekkomo committed Dec 2, 2024
1 parent 12c396e commit ebc0934
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/zig/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_LICENSE_FILE="zig/LICENSE"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="0.13.0"
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://github.com/ziglang/zig/releases/download/${TERMUX_PKG_VERSION}/zig-bootstrap-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=cd446c084b5da7bc42e8ad9b4e1c910a957f2bf3f82bcc02888102cd0827c139
TERMUX_PKG_BUILD_IN_SRC=true
Expand Down
15 changes: 15 additions & 0 deletions packages/zig/lib-std-zig-system.zig.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig
index 83c798c34..8eebdb857 100644
--- a/zig/lib/std/zig/system.zig
+++ b/zig/lib/std/zig/system.zig
@@ -988,7 +988,9 @@ fn detectAbiAndDynamicLinker(
// if it finds one, then instead of using /usr/bin/env as the ELF file to examine, it uses the file it references instead,
// doing the same logic recursively in case it finds another shebang line.

- var file_name: []const u8 = switch (os.tag) {
+ var file_name: []const u8 = if (os.tag.isAndroid())
+ "@TERMUX_PREFIX@/bin/env"
+ else switch (os.tag) {
// Since /usr/bin/env is hard-coded into the shebang line of many portable scripts, it's a
// reasonably reliable path to start with.
else => "/usr/bin/env",

0 comments on commit ebc0934

Please sign in to comment.