Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(main/zig): fix missing dynamic linker and libc runtime #22442

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-LibCInstallation.zig.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/lib/std/zig/LibCInstallation.zig b/lib/std/zig/LibCInstallation.zig
index 686471bde..47e1f714c 100644
--- a/zig/lib/std/zig/LibCInstallation.zig
+++ b/zig/lib/std/zig/LibCInstallation.zig
@@ -203,6 +203,10 @@ pub fn findNative(args: FindNativeOptions) FindError!LibCInstallation {
self.include_dir = try args.allocator.dupeZ(u8, "/usr/include");
self.sys_include_dir = try args.allocator.dupeZ(u8, "/usr/include");
self.crt_dir = try args.allocator.dupeZ(u8, "/usr/lib/64");
+ } else if (builtin.target.isAndroid()) {
+ self.include_dir = try args.allocator.dupeZ(u8, "@TERMUX_PREFIX@/include");
+ self.sys_include_dir = try args.allocator.dupeZ(u8, "@TERMUX_PREFIX@/include/sys");
+ self.crt_dir = try args.allocator.dupeZ(u8, "@TERMUX_PREFIX@/lib");
} else if (std.process.can_spawn) {
try self.findNativeIncludeDirPosix(args);
switch (builtin.target.os.tag) {
16 changes: 16 additions & 0 deletions packages/zig/lib-std-zig-system.zig.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig
index 83c798c34..6668f4bcd 100644
--- a/zig/lib/std/zig/system.zig
+++ b/zig/lib/std/zig/system.zig
@@ -996,6 +996,11 @@ fn detectAbiAndDynamicLinker(
.haiku => "/bin/env",
};

+ if (builtin.target.isAndroid()) {
+ // Consider using /system/bin/env instead
+ file_name = "@TERMUX_PREFIX@/bin/env";
+ }
+
// According to `man 2 execve`:
//
// The kernel imposes a maximum length on the text
Loading