Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the global cache dir for the manifests of generated mingw .libs #19173

Merged

Conversation

squeek502
Copy link
Collaborator

@squeek502 squeek502 commented Mar 4, 2024

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 local/global cache mismatch was introduced in the stage1 -> stage2 transition of this code.


This is something I've run into many times but never looked into the root cause until now.

Note: The mingw.zig code now matches what's done in glibc.zig:

zig/src/glibc.zig

Lines 676 to 684 in 90c1a2c

// Use the global cache directory.
var cache: Cache = .{
.gpa = comp.gpa,
.manifest_dir = try comp.global_cache_directory.handle.makeOpenPath("h", .{}),
};
cache.addPrefix(.{ .path = null, .handle = fs.cwd() });
cache.addPrefix(comp.zig_lib_directory);
cache.addPrefix(comp.global_cache_directory);
defer cache.manifest_dir.close();

@andrewrk andrewrk enabled auto-merge (rebase) March 4, 2024 07:05
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.
@squeek502 squeek502 force-pushed the windows-mingw-manifest-cache-mismatch branch from fc0a5f5 to bfca89d Compare March 4, 2024 08:09
@andrewrk andrewrk merged commit 4696439 into ziglang:master Mar 4, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants