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

x86_64-windows-msvc: 'Unable to provide a libc for the chosen target' #2720

Closed
kilgariff opened this issue Jun 20, 2019 · 2 comments
Closed

Comments

@kilgariff
Copy link

kilgariff commented Jun 20, 2019

After trying to upgrade my project from zig 0.3.0 to 0.4.0 it's no longer able to build.
I'm running 64-bit windows 10. zig targets says my native triple is x86_64-windows-msvc.

Here's the full output from zig build. It says The target is non-native which seems wrong as the host and the target are both 64-bit windows 10.

Zig is unable to provide a libc for the chosen target 'x86_64-unknown-windows-msvc'.
The target is non-native, so Zig also cannot use the native libc installation.
Choose a target which has a libc available, or provide a libc installation text file.
See `zig libc --help` for more details.
The following command exited with error code 1:
C:\Users\Ross\Desktop\zig-stuff\zig-windows-x86_64-0.4.0+381c6a38\zig.exe build-exe C:\Users\Ross\Desktop\game_sketches\sketch_2\src\main.zig --library c --library kernel32.lib --library User32.lib --library Gdi32.lib --library Shell32.lib --object C:\Users\Ross\Desktop\game_sketches\sketch_2\c-compat\glfw3.lib --object C:\Users\Ross\Desktop\game_sketches\sketch_2\c-compat\glad.lib --object C:\Users\Ross\Desktop\game_sketches\sketch_2\c-compat\cimgui.lib --cache-dir C:\Users\Ross\Desktop\game_sketches\sketch_2\zig-cache --name sketch -target x86_64-windows-msvc -isystem C:\Users\Ross\Desktop\game_sketches\sketch_2\c-compat --library-path c-compat --cache on
exec failed
C:\Users\Ross\Desktop\zig-stuff\zig-windows-x86_64-0.4.0+381c6a38\lib\zig\std\build.zig:772:36: 0x7ff737ac12a4 in std.build.Builder::std.build.Builder.exec (build.obj)
                    std.debug.panic("exec failed");
                                   ^
C:\Users\Ross\Desktop\zig-stuff\zig-windows-x86_64-0.4.0+381c6a38\lib\zig\std\build.zig:1594:52: 0x7ff737abac84 in std.build.LibExeObjStep::std.build.LibExeObjStep.make (build.obj)
            const output_path_nl = try builder.exec(zig_args.toSliceConst());
                                                   ^
C:\Users\Ross\Desktop\zig-stuff\zig-windows-x86_64-0.4.0+381c6a38\lib\zig\std\build.zig:1895:24: 0x7ff737aab700 in std.build.Step::std.build.Step.make (build.obj)
        try self.makeFn(self);
                       ^
C:\Users\Ross\Desktop\zig-stuff\zig-windows-x86_64-0.4.0+381c6a38\lib\zig\std\build.zig:313:19: 0x7ff737aaa3d8 in std.build.Builder::std.build.Builder.makeOneStep (build.obj)
        try s.make();
                  ^
C:\Users\Ross\Desktop\zig-stuff\zig-windows-x86_64-0.4.0+381c6a38\lib\zig\std\build.zig:303:29: 0x7ff737aaa36e in std.build.Builder::std.build.Builder.makeOneStep (build.obj)
            self.makeOneStep(dep) catch |err| {
                            ^
C:\Users\Ross\Desktop\zig-stuff\zig-windows-x86_64-0.4.0+381c6a38\lib\zig\std\build.zig:261:33: 0x7ff737aa5427 in std.build.Builder::std.build.Builder.make (build.obj)
            try self.makeOneStep(s);
                                ^
C:\Users\Ross\Desktop\zig-stuff\zig-windows-x86_64-0.4.0+381c6a38\lib\zig\std\special\build_runner.zig:137:17: 0x7ff737aa2c77 in main (build.obj)
    builder.make(targets.toSliceConst()) catch |err| {
                ^
C:\Users\Ross\Desktop\zig-stuff\zig-windows-x86_64-0.4.0+381c6a38\lib\zig\std\special\bootstrap.zig:65:49: 0x7ff737aa160a in ??? (build.obj)
    std.os.windows.kernel32.ExitProcess(callMain());
                                                ^
???:?:?: 0x7fff72554034 in ??? (???)


???:?:?: 0x7fff73cb3691 in ??? (???)



Build failed. The following command failed:
C:\Users\Ross\Desktop\game_sketches\sketch_2\zig-cache\o\NCiTOwSf19YjsKbMdz2_faBtsAWPk4laPJ9vPztz2XB5JXDQ0m0Uvitdu02ezJrd\build.exe C:\Users\Ross\Desktop\zig-stuff\zig-windows-x86_64-0.4.0+381c6a38\zig.exe C:\Users\Ross\Desktop\game_sketches\sketch_2 C:\Users\Ross\Desktop\game_sketches\sketch_2\zig-cache

If I don't set the target, zig build gets further but it can't find the Windows SDK include path for windows.h or GL/gl.h.

@emekoi
Copy link
Contributor

emekoi commented Jun 21, 2019

the message about not being native is correct. when you explicitly set the target triple zig always identifies that as non-native and you'll need an explicit libc file for that.

@andrewrk
Copy link
Member

andrewrk commented Jun 27, 2019

@emekoi's advice is good - try making the target native.

Note that once #514 is done, zig will have a libc available on windows regardless of whether compiling non-natively.

I'm closing this, but if the advice does not work feel free to comment and I'll re-open.

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

No branches or pull requests

3 participants