facebook / buck2

Build system, successor to Buck

Home Page:https://buck2.build/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make it easier to align the binary and prelude versions

Release-Candidate opened this issue · comments

When using the latest prelude, I get to following error on MacOS Sonoma 14.0 on a M1 Machine:

From load at implicit location

Caused by:
    0: From load at prelude/prelude.bzl:8
    1: From load at prelude/native.bzl:15
    2: From load at prelude/apple/apple_macro_layer.bzl:14
    3: From load at prelude/apple/apple_rules_impl_utility.bzl:19
    4: Error evaluating module: `prelude//apple/user/apple_selective_debugging.bzl`
    5: error: Unexpected parameter named `fancy`
         --> prelude/apple/user/apple_selective_debugging.bzl:66:27
          |
       66 |         regex(expression, fancy = True)
          |                           ^^^^^^^^^^^^
          |
       

"# TODO(nga): fancy is probably not needed here."
Well, that would be an easy fix ;)
https://github.com/facebook/buck2/blob/main/prelude/apple/user/apple_selective_debugging.bzl#L65

The commit that introduced the error:
eefb2ba

I suspect the issue is that you are mixing a prelude from HEAD against a slightly older binary. If you checkout a binary as at a particular github hash (e.g. by using one from the releases page) you should also use a prelude from the same commit.

I'm not sure if we have that documented everywhere, but we certainly should. CC @themarwhal who might know if we've written it down.

Yes, I suspected that too, I'm just updating to a new version.

But the problem is that a init --git uses the newest prelude too - that's how I got the error, I've afterwards reproduced it by updating the prelude in another existing project.

Yes, a update to the latest buck2 fixed the error.

Is there a way to set the prelude version with buck2 init --git? I haven't found one in init's help page.

The buck2-prelude hash should probably be cooked into the binary at build-time somehow, and just use that revision automatically, so that by default it checks out the right thing. Maybe I can write a patch for this later today; seems it's an incredibly common issue for all new users...

That sounds great, thanks!

The buck2-prelude hash should probably be cooked into the binary at build-time somehow, and just use that revision automatically, so that by default it checks out the right thing. Maybe I can write a patch for this later today; seems it's an incredibly common issue for all new users...

Very common. I spent quite a bit of time figuring this out, as well. Even better would be to semantic version the prelude, but I'll settle for automatically checking out the correct version via hash. That would be better than tar/untar of the prelude that I do now...

Turning this issue into a task to more generally try and make it easier to keep the prelude and binary in sync.