bazel: enable tclreadline in Bazel#9700
bazel: enable tclreadline in Bazel#9700maliberty merged 2 commits intoThe-OpenROAD-Project:masterfrom
Conversation
b5f4c17 to
547ea33
Compare
There was a problem hiding this comment.
Code Review
This pull request enables tclreadline support in the Bazel build, which provides a better interactive prompt. The changes introduce a new repository rule to detect the system-installed tclreadline library, with fallbacks for systems where it's not available. The implementation is sound, but I have one suggestion to improve the robustness and clarity of the library detection script by avoiding duplicate search paths.
bazel/tclreadline.bzl
Outdated
| # Find the header | ||
| header_found = False | ||
| header_dir = "" | ||
| for d in include_dirs + ["/usr/include", "/usr/local/include"]: |
There was a problem hiding this comment.
The list of include directories is constructed by simple concatenation, which can lead to duplicate paths if include_dirs (from pkg-config) already contains /usr/include. While the break on line 38 prevents incorrect behavior in this case, this approach is inefficient and can be confusing.
To improve this, you should create a unique list of paths before iterating. A common way to do this in Starlark (which lacks a set type) is to use a dictionary as a temporary ordered set:
unique_include_dirs = {}
for d in include_dirs + ["/usr/include", "/usr/local/include"]:
unique_include_dirs[d] = True
for d in unique_include_dirs.keys():
# ... search logic ...This same issue of potential duplicates applies to the library search paths on lines 43 and 64, and the library names on line 49.
Signed-off-by: alokkumardalei-wq <alokkumardalei2@gmail.com>
547ea33 to
00c7610
Compare
|
This appears to be looking for a locally installed tclreadline. The goal of the bazel build is to be hermetic and not rely on local installation. |
|
clang-tidy review says "All clean, LGTM! 👍" |
9a115df to
946048b
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
|
Hello @maliberty, Thanks for the feedback! The build is now fully hermetic — tclreadline is fetched from source via http_archive and no longer relies on any system-installed libraries. Please see commit 47f963a for the changes. |
|
And also you can have a look on these Open PRs when you have time: |
946048b to
f82fd4b
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
f82fd4b to
bbe61cb
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
bbe61cb to
47f963a
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
|
Hello @maliberty, Thank you |
|
pr-merge ran and bazel failed with |
47f963a to
983fbf5
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
983fbf5 to
4ecb37d
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
|
Hello @maliberty, Thanks for catching that and sorry about before(my bad)! You were right — the Jenkins Linux build failed because the container lacked the system readline in Main.cc. |
Signed-off-by: alokkumardalei-wq <alokkumardalei2@gmail.com>
4ecb37d to
4ec0e17
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
|
Hello @maliberty again sorry for inconvenience I think I forgot to remove this line |
|
Hello @maliberty the pr merge jenkins integrations failed to pass it's showing this in the output logs |
|
I restarted that pipeline as it seems to be some dockerhub flakiness |
|
I don't understand this change. The openroad readline integration works, and tcl is also compiled with readline. We are using readline from BCR already. So we should use that. Edit: If tcclreadline is a separate repo, it should be upstreamed to BCR, not http-archive fetched here. |
|
if this is adding functionality, probably not rollback, but next follow-up is upstreaming the bazel rule to BCR |
Note: Since there is no scope of installing tclreadline in macOS , therefore all the development and testing was done in linux Docker container with tclreadline available there.
What does this PR resolves?
Fixes #7115 .
Trying to fix missing tclreadline support for BUILD.bazel.
What actually the issue is?
The Bazel build was missing tclreadline support,
so running bazelisk run //:openroad
showed a bare % prompt instead of openroad>.
What changes are made to fix this ?
bazel/tclreadline.bzl— repository rule to detect the system-installed tclreadline library at build time via pkg-config, falling back to common system paths (new file created ).
MODULE.bazel
— registers the new repository.
BUILD.bazel— adds ENABLE_READLINE + TCLRL_LIBRARY defines and links @tclreadline on supported platforms.
Validation/Testing:
Validation and testing only can done tclreadline is installed , here in our case the Linux Docker Image.
In macOs it uses the stub empty target (no tclreadline available).
Expected output (in macOS):
Expected output (before fix in linux official OpenRoad Docker image environment):
Expected output (After fix in linux official OpenRoad Docker image environment):