clang-tool-chain
raw JSON → 1.3.0 verified Fri May 01 auth: no python
Clang Tool Chain provides utilities for C/C++ compilation toolchain management, including locating Clang, setting compilation flags, and building projects. Current version 1.3.0, updated occasionally.
pip install clang-tool-chain Common errors
error FileNotFoundError: [Errno 2] No such file or directory: 'clang' ↓
cause Clang is not installed or not on PATH.
fix
Install Clang (e.g., 'sudo apt-get install clang' on Ubuntu, 'xcode-select --install' on macOS).
error ModuleNotFoundError: No module named 'clang_tool_chain' ↓
cause Import path uses underscores instead of hyphens correctly, but may be confused by package name.
fix
Use 'import clang_tool_chain' (underscore) not 'clang-tool-chain' (hyphen).
Warnings
breaking Version 1.3.0 drops Python 3.9 support. Requires Python >=3.10. ↓
fix Upgrade Python to 3.10+ or pin clang-tool-chain <1.3.0.
gotcha The package does not bundle Clang binaries. It expects Clang to be installed on the system and accessible via PATH. ↓
fix Install Clang from your system package manager (e.g., 'apt install clang', 'brew install llvm').
deprecated The function 'get_toolchain' is deprecated in favor of 'ClangToolChain'. ↓
fix Use 'ClangToolChain' class instead.
Imports
- ClangToolChain wrong
from clang_tool_chain.toolchain import ClangToolChaincorrectfrom clang_tool_chain import ClangToolChain - find_clang wrong
from clang_tool_chain.utils import find_clangcorrectfrom clang_tool_chain import find_clang
Quickstart
from clang_tool_chain import ClangToolChain
tc = ClangToolChain()
print('Clang found at:', tc.clang_path)
print('Compile flags:', tc.get_compile_flags())