authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2024-03-03 19:39:15-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-03-04 05:36:01-08:00
log469643940c9cdce90fbd44e437592dbb608f2443
treec8e95a8c8fedd578262c938d072d9ac345b2f925
parent90c1a2c41aafb1e35e075fb7d0bdcf04c00db913

Use the global cache dir for the manifests of generated mingw `.lib`s

Fixes a mismatch where the manifests would be written to the local cache dir, but the .def/.lib files themselves would be written to the global cache dir. This meant that if you cleared your global cache, your local cache would still think that the .lib files existed in the cache and it'd lead to 'No such file or directory' errors at linktime. This mismatch was introduced in the stage1 -> stage2 transition of this code.

1 files changed, 6 insertions(+), 4 deletions(-)

src/mingw.zig+6-4
......@@ -178,13 +178,15 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void {
178178
179179 const target = comp.getTarget();
180180
181 // Use the global cache directory.
181182 var cache: Cache = .{
182183 .gpa = comp.gpa,
183 .manifest_dir = comp.cache_parent.manifest_dir,
184 .manifest_dir = try comp.global_cache_directory.handle.makeOpenPath("h", .{}),
184185 };
185 for (comp.cache_parent.prefixes()) |prefix| {
186 cache.addPrefix(prefix);
187 }
186 cache.addPrefix(.{ .path = null, .handle = std.fs.cwd() });
187 cache.addPrefix(comp.zig_lib_directory);
188 cache.addPrefix(comp.global_cache_directory);
189 defer cache.manifest_dir.close();
188190
189191 cache.hash.addBytes(build_options.version);
190192 cache.hash.addOptionalBytes(comp.zig_lib_directory.path);