-
Notifications
You must be signed in to change notification settings - Fork 107
Open
Labels
buildIssues concerning build systems and processesIssues concerning build systems and processes
Description
Issue
When running heir-opt as a standalone binary, it cannot find the abc binary.
To reproduce
(This assumes we are in the heir directory)
- Build
heir-optusing bazel
- I use
bazel build @heir//tools:heir-opt - There should be a folder under
heir/bazel-bin/tools/heir-opt. The abc binary should also be located atheir/bazel-bin/external/edu_berkeley_abc/abc
- Run heir-opt from the bazel-bin directory with a --yosys-optimizer
- I ran
./bazel-bin/tools/heir-opt --yosys-optimizer --canonicalize --cse heir/tests/yosys_optimizer/add_one.mlir - There should be no visible output, whereas we expect for it to show the modified mlir output.
- Run heir-opt again, but this time use
strace
- I ran
strace ./bazel-bin/tools/heir-opt --yosys-optimizer --canonicalize --cse heir/tests/yosys_optimizer/add_one.mlir - The output is quite large so I've pasted it here
- The line
read(3, "sh: 1: external/edu_berkeley_abc"..., 4096) = 48seems to indicate that it cannot find the abc tool
Solution
What fixed it for me was telling bazel to link to the output location of wherever the abc binary was once it was built.
The modification was made in heir/tools/BUILD.
I changed "HEIR_ABC_BINARY=\\\"$(rootpath @edu_berkeley_abc//:abc)\\\"", to "HEIR_ABC_BINARY=\\\"$(location @edu_berkeley_abc//:abc)\\\"",
Observations
- Everything works for me when running from bazel, ie bazel build and bazel run work fine.
- After the change, bazel build and bazel run still work fine for me.
- The location seems to be an absolute path, so as long as the abc binary is not moved, it works. Otherwise, I had to override the HEIR_ABC_BINARY environment variable to point to the new location of the abc binary
Metadata
Metadata
Assignees
Labels
buildIssues concerning build systems and processesIssues concerning build systems and processes