Problème compile and master Build.LazyPath

hello I am unable to answer this problem since I updated my master
0.11.0-dev.4333+33e4cbb20

zig build --build-file /home/soleil/Zterm/src-zig/buildGencurs.zig
/home/soleil/Zterm/src-zig/buildGencurs.zig:85:25: error: expected type 'Build.LazyPath', found '*const [6:0]u8'
    Prog.addIncludePath("./lib/");
                        ^~~~~~~~
/home/soleil/.zig/lib/std/Build.zig:1672:22: note: union declared here
pub const LazyPath = union(enum) {
                     ^~~~~
/home/soleil/.zig/lib/std/Build/Step/Compile.zig:1063:45: note: parameter type declared here
pub fn addIncludePath(self: *Compile, path: LazyPath) void {

my source

const std = @import("std");


pub fn build(b: *std.build) void {
    // Standard release options allow the person running `zig build` to select
    // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
    const target   = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});


    // zig-src            source projet
    // zig-src/deps       curs/ form / outils ....
    // src_c              source c/c++
    // zig-src/srcgo      source go-lang 
    // zig-src/srcgo/lib  lib.so source.h


    // Definition of module
    const match = b.createModule(.{
      .source_file = .{ .path = "./deps/curse/match.zig"},
    });
    // data commune
    const dds = b.createModule(.{
      .source_file = .{ .path = "./deps/curse/dds.zig" },
    });
    
    const utils = b.createModule(.{
      .source_file = .{ .path = "./deps/curse/utils.zig" },
      .dependencies= &.{.{ .name = "dds", .module = dds }},
    });

    const cursed = b.createModule(.{
      .source_file = .{ .path = "./deps/curse/cursed.zig" },
      .dependencies= &.{
        .{ .name = "dds", .module = dds },
        .{ .name = "utils", .module = utils },
      },
    });
  
    const forms = b.createModule(.{
      .source_file = .{ .path = "./deps/curse/forms.zig" },
      .dependencies= &.{
        .{ .name = "dds",    .module = dds },
        .{ .name = "cursed", .module = cursed },
        .{ .name = "utils",  .module = utils },
        .{ .name = "match",  .module = match },
      },
    });

    

    const mdlPanel = b.createModule(.{
      .source_file = .{ .path = "./mdlPanel.zig" },
      .dependencies= &.{
        .{ .name = "dds",    .module = dds },
        .{ .name = "cursed", .module = cursed },
        .{ .name = "utils",  .module = utils },
        .{ .name = "forms",  .module = forms },
        .{ .name = "match",  .module = match },
      },
    });

    const mdlObjet = b.createModule(.{
      .source_file = .{ .path = "./mdlObjet.zig" },
      .dependencies= &.{
        .{ .name = "dds",    .module = dds },
        .{ .name = "cursed", .module = cursed },
        .{ .name = "utils",  .module = utils },
        .{ .name = "forms",  .module = forms },
        .{ .name = "match",  .module = match },
      },
    });

    // Building the executable

    const Prog = b.addExecutable(.{
    .name = "Gencurs",
    .root_source_file = .{ .path = "./Gencurs.zig" },
    .target = target,
    .optimize = optimize,
    });
    

    Prog.addIncludePath("./lib/");
    Prog.linkLibC();
    Prog.addObjectFile("/usr/lib/libpcre2-posix.so");
    Prog.addModule("dds"   , dds);
    Prog.addModule("cursed", cursed);
    Prog.addModule("utils" , utils);
    Prog.addModule("forms" , forms);
    Prog.addModule("match" , match);
    Prog.addModule("mdlPanel" , mdlPanel);
    Prog.addModule("mdlObjet" , mdlObjet);



    const install_exe = b.addInstallArtifact(Prog);
    b.getInstallStep().dependOn(&install_exe.step); 

I’m getting the same error. Looks like they’ve changed it in this commit, in lib/std/Build/Step/Compile.zig:

- pub fn addIncludePath(self: *Compile, path: []const u8) void {
+ pub fn addIncludePath(self: *Compile, path: LazyPath) void {

LazyPath is here.
Looks like we should set .path (if relative) or .cwd_relative (if absolute).

So it seems like this works for me:

std.Build.LazyPath { .path = "glad/include" }

instead of

"glad/include"
1 Like
Prog.addIncludePath(.{.path = "./lib/"});
    Prog.linkLibC();
    Prog.addObjectFile(.{.path = "/usr/lib/libpcre2-posix.so"});

now I don’t recognize him anymore

b.addInstallArtifact(Prog); 

/home/soleil/Zterm/src-zig/buildGencurs.zig:99:26: error: member function expected 2 argument(s), found 1
const install_exe = b.addInstallArtifact(Prog);
~^~~~~~~~~~~~~~~~~~~
/home/soleil/.zig/lib/std/Build.zig:1292:5: note: function declared here
pub fn addInstallArtifact(

Yep, other build system changes kicked in for me too:

build.zig:36:8: error: member function expected 1 argument(s), found 2
    exe.addCSourceFile("glad/src/glad.c", c_flags);
    ~~~^~~~~~~~~~~~~~~
/home/archie/apps/zig/lib/std/Build/Step/Compile.zig:938:5: note: function declared here                                                      
pub fn addCSourceFile(self: *Compile, source: CSourceFile) void {

Update: changed

exe.addCSourceFile("glad/src/glad.c", c_flags);

to

exe.addCSourceFile(std.Build.Step.Compile.CSourceFile { .file = .{ .path = "glad/src/glad.c" }, .flags = c_flags });

BTW, this comment says you should use .cwd_relative ( :man_shrugging:) for absolute paths, as in Prog.addObjectFile(.{.path = "/usr/lib/libpcre2-posix.so"});

exact

Prog.addObjectFile(.{.cwd_relative = "/usr/lib/libpcre2-posix.so"});

error
/home/soleil/Zterm/src-zig/buildGencurs.zig:99:26: error: member function expected 2 argument(s), found 1
const install_exe = b.addInstallArtifact(Prog);

I thought I read somewhere that they were going to force to put or put the executable (in which folder)

It looks like now there’s second argument, options.

Quick and dirty suggestion: try adding an empty tuple, something like this:

b.addInstallArtifact(exe, .{});

(saw it here).

1 Like

YES MERCi THANK YOU
example OK

const std = @import("std");


pub fn build(b: *std.build) void {
    // Standard release options allow the person running `zig build` to select
    // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
    const target   = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});

  
    // zig-src            source projet
    // zig-src/deps       curs/ form / outils ....
    // src_c              source c/c++
    // zig-src/srcgo      source go-lang 
    // zig-src/srcgo/lib  lib.so source.h


    // Definition of module
    const match = b.createModule(.{
      .source_file = .{ .path = "./deps/curse/match.zig"},
    });
    // data commune
    const dds = b.createModule(.{
      .source_file = .{ .path = "./deps/curse/dds.zig" },
    });
    
    const utils = b.createModule(.{
      .source_file = .{ .path = "./deps/curse/utils.zig" },
      .dependencies= &.{.{ .name = "dds", .module = dds }},
    });

    const cursed = b.createModule(.{
      .source_file = .{ .path = "./deps/curse/cursed.zig" },
      .dependencies= &.{
        .{ .name = "dds", .module = dds },
        .{ .name = "utils", .module = utils },
      },
    });
  
    const forms = b.createModule(.{
      .source_file = .{ .path = "./deps/curse/forms.zig" },
      .dependencies= &.{
        .{ .name = "dds",    .module = dds },
        .{ .name = "cursed", .module = cursed },
        .{ .name = "utils",  .module = utils },
        .{ .name = "match",  .module = match },
      },
    });

    

    const mdlPanel = b.createModule(.{
      .source_file = .{ .path = "./mdlPanel.zig" },
      .dependencies= &.{
        .{ .name = "dds",    .module = dds },
        .{ .name = "cursed", .module = cursed },
        .{ .name = "utils",  .module = utils },
        .{ .name = "forms",  .module = forms },
        .{ .name = "match",  .module = match },
      },
    });

    const mdlObjet = b.createModule(.{
      .source_file = .{ .path = "./mdlObjet.zig" },
      .dependencies= &.{
        .{ .name = "dds",    .module = dds },
        .{ .name = "cursed", .module = cursed },
        .{ .name = "utils",  .module = utils },
        .{ .name = "forms",  .module = forms },
        .{ .name = "match",  .module = match },
      },
    });

    // Building the executable

    const Prog = b.addExecutable(.{
    .name = "Gencurs",
    .root_source_file = .{ .path = "./Gencurs.zig" },
    .target = target,
    .optimize = optimize,
    });
    

    Prog.addIncludePath(.{.path = "./lib/"});
    Prog.linkLibC();
    Prog.addObjectFile(.{.cwd_relative = "/usr/lib/libpcre2-posix.so"});
    Prog.addModule("dds"   , dds);
    Prog.addModule("cursed", cursed);
    Prog.addModule("utils" , utils);
    Prog.addModule("forms" , forms);
    Prog.addModule("match" , match);
    Prog.addModule("mdlPanel" , mdlPanel);
    Prog.addModule("mdlObjet" , mdlObjet);



    const install_exe = b.addInstallArtifact(Prog, .{});
    b.getInstallStep().dependOn(&install_exe.step); 
1 Like