-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Cross compile to Windows fails with relative global cache directory path #19284
Comments
Yes, it did work previously with Zig 0.11.0. |
Seems also related to the error I am getting from a basic raylib hello-world (0.12.0-dev.3284+153ba46a5)
Seems the path up to the downloaded cache directory is being inserted twice. |
Closes ziglang#19284 As of 9f2cb92 configuring the global cache directory to a relative path causes errors of the following form when cross compiling to `windows-gnu`. ``` error: unable to generate DLL import .lib file for kernel32: FileNotFound ``` The issue occurred because the `def_final_path` included the global cache path as a prefix and later on the `def_final_file` was created using that path with the global cache directory handle.
Closes #19284 As of 9f2cb92 configuring the global cache directory to a relative path causes errors of the following form when cross compiling to `windows-gnu`. ``` error: unable to generate DLL import .lib file for kernel32: FileNotFound ``` The issue occurred because the `def_final_path` included the global cache path as a prefix and later on the `def_final_file` was created using that path with the global cache directory handle.
Closes ziglang#19284 As of 9f2cb92 configuring the global cache directory to a relative path causes errors of the following form when cross compiling to `windows-gnu`. ``` error: unable to generate DLL import .lib file for kernel32: FileNotFound ``` The issue occurred because the `def_final_path` included the global cache path as a prefix and later on the `def_final_file` was created using that path with the global cache directory handle.
Zig Version
0.12.0-dev.3282+da5b16f9e
Steps to Reproduce and Observed Behavior
Configuring a global cache directory on the command line using a relative path causes cross compilation to Windows to fail. Tested on Ubuntu 22.04 x86_64.
Steps to reproduce
Download and unpack the Zig SDK.
Create a simple hello world program.
Try to cross-compile to Windows while specifying a global cache directory on the command line using a relative path.
$ zig-linux-x86_64-0.12.0-dev.3282+da5b16f9e/zig build-exe --global-cache-dir custom-zig-global-cache -target x86_64-windows-gnu main.zig error: unable to generate DLL import .lib file for kernel32: FileNotFound
Observe how the build fails due to a missing
.lib
file for thekernel32
library.Run the same command, but use an absolute path for the global cache directory parameter.
Observe how the build succeeds and the produced binary can run with Wine.
Context
This issue was initially observed in https://github.com/aherrmann/rules_zig when trying to update to Zig 0.12.0-dev. To ensure that builds are hermetic and reproducible, rules_zig controls the global and local cache directories. At the moment it declares a global and local cache output for each build action that is managed by Bazel. Bazel operates on relative paths, so these cache directory paths are always configured using relative paths.
(Side note: Better cache handling is planned as a future improvement, see aherrmann/rules_zig#87)
Expected Behavior
Zig builds should succeed irrespective of whether the global (or local) cache paths are specified as relative or absolute paths.
The text was updated successfully, but these errors were encountered: