Skip to content

[build system] cannot build static library for any windows-gnu target #6552

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

Closed
codehz opened this issue Oct 4, 2020 · 2 comments
Closed
Assignees
Labels
bug Observed behavior contradicts documented or intended behavior os-windows
Milestone

Comments

@codehz
Copy link
Contributor

codehz commented Oct 4, 2020

The build.zig

const Builder = @import("std").build.Builder;

pub fn build(b: *Builder) void {
    const target = b.standardTargetOptions(.{});
    const mode = b.standardReleaseOptions();
    const lib = b.addStaticLibrary("demo", "src/main.zig");
    lib.setTarget(target);
    lib.setBuildMode(mode);
    lib.install();

    var main_tests = b.addTest("src/main.zig");
    main_tests.setBuildMode(mode);

    const test_step = b.step("test", "Run library tests");
    test_step.dependOn(&main_tests.step);
}

command:

D:\Temp\demo> zig build -Dtarget=x86_64-windows-gnu
error: FileNotFound

some details:
it seems try to copy libdemo.a but there only demo.lib in cache folder.
crash in

try builder.updateFile(self.artifact.getOutputPath(), full_dest_path);

and got zig build ... --name demo ... here

zig/lib/std/build.zig

Lines 2102 to 2103 in 0e2d858

zig_args.append("--name") catch unreachable;
zig_args.append(self.name) catch unreachable;

@alexnask alexnask added bug Observed behavior contradicts documented or intended behavior os-windows labels Oct 4, 2020
codehz added a commit to codehz/zig that referenced this issue Oct 4, 2020
use libX.a for any-windows-gnu target
@ikskuh
Copy link
Contributor

ikskuh commented Oct 4, 2020

Seems like a duplicate of #6483

@andrewrk andrewrk added this to the 0.7.0 milestone Oct 5, 2020
@andrewrk andrewrk self-assigned this Oct 5, 2020
andrewrk added a commit that referenced this issue Oct 5, 2020
See #6552 #6553 #6483

Also fixes a regression introduced in
1d777e9 of not converting an integer to
a string for a command line parameter.
@andrewrk
Copy link
Member

Fixed by 33bc1eb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior os-windows
Projects
None yet
Development

No branches or pull requests

4 participants