Improve setting up docs

Hi all,

Thanks a lot for putting out a quite detailed & easy to navigate documentation & tutorial!

Now,

  1. Does anyone else feels that the docs jump from 0 to 1?
    What about linking concepts from How-it-works & High-level-overview into the setting things up.

    In particular, explaining the main things that went on in the example

    • exir.capture
    • to_edge
    • to_executorch().buffer

    Are those points better explained in one of the tutorials? Pls lemme know :slight_smile:

  2. Am I the only one confused regarding buck2 setup? Did anyone complete it successfully?

    I’m using a Ubuntu 20.04 box (as host), and both buck-x86_64--linux failed.

    buck2-x86_64-unknown-linux-gnu:

    ./prebuilt/buck2-x86_64-unknown-linux-gnu: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./prebuilt/buck2-x86_64-unknown-linux-gnu)
    ./prebuilt/buck2-x86_64-unknown-linux-gnu: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./prebuilt/buck2-x86_64-unknown-linux-gnu)
    ./prebuilt/buck2-x86_64-unknown-linux-gnu: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by ./prebuilt/buck2-x86_64-unknown-linux-gnu)
    

    buck2-x86_64-unknown-linux-musl:

    [2023-11-10T11:23:58.475+00:00] Build ID: 541f9152-c492-4838-84d5-1ddda1d847cb
    [2023-11-10T11:23:58.477+00:00] File changed: root//log
    [2023-11-10T11:23:58.523+00:00] Command failed: 
    [2023-11-10T11:23:58.523+00:00] Error running analysis for `root//examples/portable/executor_runner:executor_runner (prelude//platforms:default#524f8da68ea2a374)`
    [2023-11-10T11:23:58.523+00:00]
    [2023-11-10T11:23:58.523+00:00] Caused by:
    [2023-11-10T11:23:58.523+00:00]     0: Error looking up configured node root//examples/portable/executor_runner:executor_runner (prelude//platforms:default#524f8da68ea2a374)
    [2023-11-10T11:23:58.523+00:00]     1: Error looking up configured node root//examples/portable/executor_runner:executor_runner_lib (prelude//platforms:default#524f8da68ea2a374)
    [2023-11-10T11:23:58.523+00:00]     2: Error looking up configured node root//runtime/executor:program (prelude//platforms:default#524f8da68ea2a374)
    [2023-11-10T11:23:58.523+00:00]     3: Error looking up configured node root//schema:program (prelude//platforms:default#524f8da68ea2a374)
    [2023-11-10T11:23:58.523+00:00]     4: Error looking up configured node root//third-party:flatbuffers-api (prelude//platforms:default#524f8da68ea2a374)
    [2023-11-10T11:23:58.523+00:00]     5: looking up unconfigured target node `root//third-party:flatbuffers-api`
    [2023-11-10T11:23:58.523+00:00]     6: Error loading targets in package `root//third-party` for target `root//third-party:flatbuffers-api`
    [2023-11-10T11:23:58.523+00:00]     7: Error evaluating build file: `root//third-party:TARGETS`
    [2023-11-10T11:23:58.523+00:00]     8: Traceback (most recent call last):
    [2023-11-10T11:23:58.523+00:00]          * third-party/TARGETS:9, in <module>
    [2023-11-10T11:23:58.523+00:00]              define_gflags()
    [2023-11-10T11:23:58.523+00:00]          * third-party/gflags.bzl:5, in define_gflags
    [2023-11-10T11:23:58.523+00:00]              (exported_headers, headers, srcs) = gflags_sources(namespace = [
    [2023-11-10T11:23:58.523+00:00]          * third-party/gflags_defs.bzl:8, in gflags_sources
    [2023-11-10T11:23:58.523+00:00]              native.genrule(
    [2023-11-10T11:23:58.523+00:00]        error: Error coercing attribute `srcs` of `root//third-party:gflags_declare_h`
    [2023-11-10T11:23:58.523+00:00]          --> third-party/gflags_defs.bzl:8:5
    [2023-11-10T11:23:58.523+00:00]           |
    [2023-11-10T11:23:58.523+00:00]         8 |       native.genrule(
    [2023-11-10T11:23:58.523+00:00]           |  _____^
    [2023-11-10T11:23:58.523+00:00]         9 | |         name = "gflags_declare_h",
    [2023-11-10T11:23:58.523+00:00]        10 | |         srcs = ["gflags/src/gflags_declare.h.in"],
    [2023-11-10T11:23:58.523+00:00]        11 | |         out = "gflags/gflags_declare.h",
    [2023-11-10T11:23:58.523+00:00]        12 | |         cmd = (common_preamble + "awk '{ " +
    [2023-11-10T11:23:58.523+00:00]        13 | |                "gsub(/@GFLAGS_NAMESPACE@/, \"" + namespace[0] + "\"); " +
    [2023-11-10T11:23:58.523+00:00]        14 | |                "gsub(/@(HAVE_STDINT_H|HAVE_SYS_TYPES_H|HAVE_INTTYPES_H|GFLAGS_INTTYPES_FORMAT_C99)@/, \"1\"); " +
    [2023-11-10T11:23:58.523+00:00]        15 | |                "gsub(/@([A-Z0-9_]+)@/, \"0\"); " +
    [2023-11-10T11:23:58.523+00:00]        16 | |                "print; }' $SRCS > $OUT"),
    [2023-11-10T11:23:58.523+00:00]        17 | |     )
    [2023-11-10T11:23:58.523+00:00]           | |_____^
    [2023-11-10T11:23:58.523+00:00]           |
    [2023-11-10T11:23:58.523+00:00]        
    [2023-11-10T11:23:58.523+00:00]        
    [2023-11-10T11:23:58.523+00:00]        Error coercing attribute `srcs` of `root//third-party:gflags_declare_h`
    [2023-11-10T11:23:58.523+00:00]        
    [2023-11-10T11:23:58.523+00:00]        Caused by:
    [2023-11-10T11:23:58.523+00:00]            0: Error coercing attribute `srcs` of type `attrs.one_of(attrs.dict(attrs.string(), attrs.source(), sorted=False), attrs.list(attrs.source()), default=[])`
    [2023-11-10T11:23:58.523+00:00]            1: Error coercing ["gflags/src/gflags_declare.h.in"]
    [2023-11-10T11:23:58.523+00:00]            2: one_of fails, the errors against each alternative in turn were:
    [2023-11-10T11:23:58.523+00:00]               Expected value of type `dict`, got value with type `list` (value was `["gflags/src/gflags_declare.h.in"]`)
    [2023-11-10T11:23:58.523+00:00]               Error coercing "gflags/src/gflags_declare.h.in": Couldn't coerce `gflags/src/gflags_declare.h.in` as a source.
    [2023-11-10T11:23:58.523+00:00]                 Error when treated as a target: Invalid absolute target pattern `gflags/src/gflags_declare.h.in` is not allowed: Expected a `:`, a trailing `/...` or the literal `...`.
    [2023-11-10T11:23:58.523+00:00]                 Error when treated as a path: Source file `gflags/src/gflags_declare.h.in` does not exist as a member of package `root//third-party`.
    [2023-11-10T11:23:58.523+00:00]        
    BUILD FAILED
    

Cheers!

P.D. Yeah a bit of burger feedback :hamburger: :blush:

2 Likes

Updated title of the post & report something confusing regarding the setup of buck2.

I believe that the install_requirements.sh & submodule biz ran succesffully. I will re-do those step :person_shrugging:
Test if I should use binaries of target. The docs don’t mention anything about it, but worth testing buck2-aarch64-unknown-linux-musl, ``buck2-aarch64-unknown-linux-gnu`
Check Gthub issue :slight_smile:

Hi, I had the same issue for buck2 and figured out how to install it.

Instead of downloading binary files (.zst), I downloaded the source code (.zip file) and install it via Rust compiler by myself.

$ wget https://github.com/facebook/buck2/archive/refs/tags/2023-07-18.zip
$ unzip 2023-07-18.zip && cd 2023-07-18
$ cargo install --path=app/buck2
$ cd EXECUTORCH_ROOT
$ buck2 build //examples/portable/executor_runner:executor_runner --show-output

If installed correctly, the last command should succeed.

A few notes:

  • If you see errors in the last step regarding “-fuse-ld=lld”, try “sudo apt install clang lld”
  • As described in the guide, you should install the specific version of buck2, otherwise you will encounter build error. I tried to install buck2 through public crate (i.e., cargo +nightly-2023-07-10 install --git https://github.com/facebook/buck2.git buck2 does not work).
  • The GLIBC error seems to be mismatch between the environment where the binary was built and your environments. I tried to install newer versions of CLIB but could not find a clean way to add them.
1 Like

Can someone else validate @yunseong approach?
Happy to mark it as solution :slight_smile:

BTW, I forgot to post my solution. But, I documented my experience here