Fingerprint help

bonjour,

A new order, fingerprint ??? in build.zig.zon

you have to compile once for nothing to know the fingerprint ???

znd .name change “program” to .program

.{
    .name = .program,
    .version = « 0.0.0 »,
    .dependencies = .{
        .liblmdb = .{
            .path = "../liblmdb",
        },
        .liboffset = .{
            .path = "../liboffset",
        },
        .libdate = .{
            .path = "../libdate",
        },
    },
    .paths = .{"",},
    .fingerprint = ????,
}

Traduit avec DeepL.com (version gratuite)

This is related to the new package hash format: implement new package hash format: `$name-$semver-$hash` by andrewrk · Pull Request #22994 · ziglang/zig · GitHub

I’m sure this will be explained fully in the upcoming 0.14 release notes (I believe this is scheduled for today)

4 Likes

I ran into the same “issue” while trying to use the latest master today. That’s the expected behavior as per zig/doc/build.zig.zon.md at de43f5eb6ae4a569efe15e3469b3de76a86d9cd1 · ziglang/zig · GitHub .

1 Like

But it doesn’t say where to find the “fingerprint”, it’s like compiling twice to get the “fingerprint” ???

In the link provided by @yamafaktory it says:

The fingerprint can be regenerated by deleting the field and running zig build.

i haven’t tried this yet, but this might be necessary for old projects, but new zig inits might generate the fingerprint automatically.

please example

When building without fingerprint, zig build calculates and displays one:

build.zig.zon:1:2: error: missing top-level 'fingerprint' field; suggested value: 0xf588f14da27bdf66
.{
 ^

Copy the generated value into your build.zig.zon like:

    .minimum_zig_version = "0.14.0",
    .fingerprint = 0xf588f14da27bdf66,
2 Likes

by the way, in case you’re a bit dumb like me, a few things to be aware of:

  • the fingerprint is determined in part by the .name field.
  • (as of zig-0.14.0-dev.3452) if you run zig init in a directory named test, because test is not a valid bare identifier in Zig (it’s a reserved word, so would require .@"test"), you will need to change the .name field for your init project to compile.
  • every time you change the .name field, you will also need to recompute the .fingerprint field (i.e. delete it and run zig build).
1 Like

what I understand: example

.name ==> as400jplpc,
.version = “0.0.0”,
.minimum_zig_version = “ 0.14.0 ”,
    .dependencies = .{
        .liblmdb = .{
            .path = “ ../liblmdb ”,
        },
        .liboffset = .{
            .path = “../liboffset”,
        },
        .libdate = .{
            .path = “../libdate”,
        },
    },
    .paths = .{” ”,},
    .fingerprint = 0xbbebb3706425d0a9,
}

.name is the developer
we generate once and retrieve the fingerprint
and transfer no. fingerprint

if you have several projects, keep the same name and fingerprint

.version = “0.0.0”,
.minimum_zig_version = “0.14.0”,

for guidance only, not mandatory

1 Like

No, .name is the name of the project. fingerprint is a random value (based in part by the name?). it shouldn’t change, unless you are forking a project, as the name and fingerprint make a globally unique Id to identity the package.

1 Like

I’m developing a set of libraries in the form of a project, which can then be grouped together in a package,
but they’re not finished yet: on the one hand, I’m coming back to them (because I’m still learning ZIG)