llvm / llvm/llvm-project

LLVMConfig.cmake contains details about the host python modules

Open
#161,199 1 comment 0 reactions 0 assignees View on GitHub
cmake
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

`LLVMConfig.cmake` contains an assignment that is just specifying what Python modules were available on the build host at the time of the configure:

```
set(LLVM_HAVE_OPT_VIEWER_MODULES @LLVM_HAVE_OPT_VIEWER_MODULES@)
```

It appears that this variable is only used to control whether the opt-viewer tests in `llvm/test/tools/opt-viewer/` are executed?

This is mostly pointless:
- It is set even if opt-viewer is disabled
- If I configure llvm and then install the dependencies, it is wrong and the tests will not be ran when they should
- If I configure llvm and the uninstall the dependencies, it is wrong and the tests will fail

But also actively harmful:
- An installed file changes its contents based what python modules happen to be installed on the build machine, even if opt-viewer isn't enabled.

I propose removing this assignment from the public file, and simply running the opt-viewer tests if opt-viewer is enabled and the dependencies are present.

Contributor guide

Open the contributing guide

Research direction

Start with the LLVMConfig.cmake assignment and inspect the opt-viewer tests under llvm/test/tools/opt-viewer/ to trace how Python module availability controls their execution. Done means the installed public configuration no longer records host module details, while opt-viewer tests run according to the feature and dependency conditions described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, python
Domain
build-system, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.