llvm / llvm/llvm-project

clang analyzer script's python interpreter is not configurable

Open
#190,270 3 comments 0 reactions 0 assignees View on GitHub
clang:static analyzer
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

The clang analyzer scripts (`analyze-build`, `intercept-build` and `scan-build`. Install with a non-configurable `#!/usr/bin/env python3` shebang. The `clang` python module builds for whatever version of `python` it finds at build-time. So if `/usr/bin/python3` is `3.14` at build-time, but then later becomes `3.15`, those scripts will not find a module to import. Please make this shebang configurable, possibly via the `-DPYTHON_EXECUTABLE` `cmake` flag.

Our use case:
On wolfi/Chainguard OS systems, we provide multiple `/usr/bin/python3.x` versions concurrently, and we try to configure all OS commands to use a `#!/usr/bin/env python3.x` shebang instead of making assumptions about `python3`. This allows `/usr/bin/python3` free to point to whatever the end-user/application prefers (or to not exist at all).

Contributor guide

Open the contributing guide

Research direction

Start with the analyze-build, intercept-build, and scan-build script entry points and trace how their Python shebangs are installed. Read the CMake configuration around PYTHON_EXECUTABLE and verify how the clang Python module's build-time interpreter is selected. Done means the installed scripts use the configured interpreter rather than a fixed python3, while still importing the matching module.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, python
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.