You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check out the build-dependency-path branch of https://github.com/ianprime0509/pathological-packages (commit 6be4a689b948bf5032156f488ae2d7cabf131fc9). This is a simple example of a project with a dependency specified using path in build.zig.zon which imports that dependency in build.zig as a build helper. Running zig build --help on the project as-is shows that a do-something step has been added to the build.
Now, change the path of the helper dependency in the root build.zig.zon to an incorrect path, such as ./invalid/helper. Run zig build --help again, and now the output is as follows:
/var/home/ian/src/pathological-packages/build.zig:2:24: error: no module named 'helper' available within module root.@build
const helper = @import("helper");
^~~~~~~~
referenced by:
build: /var/home/ian/src/pathological-packages/build.zig:5:5
runBuild__anon_4419: /var/home/ian/src/zig/lib/std/Build.zig:2388:33
6 reference(s) hidden; use '-freference-trace=8' to see all references
Expected Output
The error message should mention that the incorrect path in build.zig.zon does not exist or does not refer to a package which can be imported as a build helper (e.g. if the path exists but does not contain a build.zig).
For comparison, invoking b.dependency("helper", .{}) in the same project with the invalid path yields the following error, which does contain this context:
unable to open '/var/home/ian/src/pathological-packages/invalid/helper': FileNotFound
error: the following build command failed with exit code 1:
/var/home/ian/src/pathological-packages/.zig-cache/o/348eb32a6d21a299b246f2bdb33dbcb8/build /var/home/ian/src/zig/build/stage3/bin/zig /var/home/ian/src/zig/lib /var/home/ian/src/pathological-packages /var/home/ian/src/pathological-packages/.zig-cache /var/home/ian/.cache/zig --seed 0x5063ab2 -Z3a012f4b1ad78b7c --help
The text was updated successfully, but these errors were encountered:
ianprime0509
changed the title
Misleading error message for path-based dependency used as build helper
Misleading error message for missing path-based dependency used as build helper
Dec 21, 2024
Zig Version
0.14.0-dev.2546+0ff0bdb4a
Steps to Reproduce and Observed Output
Check out the
build-dependency-path
branch of https://github.com/ianprime0509/pathological-packages (commit 6be4a689b948bf5032156f488ae2d7cabf131fc9). This is a simple example of a project with a dependency specified usingpath
inbuild.zig.zon
which imports that dependency inbuild.zig
as a build helper. Runningzig build --help
on the project as-is shows that ado-something
step has been added to the build.Now, change the
path
of thehelper
dependency in the rootbuild.zig.zon
to an incorrect path, such as./invalid/helper
. Runzig build --help
again, and now the output is as follows:Expected Output
The error message should mention that the incorrect path in
build.zig.zon
does not exist or does not refer to a package which can be imported as a build helper (e.g. if the path exists but does not contain abuild.zig
).For comparison, invoking
b.dependency("helper", .{})
in the same project with the invalid path yields the following error, which does contain this context:The text was updated successfully, but these errors were encountered: