Commit f183165
committed
fix(generate_klayout_tech): write absolute LEF paths — klayout sandbox
The previous switch to relpath (commit 01652ca) cleaned up the
content but did not actually fix def2stream's errno=2 under a Bazel
sandbox. Investigation via strace shows klayout's
Layout.read(def, layout_options) opens the input DEF (a sandbox
symlink to the bare execroot, staged from orfs_final), realpath's
it to the bare-execroot results dir, and then resolves <lef-files>
relative paths against THAT dir. Sibling intermediates like
objects/klayout_tech.lef only exist in the per-action sandbox, not
at the bare execroot, so the lookup lands at
.../execroot/_main/bazel-out/.../klayout_tech.lef and fails with
errno=2.
Declaring klayout_tech.lef as a Bazel output of orfs_gds doesn't
help -- Bazel only materialises declared outputs at the bare
execroot at action completion, not while the action is still
running and klayout is reading them.
Plain abspath (NOT realpath -- realpath would chase Bazel
input-file symlinks back out to the bare execroot for any input
already at the bare execroot) writes the in-sandbox absolute LEF
path into the LYT. KLayout opens that absolute path directly with
no relative-path resolution involved, so the sibling lookup never
escapes the sandbox.
Cost: the LYT's content now embeds the per-invocation sandbox
number, so the orfs_gds action cannot be cross-action cached.
That's an acceptable trade-off for correctness while we wait for
a klayout-level fix or a Bazel feature that lets us write a
stable bare-execroot path from inside the action.
Confirmed end-to-end:
bazelisk build //flow/designs/sky130hd/gcd:gcd_final_blender_html
produces 6_final.gds and the blender_html sh_binary, with both
the sandbox sandbox-id N going forward and after fresh action
re-runs (verified by deleting outputs and rebuilding).
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>1 parent d605df7 commit f183165
1 file changed
Lines changed: 11 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
59 | 65 | | |
60 | 66 | | |
61 | 67 | | |
| |||
0 commit comments