authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-01 11:28:44-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-01 11:28:44-07:00
logc7028ce0c612597b68ca900af036ec6aa5728f4f
treef93cd04c7526e53c16d37ac31595759e2bf78f84
parent02e12ede46502e7c0f04ae94292e005a113a84c9

COFF linking: fix incorrectly passing .dll instead of .lib

commit 9d1816111d1d30e18b8cb43a4aa31c194fb204c4 used the "output path" as the path for passing shared library artifact paths to the Zig CLI. For Windows, this was incorrect because it would pass the .dll instead of the .lib file. This commit passes the "output lib path" instead, which makes it pass the .lib path in case of a .dll on Windows. This way the linker does not complain and say, "bad file type. Did you specify a DLL instead of an import library?"

1 files changed, 7 insertions(+), 7 deletions(-)

lib/std/build.zig+7-7
......@@ -1432,24 +1432,24 @@ pub const LibExeObjStep = struct {
14321432 self.out_lib_filename = self.out_filename;
14331433 } else if (self.version) |version| {
14341434 if (target.isDarwin()) {
1435 self.major_only_filename = self.builder.fmt("lib{}.{d}.dylib", .{
1435 self.major_only_filename = self.builder.fmt("lib{s}.{d}.dylib", .{
14361436 self.name,
14371437 version.major,
14381438 });
1439 self.name_only_filename = self.builder.fmt("lib{}.dylib", .{self.name});
1439 self.name_only_filename = self.builder.fmt("lib{s}.dylib", .{self.name});
14401440 self.out_lib_filename = self.out_filename;
14411441 } else if (target.os.tag == .windows) {
1442 self.out_lib_filename = self.builder.fmt("{}.lib", .{self.name});
1442 self.out_lib_filename = self.builder.fmt("{s}.lib", .{self.name});
14431443 } else {
1444 self.major_only_filename = self.builder.fmt("lib{}.so.{d}", .{ self.name, version.major });
1445 self.name_only_filename = self.builder.fmt("lib{}.so", .{self.name});
1444 self.major_only_filename = self.builder.fmt("lib{s}.so.{d}", .{ self.name, version.major });
1445 self.name_only_filename = self.builder.fmt("lib{s}.so", .{self.name});
14461446 self.out_lib_filename = self.out_filename;
14471447 }
14481448 } else {
14491449 if (target.isDarwin()) {
14501450 self.out_lib_filename = self.out_filename;
14511451 } else if (target.os.tag == .windows) {
1452 self.out_lib_filename = self.builder.fmt("{}.lib", .{self.name});
1452 self.out_lib_filename = self.builder.fmt("{s}.lib", .{self.name});
14531453 } else {
14541454 self.out_lib_filename = self.out_filename;
14551455 }
......@@ -1980,7 +1980,7 @@ pub const LibExeObjStep = struct {
19801980 try zig_args.append(other.getOutputPath());
19811981 },
19821982 .Lib => {
1983 const full_path_lib = other.getOutputPath();
1983 const full_path_lib = other.getOutputLibPath();
19841984 try zig_args.append(full_path_lib);
19851985
19861986 if (other.is_dynamic and !self.target.isWindows()) {