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
First run, hits the linker error (starting with no zig-cache):
C:\cygwin64\home\kcbanner\temp\zig_link_problem>zig build --verbose
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\zig.exe build-exe C:\cygwin64\home\kcbanner\temp\zig_link_problem\src\main.zig --cache-dir C:\cygwin64\home\kcbanner\temp\zig_link_problem\zig-cache --global-cache-dir C:\Users\kcbanner\AppData\Local\zig --name zig_link_problem --enable-cache
LLD Link... lld-link: error: undefined symbol: add
>>> referenced by C:\cygwin64\home\kcbanner\temp\zig_link_problem\src\main.zig:6
>>> C:\cygwin64\home\kcbanner\temp\zig_link_problem\zig-cache\o\42c298dfef92d87a2a7f32b81df16c92\zig_link_problem.exe.obj:(main.main)
info: cp C:\cygwin64\home\kcbanner\temp\zig_link_problem\zig-cache\o\42c298dfef92d87a2a7f32b81df16c92\zig_link_problem.exe C:\cygwin64\home\kcbanner\temp\zig_link_problem\zig-out\bin\zig_link_problem.exe
error: FileNotFound
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\std\os\windows.zig:126:35: 0x7ff693bc1ce9 in OpenFile (build.exe.obj)
.OBJECT_NAME_NOT_FOUND => return error.FileNotFound,
^
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\std\fs.zig:1224:23: 0x7ff693bc5383 in openFileW (build.exe.obj)
.handle = try w.OpenFile(sub_path_w, .{
^
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\std\fs.zig:1096:13: 0x7ff693ba2dce in openFile (build.exe.obj)
return self.openFileW(path_w.span(), flags);
^
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\std\fs.zig:2532:24: 0x7ff693c279e2 in updateFile (build.exe.obj)
var src_file = try source_dir.openFile(source_path, .{});
^
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\std\build.zig:1089:29: 0x7ff693c30edd in updateFile (build.exe.obj)
const prev_status = try fs.Dir.updateFile(cwd, source_path, cwd, dest_path, .{});
^
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\std\build.zig:3417:9: 0x7ff693c174f2 in make (build.exe.obj)
try builder.updateFile(self.artifact.getOutputSource().getPath(builder), full_dest_path);
^
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\std\build.zig:3649:9: 0x7ff693b8e079 in make (build.exe.obj)
try self.makeFn(self);
^
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\std\build.zig:509:9: 0x7ff693b7c5bc in makeOneStep (build.exe.obj)
try s.make();
^
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\std\build.zig:503:17: 0x7ff693b7c535 in makeOneStep (build.exe.obj)
return err;
^
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\std\build.zig:464:13: 0x7ff693b7c288 in make (build.exe.obj)
try self.makeOneStep(s);
^
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\build_runner.zig:223:21: 0x7ff693b7f1e0 in main (build.exe.obj)
else => return err,
^
error: the following build command failed with exit code 1:
C:\cygwin64\home\kcbanner\temp\zig_link_problem\zig-cache\o\3f57706d3ff6e63f50e1e9ab753dbf4f\build.exe E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\zig.exe C:\cygwin64\home\kcbanner\temp\zig_link_problem C:\cygwin64\home\kcbanner\temp\zig_link_problem\zig-cache C:\Users\kcbanner\AppData\Local\zig --verbose
Second run:
C:\cygwin64\home\kcbanner\temp\zig_link_problem>zig build --verbose
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\zig.exe build-exe C:\cygwin64\home\kcbanner\temp\zig_link_problem\src\main.zig --cache-dir C:\cygwin64\home\kcbanner\temp\zig_link_problem\zig-cache --global-cache-dir C:\Users\kcbanner\AppData\Local\zig --name zig_link_problem --enable-cache
info: cp C:\cygwin64\home\kcbanner\temp\zig_link_problem\zig-cache\o\42c298dfef92d87a2a7f32b81df16c92\zig_link_problem.exe C:\cygwin64\home\kcbanner\temp\zig_link_problem\zig-out\bin\zig_link_problem.exe
error: FileNotFound
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\std\os\windows.zig:126:35: 0x7ff689711ce9 in OpenFile (build.exe.obj)
.OBJECT_NAME_NOT_FOUND => return error.FileNotFound,
^
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\std\fs.zig:1224:23: 0x7ff689715383 in openFileW (build.exe.obj)
.handle = try w.OpenFile(sub_path_w, .{
^
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\std\fs.zig:1096:13: 0x7ff6896f2dce in openFile (build.exe.obj)
return self.openFileW(path_w.span(), flags);
^
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\std\fs.zig:2532:24: 0x7ff6897779e2 in updateFile (build.exe.obj)
var src_file = try source_dir.openFile(source_path, .{});
^
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\std\build.zig:1089:29: 0x7ff689780edd in updateFile (build.exe.obj)
const prev_status = try fs.Dir.updateFile(cwd, source_path, cwd, dest_path, .{});
^
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\std\build.zig:3417:9: 0x7ff6897674f2 in make (build.exe.obj)
try builder.updateFile(self.artifact.getOutputSource().getPath(builder), full_dest_path);
^
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\std\build.zig:3649:9: 0x7ff6896de079 in make (build.exe.obj)
try self.makeFn(self);
^
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\std\build.zig:509:9: 0x7ff6896cc5bc in makeOneStep (build.exe.obj)
try s.make();
^
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\std\build.zig:503:17: 0x7ff6896cc535 in makeOneStep (build.exe.obj)
return err;
^
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\std\build.zig:464:13: 0x7ff6896cc288 in make (build.exe.obj)
try self.makeOneStep(s);
^
E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\lib\build_runner.zig:223:21: 0x7ff6896cf1e0 in main (build.exe.obj)
else => return err,
^
error: the following build command failed with exit code 1:
C:\cygwin64\home\kcbanner\temp\zig_link_problem\zig-cache\o\3f57706d3ff6e63f50e1e9ab753dbf4f\build.exe E:\dev\zig-windows-x86_64-0.11.0-dev.11+0d192ee9e\zig.exe C:\cygwin64\home\kcbanner\temp\zig_link_problem C:\cygwin64\home\kcbanner\temp\zig_link_problem\zig-cache C:\Users\kcbanner\AppData\Local\zig --verbose
Expected Behavior
The build exits after the linker failure, and doesn't try to copy missing artifacts - the file not found error is confusing if you aren't using --verbose.
The build tries to re-link if the artifact is missing.
The text was updated successfully, but these errors were encountered:
kcbanner
added
the
bug
Observed behavior contradicts documented or intended behavior
label
Nov 3, 2022
Zig Version
0.11.0-dev.11+0d192ee9e
Steps to Reproduce and Observed Behavior
I noticed this as part of investigating the build issues on MSVC #12703 (comment)
When there is a linker error, zig build behaves incorrectly in two ways:
Test case:
build.zig
:src/main.zig
:First run, hits the linker error (starting with no zig-cache):
Second run:
Expected Behavior
The text was updated successfully, but these errors were encountered: