summaryrefslogtreecommitdiff
path: root/dev-lang/zig-bin/files/zig-bin-0.9.1-fix-detecting-abi.patch
blob: 6aa2f49b379af7dfa422f8ce022f72fb8f91d03c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
From: Eric Joldasov <bratishkaerik@getgoogleoff.me>

Upstream parses /usr/bin/env ELF file for detecting C ABI and the dynamic linker.
However, if sys-apps/coreutils was merged with "multicall" USE flag, it would be a script and not a ELF file.
This will raise error.UnexpectedEndOfFile, and Zig will fallback to default dynamic linker (i.e. musl),
which breaks building programs with Zig on glibc systems. This patch changes file from
/usr/bin/env to /bin/bash, because it is more reliable on Gentoo systems.

--- a/lib/std/zig/system/NativeTargetInfo.zig
+++ b/lib/std/zig/system/NativeTargetInfo.zig
@@ -355,7 +355,7 @@ fn detectAbiAndDynamicLinker(
         return result;
     }
 
-    const env_file = std.fs.openFileAbsoluteZ("/usr/bin/env", .{}) catch |err| switch (err) {
+    const env_file = std.fs.openFileAbsoluteZ("/bin/bash", .{}) catch |err| switch (err) {
         error.NoSpaceLeft => unreachable,
         error.NameTooLong => unreachable,
         error.PathAlreadyExists => unreachable,