authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-11-28 17:11:12+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-11-28 17:18:00+01:00
log3fb0ab5195f2dff47f2d2c043ad1677a0b3767e5
treef884610da49dfa3793a72c380631be0ee5003179
parent80ac91172f36be763222b2089c9dc4fee8e351eb
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.Build.Step.Run: Use std.zig.target.glibcRuntimeTriple() in runCommand().


1 files changed, 13 insertions(+), 19 deletions(-)

lib/std/Build/Step/Run.zig+13-19
......@@ -1009,7 +1009,8 @@ fn runCommand(
10091009 else => break :interpret,
10101010 }
10111011
1012 const need_cross_glibc = exe.rootModuleTarget().isGnuLibC() and
1012 const root_target = exe.rootModuleTarget();
1013 const need_cross_glibc = root_target.isGnuLibC() and
10131014 exe.is_linking_libc;
10141015 const other_target = exe.root_module.resolved_target.?.result;
10151016 switch (std.zig.system.getExternalExecutor(b.graph.host.result, &other_target, .{
......@@ -1039,23 +1040,16 @@ fn runCommand(
10391040 try interp_argv.append(bin_name);
10401041
10411042 if (glibc_dir_arg) |dir| {
1042 // TODO look into making this a call to `linuxTriple`. This
1043 // needs the directory to be called "i686" rather than
1044 // "x86" which is why we do it manually here.
1045 const fmt_str = "{s}" ++ fs.path.sep_str ++ "{s}-{s}-{s}";
1046 const cpu_arch = exe.rootModuleTarget().cpu.arch;
1047 const os_tag = exe.rootModuleTarget().os.tag;
1048 const abi = exe.rootModuleTarget().abi;
1049 const cpu_arch_name: []const u8 = if (cpu_arch == .x86)
1050 "i686"
1051 else
1052 @tagName(cpu_arch);
1053 const full_dir = try std.fmt.allocPrint(b.allocator, fmt_str, .{
1054 dir, cpu_arch_name, @tagName(os_tag), @tagName(abi),
1055 });
1056
10571043 try interp_argv.append("-L");
1058 try interp_argv.append(full_dir);
1044 try interp_argv.append(b.pathJoin(&.{
1045 dir,
1046 try std.zig.target.glibcRuntimeTriple(
1047 b.allocator,
1048 root_target.cpu.arch,
1049 root_target.os.tag,
1050 root_target.abi,
1051 ),
1052 }));
10591053 }
10601054
10611055 try interp_argv.appendSlice(argv);
......@@ -1113,7 +1107,7 @@ fn runCommand(
11131107 if (allow_skip) return error.MakeSkipped;
11141108
11151109 const host_name = try b.graph.host.result.zigTriple(b.allocator);
1116 const foreign_name = try exe.rootModuleTarget().zigTriple(b.allocator);
1110 const foreign_name = try root_target.zigTriple(b.allocator);
11171111
11181112 return step.fail("the host system ({s}) is unable to execute binaries from the target ({s})", .{
11191113 host_name, foreign_name,
......@@ -1121,7 +1115,7 @@ fn runCommand(
11211115 },
11221116 }
11231117
1124 if (exe.rootModuleTarget().os.tag == .windows) {
1118 if (root_target.os.tag == .windows) {
11251119 // On Windows we don't have rpaths so we have to add .dll search paths to PATH
11261120 run.addPathForDynLibs(exe);
11271121 }