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:31:48-07:00
logc8b8f0ea13ee48db929e1340ee9512974ed986ee
treedfdabaae521d58185893b1b58acaa9129a24faf7
parentd2445764a9ee9d31ed0c06bc97362a22cd70a75f

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
......@@ -1429,24 +1429,24 @@ pub const LibExeObjStep = struct {
14291429 self.out_lib_filename = self.out_filename;
14301430 } else if (self.version) |version| {
14311431 if (target.isDarwin()) {
1432 self.major_only_filename = self.builder.fmt("lib{}.{d}.dylib", .{
1432 self.major_only_filename = self.builder.fmt("lib{s}.{d}.dylib", .{
14331433 self.name,
14341434 version.major,
14351435 });
1436 self.name_only_filename = self.builder.fmt("lib{}.dylib", .{self.name});
1436 self.name_only_filename = self.builder.fmt("lib{s}.dylib", .{self.name});
14371437 self.out_lib_filename = self.out_filename;
14381438 } else if (target.os.tag == .windows) {
1439 self.out_lib_filename = self.builder.fmt("{}.lib", .{self.name});
1439 self.out_lib_filename = self.builder.fmt("{s}.lib", .{self.name});
14401440 } else {
1441 self.major_only_filename = self.builder.fmt("lib{}.so.{d}", .{ self.name, version.major });
1442 self.name_only_filename = self.builder.fmt("lib{}.so", .{self.name});
1441 self.major_only_filename = self.builder.fmt("lib{s}.so.{d}", .{ self.name, version.major });
1442 self.name_only_filename = self.builder.fmt("lib{s}.so", .{self.name});
14431443 self.out_lib_filename = self.out_filename;
14441444 }
14451445 } else {
14461446 if (target.isDarwin()) {
14471447 self.out_lib_filename = self.out_filename;
14481448 } else if (target.os.tag == .windows) {
1449 self.out_lib_filename = self.builder.fmt("{}.lib", .{self.name});
1449 self.out_lib_filename = self.builder.fmt("{s}.lib", .{self.name});
14501450 } else {
14511451 self.out_lib_filename = self.out_filename;
14521452 }
......@@ -1977,7 +1977,7 @@ pub const LibExeObjStep = struct {
19771977 try zig_args.append(other.getOutputPath());
19781978 },
19791979 .Lib => {
1980 const full_path_lib = other.getOutputPath();
1980 const full_path_lib = other.getOutputLibPath();
19811981 try zig_args.append(full_path_lib);
19821982
19831983 if (other.is_dynamic and !self.target.isWindows()) {