Improve setting up docs

username: escorciav
cooked: <p>Hi all,</p>
<p>Thanks a lot for putting out a quite detailed &amp; easy to navigate documentation &amp; tutorial!</p>
<p>Now,</p>
<ol>
<li>
<p><strong>Does anyone else feels that the docs jump from 0 to 1?</strong><br>
What about linking concepts from <a href="https://pytorch.org/executorch/stable/intro-how-it-works.html" rel="noopener nofollow ugc">How-it-works</a> &amp; <a href="https://pytorch.org/executorch/stable/getting-started-architecture.html" rel="noopener nofollow ugc">High-level-overview</a> into <a href="https://pytorch.org/executorch/stable/getting-started-setup.html" rel="noopener nofollow ugc">the setting things up</a>.</p>
<p>In particular, explaining the main things that went on in the example</p>
<ul>
<li><code>exir.capture</code></li>
<li><code>to_edge</code></li>
<li><code>to_executorch().buffer</code></li>
</ul>
<p><em>Are those points better explained in one of the tutorials?</em> Pls lemme know <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=12" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
</li>
<li>
<p>Am I the only one confused regarding <code>buck2</code> setup? Did anyone complete it successfully?</p>
<p>I’m using a Ubuntu 20.04 box (as host), and both buck-x86_64-<em>-linux</em> failed.</p>
<p><code>buck2-x86_64-unknown-linux-gnu</code>:</p>
<pre><code class="lang-plaintext">./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)
</code></pre>
<p><code>buck2-x86_64-unknown-linux-musl</code>:</p>
<pre><code class="lang-auto">[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 &lt;module&gt;
[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]          --&gt; 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 &gt; $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
</code></pre>
</li>
</ol>
<p>Cheers!</p>
<p>P.D. Yeah a bit of burger feedback <img src="https://discuss.pytorch.org/images/emoji/apple/hamburger.png?v=12" title=":hamburger:" class="emoji" alt=":hamburger:" loading="lazy" width="20" height="20"> <img src="https://discuss.pytorch.org/images/emoji/apple/blush.png?v=12" title=":blush:" class="emoji" alt=":blush:" loading="lazy" width="20" height="20"></p>

username: escorciav
cooked: <p>Updated title of the post &amp; report something confusing regarding the setup of <code>buck2</code>.</p>
<p><span class="chcklst-box checked fa fa-check-square-o fa-fw"></span> I believe that the <code>install_requirements.sh</code> &amp; submodule biz ran succesffully. I will re-do those step <img src="https://discuss.pytorch.org/images/emoji/apple/person_shrugging.png?v=12" title=":person_shrugging:" class="emoji" alt=":person_shrugging:" loading="lazy" width="20" height="20"><br>
<span class="chcklst-box checked fa fa-check-square-o fa-fw"></span> Test if I should use binaries of target. The docs don’t mention anything about it, but worth testing <code>buck2-aarch64-unknown-linux-musl</code>, ``buck2-aarch64-unknown-linux-gnu`<br>
<span class="chcklst-box fa fa-square-o fa-fw"></span> Check Gthub issue <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=12" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>

username: yunseong
cooked: <p>Hi, I had the same issue for buck2 and figured out how to install it.</p>
<p>Instead of downloading binary files (.zst), I downloaded the source code (.zip file) and install it via Rust compiler by myself.</p>
<pre><code class="lang-auto">$ wget https://github.com/facebook/buck2/archive/refs/tags/2023-07-18.zip
$ unzip 2023-07-18.zip &amp;&amp; cd 2023-07-18
$ cargo install --path=app/buck2
$ cd EXECUTORCH_ROOT
$ buck2 build //examples/portable/executor_runner:executor_runner --show-output
</code></pre>
<p>If installed correctly, the last command should succeed.</p>
<p>A few notes:</p>
<ul>
<li>If you see errors in the last step regarding “-fuse-ld=lld”, try “sudo apt install clang lld”</li>
<li>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., <code>cargo +nightly-2023-07-10 install --git https://github.com/facebook/buck2.git buck2</code> does not work).</li>
<li>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.</li>
</ul>

username: escorciav
cooked: <p>Can someone else validate <a class="mention" href="/u/yunseong">@yunseong</a> approach?<br>
Happy to mark it as solution <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=12" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<p>BTW, I forgot to post my solution. But, I documented my experience <a href="https://github.com/pytorch/executorch/issues/1163#issuecomment-1821354150" rel="noopener nofollow ugc">here</a></p>