clang-tool-chain 1.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1815 @@
1
+ Metadata-Version: 2.4
2
+ Name: clang-tool-chain
3
+ Version: 1.0.3
4
+ Summary: Clang Tool Chain - C/C++ compilation toolchain utilities
5
+ Project-URL: Homepage, https://github.com/zackees/clang-tool-chain
6
+ Project-URL: Repository, https://github.com/zackees/clang-tool-chain
7
+ Project-URL: Issues, https://github.com/zackees/clang-tool-chain/issues
8
+ Author: Zachary Vorhies
9
+ Maintainer: Zachary Vorhies
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: c,clang,compiler,cpp,toolchain
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Software Development :: Build Tools
22
+ Classifier: Topic :: Software Development :: Compilers
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: fasteners>=0.19.0
25
+ Requires-Dist: pyzstd>=0.16.0
26
+ Requires-Dist: uv-iso-env>=1.0.0
27
+ Provides-Extra: dev
28
+ Requires-Dist: black>=24.0.0; extra == 'dev'
29
+ Requires-Dist: isort>=5.13.0; extra == 'dev'
30
+ Requires-Dist: mypy>=1.8.0; extra == 'dev'
31
+ Requires-Dist: pre-commit>=3.6.0; extra == 'dev'
32
+ Requires-Dist: pyright>=1.1.350; extra == 'dev'
33
+ Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
34
+ Requires-Dist: pytest-xdist>=3.5.0; extra == 'dev'
35
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
36
+ Requires-Dist: ruff>=0.3.0; extra == 'dev'
37
+ Requires-Dist: sccache>=0.7.0; extra == 'dev'
38
+ Provides-Extra: sccache
39
+ Requires-Dist: sccache>=0.7.0; extra == 'sccache'
40
+ Description-Content-Type: text/markdown
41
+
42
+ # Clang Tool Chain
43
+
44
+ **A zero-configuration Python package that distributes pre-built Clang/LLVM binaries with automatic downloading and installation.**
45
+
46
+ [![PyPI version](https://img.shields.io/pypi/v/clang-tool-chain.svg)](https://pypi.org/project/clang-tool-chain/)
47
+ [![Downloads](https://pepy.tech/badge/clang-tool-chain)](https://pepy.tech/project/clang-tool-chain)
48
+ [![Linting](https://github.com/zackees/clang-tool-chain/actions/workflows/lint.yml/badge.svg)](https://github.com/zackees/clang-tool-chain/actions/workflows/lint.yml)
49
+ [![win-gnu](https://github.com/zackees/clang-tool-chain/actions/workflows/test-win-gnu.yml/badge.svg)](https://github.com/zackees/clang-tool-chain/actions/workflows/test-win-gnu.yml)
50
+ [![win-msvc](https://github.com/zackees/clang-tool-chain/actions/workflows/test-win-msvc.yml/badge.svg)](https://github.com/zackees/clang-tool-chain/actions/workflows/test-win-msvc.yml)
51
+ [![linux-x86](https://github.com/zackees/clang-tool-chain/actions/workflows/test-linux-x86.yml/badge.svg)](https://github.com/zackees/clang-tool-chain/actions/workflows/test-linux-x86.yml)
52
+ [![linux-arm](https://github.com/zackees/clang-tool-chain/actions/workflows/test-linux-arm.yml/badge.svg)](https://github.com/zackees/clang-tool-chain/actions/workflows/test-linux-arm.yml)
53
+ [![macos-x86](https://github.com/zackees/clang-tool-chain/actions/workflows/test-macos-x86.yml/badge.svg)](https://github.com/zackees/clang-tool-chain/actions/workflows/test-macos-x86.yml)
54
+ [![macos-arm](https://github.com/zackees/clang-tool-chain/actions/workflows/test-macos-arm.yml/badge.svg)](https://github.com/zackees/clang-tool-chain/actions/workflows/test-macos-arm.yml)
55
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
56
+ [![Python Version](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
57
+
58
+ ---
59
+
60
+ ## ⚡ Quick Start
61
+
62
+ Get compiling in 30 seconds:
63
+
64
+ ```bash
65
+ # Install the package
66
+ pip install clang-tool-chain
67
+
68
+ # Compile C code - binaries download automatically on first use!
69
+ echo 'int main() { return 0; }' > hello.c
70
+ clang-tool-chain-c hello.c -o hello
71
+ ./hello # Windows: .\hello.exe
72
+
73
+ # Verify installation (optional but recommended)
74
+ clang-tool-chain-test # Runs 7 diagnostic tests
75
+ ```
76
+
77
+ **That's it!** The LLVM toolchain (~52-91 MB) downloads automatically on first use. No manual setup required.
78
+
79
+ > **Note:** This package currently uses:
80
+ > - **LLVM 21.1.5** for Windows and Linux
81
+ > - **LLVM 19.1.6** for macOS (21.1.5 coming soon)
82
+ >
83
+ > See [Platform Support Matrix](#-platform-support-matrix) for details.
84
+
85
+ ### ⚠️ Windows Users: GNU ABI by Default
86
+
87
+ This matches the behavior of [zig cc](https://ziglang.org/learn/overview/#cross-compiling-is-a-first-class-use-case) and ensures consistent C++ ABI across all platforms.
88
+
89
+ **What this means:**
90
+ - ✅ **C++11 strict mode works** - No C++14 extensions in standard library headers
91
+ - ✅ **Cross-platform consistency** - Same ABI on Windows/Linux/macOS
92
+ - ✅ **Arduino/embedded compatibility** - Matches GCC/GNU toolchain behavior
93
+ - ⚠️ **Cannot link with MSVC libraries** - Different C++ ABI (use MSVC variant if needed)
94
+
95
+ **Default behavior (GNU ABI):**
96
+ ```bash
97
+ clang-tool-chain-c main.c -o program # Uses x86_64-w64-mingw32 target
98
+ clang-tool-chain-cpp main.cpp -o program # Uses GNU ABI, libc++ stdlib
99
+ ```
100
+
101
+ **For MSVC ABI (Windows-specific projects):**
102
+ ```bash
103
+ clang-tool-chain-c-msvc main.c -o program.exe # Uses x86_64-pc-windows-msvc
104
+ clang-tool-chain-cpp-msvc main.cpp -o program.exe # Uses MSVC ABI, MSVC stdlib
105
+
106
+ # With sccache for compilation caching
107
+ clang-tool-chain-sccache-c-msvc main.c -o program.exe
108
+ clang-tool-chain-sccache-cpp-msvc main.cpp -o program.exe
109
+ ```
110
+
111
+ **Download sizes:**
112
+ - **First run (GNU target):** ~100-120 MB (includes MinGW-w64 sysroot)
113
+ - **MSVC variant:** ~50 MB (uses Visual Studio SDK if available)
114
+
115
+ **Windows SDK Requirements:**
116
+
117
+ MSVC variants require Visual Studio or Windows SDK for system headers/libraries. The package automatically:
118
+ - ✅ Detects SDK via environment variables (WindowsSdkDir, VCToolsInstallDir, etc.)
119
+ - ⚠️ Shows helpful setup instructions if SDK not found
120
+ - 🔧 Suggests alternatives (Visual Studio Dev Prompt, vcvarsall.bat, or GNU ABI)
121
+
122
+ **When to use MSVC variant:**
123
+ - Linking with MSVC-compiled libraries (DLLs with C++ APIs)
124
+ - Windows-specific projects requiring Visual Studio integration
125
+ - COM/WinRT/Windows Runtime components
126
+ - Using Windows SDK features not available in MinGW
127
+
128
+ **When to use GNU ABI (default):**
129
+ - Cross-platform projects (same ABI on all platforms)
130
+ - Strict C++11 mode (MSVC requires C++14 extensions)
131
+ - No Windows SDK installation required
132
+ - Arduino/embedded projects (matches GCC)
133
+
134
+ ### 📋 Command Quick Reference
135
+
136
+ | Task | Command (Default) | Windows MSVC Variant |
137
+ |------|-------------------|---------------------|
138
+ | **Compile C** | `clang-tool-chain-c main.c -o program` | `clang-tool-chain-c-msvc main.c -o program.exe` |
139
+ | **Compile C++** | `clang-tool-chain-cpp main.cpp -o program` | `clang-tool-chain-cpp-msvc main.cpp -o program.exe` |
140
+ | **Build & Run** | `clang-tool-chain-build-run main.cpp` | Same |
141
+ | **Build & Run (Cached)** | `clang-tool-chain-build-run --cached main.cpp` | Same |
142
+ | **Cached C** | `clang-tool-chain-sccache-c main.c -o program` | `clang-tool-chain-sccache-c-msvc main.c -o program.exe` |
143
+ | **Cached C++** | `clang-tool-chain-sccache-cpp main.cpp -o program` | `clang-tool-chain-sccache-cpp-msvc main.cpp -o program.exe` |
144
+ | **Link Objects** | `clang-tool-chain-ld obj1.o obj2.o -o program` | N/A (use compiler) |
145
+ | **Create Library** | `clang-tool-chain-ar rcs libname.a obj1.o obj2.o` | Same |
146
+ | **Format Code** | `clang-tool-chain-format -i file.cpp` | Same |
147
+ | **Check Installation** | `clang-tool-chain info` | Same |
148
+ | **Verify Setup** | `clang-tool-chain-test` | Same |
149
+
150
+ **Note:** MSVC variants (`*-msvc`) are Windows-only and require Visual Studio or Windows SDK. Automatic SDK detection with helpful error messages included.
151
+
152
+ ---
153
+
154
+ ## 📦 Installation
155
+
156
+ ### From PyPI (Recommended)
157
+
158
+ ```bash
159
+ pip install clang-tool-chain
160
+ ```
161
+
162
+ ### From Source
163
+
164
+ ```bash
165
+ # Clone the repository
166
+ git clone https://github.com/zackees/clang-tool-chain.git
167
+ cd clang-tool-chain
168
+
169
+ # Install dependencies
170
+ ./install
171
+
172
+ # Or manually with uv
173
+ uv venv --python 3.11
174
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
175
+ uv pip install -e ".[dev]"
176
+ ```
177
+
178
+ **Note:** Binaries download automatically on first use. No manual setup required!
179
+
180
+ **macOS Users:** Requires Xcode Command Line Tools for system headers. Run `xcode-select --install` if not already installed.
181
+
182
+ ---
183
+
184
+ ## 🎯 Why clang-tool-chain?
185
+
186
+ ### The Problem
187
+
188
+ Installing LLVM/Clang traditionally requires:
189
+ - Large downloads (1-3 GB installer/archive)
190
+ - System-wide installation with admin privileges
191
+ - Manual PATH configuration
192
+ - Platform-specific installation procedures
193
+ - Version management headaches in CI/CD
194
+
195
+ ### The Solution
196
+
197
+ `clang-tool-chain` provides:
198
+
199
+ | Feature | clang-tool-chain | Full LLVM Install | System Compiler | zig cc |
200
+ |---------|------------------|-------------------|-----------------|--------|
201
+ | **Size** | 52-91 MB | 1-3 GB | Varies | ~80 MB |
202
+ | **Setup Time** | < 30 seconds | 5-15 minutes | Varies | < 30 seconds |
203
+ | **Admin Required** | ❌ No | ✅ Yes (usually) | ✅ Yes | ❌ No |
204
+ | **Auto Download** | ✅ Yes | ❌ No | ❌ No | ✅ Yes |
205
+ | **Version Control** | ✅ Pin in requirements | ❌ System-wide | ❌ System-wide | ⚠️ Tied to Zig version |
206
+ | **Cross-Platform** | ✅ Identical on all OS | ❌ Different procedures | ❌ Different versions | ✅ Yes |
207
+ | **Cross-Compilation** | Platform-specific | ❌ Complex | ❌ Complex | ✅ Single binary, all targets |
208
+ | **CI/CD Ready** | ✅ Zero config | ❌ Complex setup | ⚠️ Depends on runner | ✅ Zero config |
209
+ | **Offline After DL** | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
210
+ | **Python Integration** | ✅ Native | ❌ Manual | ❌ Manual | ❌ Manual |
211
+
212
+ ### Perfect For
213
+
214
+ - **CI/CD Pipelines** - Reproducible builds with pinned toolchain versions
215
+ - **Educational Environments** - Students get started instantly without installation hassles
216
+ - **Development Teams** - Everyone uses the exact same compiler version
217
+ - **Containerized Builds** - Minimal Docker image overhead
218
+ - **Python Projects** - Seamless integration with Python build systems
219
+
220
+ ### Not Recommended For
221
+
222
+ - **Production Embedded Systems** - Use vendor-specific toolchains
223
+ - **Kernel Development** - System compilers with specific patches
224
+ - **Custom LLVM Builds** - If you need specific LLVM patches/features
225
+ - **Air-Gapped Environments** - Requires manual setup (see [Offline Mode](#offline-mode))
226
+ - **Cross-Compilation to Different Architectures** - Use `zig cc` for multi-target cross-compilation
227
+
228
+ ---
229
+
230
+ ## ✨ Features
231
+
232
+ - **Automatic Download on First Use** - Zero-configuration installation to `~/.clang-tool-chain/`
233
+ - **Manifest-Based Distribution** - Version-controlled releases with SHA256 checksum verification
234
+ - **Ultra-Optimized Archives** - 94.3% size reduction via binary stripping, deduplication, and zstd-22 compression
235
+ - **Cross-Platform Support** - Windows x64, macOS x64/ARM64, Linux x64/ARM64
236
+ - **Concurrent-Safe Installation** - File locking prevents race conditions in parallel builds
237
+ - **Python Wrapper Commands** - 23 entry points for all essential LLVM tools
238
+ - **Pre-Built Binaries** - Clang 21.1.5 (Linux/Windows), 19.1.6 (macOS)
239
+ - **Essential Toolchain Utilities** - Compilers, linkers, binary utilities, and code formatters
240
+ - **Automatic macOS SDK Detection** - Seamlessly finds system headers on macOS without configuration
241
+
242
+ ---
243
+
244
+ ## 🚀 Usage
245
+
246
+ ### CLI Commands
247
+
248
+ Manage your toolchain installation:
249
+
250
+ ```bash
251
+ # Show installation information and available tools
252
+ clang-tool-chain info
253
+
254
+ # Run diagnostic tests (verify installation)
255
+ clang-tool-chain test
256
+
257
+ # List all available wrapper commands
258
+ clang-tool-chain list-tools
259
+
260
+ # Show version of a specific tool
261
+ clang-tool-chain version clang
262
+ clang-tool-chain version clang++
263
+
264
+ # Show path to binaries directory
265
+ clang-tool-chain path
266
+
267
+ # Show path to specific tool
268
+ clang-tool-chain path clang
269
+
270
+ # Show package and LLVM versions
271
+ clang-tool-chain package-version
272
+ ```
273
+
274
+ ### Wrapper Commands
275
+
276
+ #### Compiling C Code
277
+
278
+ ```bash
279
+ # Simple compilation
280
+ clang-tool-chain-c hello.c -o hello
281
+
282
+ # With optimization
283
+ clang-tool-chain-c -O2 hello.c -o hello
284
+
285
+ # With debugging symbols
286
+ clang-tool-chain-c -g hello.c -o hello
287
+
288
+ # Check version
289
+ clang-tool-chain-c --version
290
+ ```
291
+
292
+ #### Compiling C++ Code
293
+
294
+ ```bash
295
+ # Simple compilation
296
+ clang-tool-chain-cpp hello.cpp -o hello
297
+
298
+ # With C++20 standard
299
+ clang-tool-chain-cpp -std=c++20 hello.cpp -o hello
300
+
301
+ # With optimization and warnings
302
+ clang-tool-chain-cpp -O3 -Wall -Wextra hello.cpp -o hello
303
+
304
+ # Check version
305
+ clang-tool-chain-cpp --version
306
+ ```
307
+
308
+ #### Using the Build Utilities
309
+
310
+ **Basic Build Command**
311
+
312
+ The `clang-tool-chain-build` command provides a simple way to compile projects:
313
+
314
+ ```bash
315
+ # Build a single C file
316
+ clang-tool-chain-build hello.c hello
317
+
318
+ # Build a C++ file with custom output name
319
+ clang-tool-chain-build hello.cpp myprogram
320
+
321
+ # Build with optimization
322
+ clang-tool-chain-build hello.cpp myprogram -O2
323
+ ```
324
+
325
+ **Build-and-Run Command**
326
+
327
+ The `clang-tool-chain-build-run` command compiles and immediately executes your program:
328
+
329
+ ```bash
330
+ # Compile and run a C++ program
331
+ clang-tool-chain-build-run hello.cpp
332
+
333
+ # With compiler flags
334
+ clang-tool-chain-build-run hello.cpp -O2 -std=c++17
335
+
336
+ # Pass arguments to the program
337
+ clang-tool-chain-build-run hello.cpp -- arg1 arg2
338
+
339
+ # Use caching for faster development iterations
340
+ clang-tool-chain-build-run --cached hello.cpp
341
+
342
+ # Combined: caching + compiler flags + program arguments
343
+ clang-tool-chain-build-run --cached hello.cpp -O2 -- input.txt
344
+ ```
345
+
346
+ **How it works:**
347
+ - Takes a source file (e.g., `hello.cpp`)
348
+ - Compiles to executable (e.g., `hello.exe` on Windows, `hello` on Unix)
349
+ - Runs the executable immediately
350
+ - With `--cached`: Skips compilation if source hasn't changed (SHA256 hash-based)
351
+
352
+ **Shebang Support (Unix/Linux/macOS):**
353
+
354
+ Make C++ files directly executable:
355
+
356
+ ```cpp
357
+ #!/usr/bin/env -S clang-tool-chain-build-run --cached
358
+ #include <iostream>
359
+ int main() {
360
+ std::cout << "Hello from executable C++!" << std::endl;
361
+ return 0;
362
+ }
363
+ ```
364
+
365
+ ```bash
366
+ chmod +x script.cpp
367
+ ./script.cpp # Compiles on first run, cached on subsequent runs
368
+ ```
369
+
370
+ #### CMake Integration
371
+
372
+ **Option 1: Environment Variables (Recommended)**
373
+
374
+ ```cmake
375
+ # CMakeLists.txt
376
+ cmake_minimum_required(VERSION 3.15)
377
+ project(MyProject)
378
+
379
+ # No changes needed - respects CC/CXX environment variables
380
+ add_executable(myapp main.cpp)
381
+ ```
382
+
383
+ ```bash
384
+ export CC=clang-tool-chain-c
385
+ export CXX=clang-tool-chain-cpp
386
+ cmake -B build
387
+ cmake --build build
388
+ ```
389
+
390
+ **Option 2: Direct Compiler Specification**
391
+
392
+ ```bash
393
+ cmake -B build \
394
+ -DCMAKE_C_COMPILER=clang-tool-chain-c \
395
+ -DCMAKE_CXX_COMPILER=clang-tool-chain-cpp
396
+ cmake --build build
397
+ ```
398
+
399
+ #### Linking
400
+
401
+ ```bash
402
+ # Link object files
403
+ clang-tool-chain-ld obj1.o obj2.o -o program
404
+
405
+ # Create shared library (Linux/macOS)
406
+ clang-tool-chain-ld -shared obj1.o obj2.o -o libmylib.so
407
+
408
+ # Create DLL (Windows)
409
+ clang-tool-chain-ld -shared obj1.o obj2.o -o mylib.dll
410
+ ```
411
+
412
+ #### Binary Utilities
413
+
414
+ ```bash
415
+ # Create static library
416
+ clang-tool-chain-ar rcs libmylib.a obj1.o obj2.o
417
+
418
+ # List symbols in binary
419
+ clang-tool-chain-nm program
420
+
421
+ # List symbols in library
422
+ clang-tool-chain-nm libmylib.a
423
+
424
+ # Disassemble binary
425
+ clang-tool-chain-objdump -d program
426
+
427
+ # Show all headers
428
+ clang-tool-chain-objdump -x program
429
+
430
+ # Strip debug symbols
431
+ clang-tool-chain-strip program -o program.stripped
432
+
433
+ # Copy and modify object files
434
+ clang-tool-chain-objcopy --strip-debug program program.stripped
435
+
436
+ # Generate archive index
437
+ clang-tool-chain-ranlib libmylib.a
438
+
439
+ # Read ELF headers (Linux)
440
+ clang-tool-chain-readelf -h program
441
+
442
+ # Show program headers
443
+ clang-tool-chain-readelf -l program
444
+ ```
445
+
446
+ #### Code Formatting and Analysis
447
+
448
+ ```bash
449
+ # Format C/C++ code (in-place)
450
+ clang-tool-chain-format -i myfile.cpp
451
+
452
+ # Format with specific style
453
+ clang-tool-chain-format -i -style=LLVM myfile.cpp
454
+
455
+ # Check formatting (don't modify)
456
+ clang-tool-chain-format myfile.cpp
457
+
458
+ # Run static analysis
459
+ clang-tool-chain-tidy myfile.cpp -- -std=c++17
460
+
461
+ # Run with specific checks
462
+ clang-tool-chain-tidy -checks='-*,readability-*' myfile.cpp --
463
+ ```
464
+
465
+ #### sccache Integration (Optional)
466
+
467
+ Speed up repeated builds with compilation caching:
468
+
469
+ ```bash
470
+ # Install with sccache support
471
+ pip install clang-tool-chain[sccache]
472
+ # Or: cargo install sccache
473
+
474
+ # Compile with sccache caching
475
+ clang-tool-chain-sccache-c main.c -o main
476
+ clang-tool-chain-sccache-cpp main.cpp -o main
477
+
478
+ # Query cache statistics
479
+ clang-tool-chain-sccache --show-stats
480
+
481
+ # Clear cache statistics
482
+ clang-tool-chain-sccache --zero-stats
483
+
484
+ # Manage sccache server
485
+ clang-tool-chain-sccache --start-server
486
+ clang-tool-chain-sccache --stop-server
487
+ clang-tool-chain-sccache --version
488
+ ```
489
+
490
+ **How it works:**
491
+ - Caches compilation results locally for faster rebuilds
492
+ - Transparent caching layer on top of clang
493
+ - Requires `sccache` binary in PATH
494
+ - Works with distributed caching backends (optional)
495
+
496
+ ### All Available Commands
497
+
498
+ | Command | Tool | Description |
499
+ |---------|------|-------------|
500
+ | `clang-tool-chain` | CLI | Main management interface |
501
+ | `clang-tool-chain-test` | Diagnostic | Run 7 diagnostic tests to verify installation |
502
+ | `clang-tool-chain-fetch` | Fetch utility | Manual download utility for pre-fetching binaries |
503
+ | `clang-tool-chain-paths` | Path utility | Get installation paths in JSON format |
504
+ | `clang-tool-chain-fetch-archive` | Archive utility | Maintainer tool for creating optimized archives |
505
+ | `clang-tool-chain-c` | `clang` | C compiler (GNU ABI on Windows) |
506
+ | `clang-tool-chain-cpp` | `clang++` | C++ compiler (GNU ABI on Windows) |
507
+ | `clang-tool-chain-c-msvc` | `clang` | C compiler (MSVC ABI, Windows only) |
508
+ | `clang-tool-chain-cpp-msvc` | `clang++` | C++ compiler (MSVC ABI, Windows only) |
509
+ | `clang-tool-chain-build` | Build utility | Simple build tool for C/C++ |
510
+ | `clang-tool-chain-build-run` | Build & Run utility | Compile and run in one step (with optional caching) |
511
+ | `clang-tool-chain-sccache` | `sccache` | Direct sccache access (stats, management) |
512
+ | `clang-tool-chain-sccache-c` | `sccache` + `clang` | C compiler with sccache caching |
513
+ | `clang-tool-chain-sccache-cpp` | `sccache` + `clang++` | C++ compiler with sccache caching |
514
+ | `clang-tool-chain-ld` | `lld` / `lld-link` | LLVM linker |
515
+ | `clang-tool-chain-ar` | `llvm-ar` | Archive/library creator |
516
+ | `clang-tool-chain-nm` | `llvm-nm` | Symbol table viewer |
517
+ | `clang-tool-chain-objdump` | `llvm-objdump` | Object file dumper/disassembler |
518
+ | `clang-tool-chain-objcopy` | `llvm-objcopy` | Object file copier/modifier |
519
+ | `clang-tool-chain-ranlib` | `llvm-ranlib` | Archive index generator |
520
+ | `clang-tool-chain-strip` | `llvm-strip` | Symbol stripper |
521
+ | `clang-tool-chain-readelf` | `llvm-readelf` | ELF file reader |
522
+ | `clang-tool-chain-as` | `llvm-as` | LLVM assembler |
523
+ | `clang-tool-chain-dis` | `llvm-dis` | LLVM disassembler |
524
+ | `clang-tool-chain-format` | `clang-format` | Code formatter |
525
+ | `clang-tool-chain-tidy` | `clang-tidy` | Static analyzer/linter |
526
+
527
+ ---
528
+
529
+ ## 📚 Examples
530
+
531
+ ### Hello World (C)
532
+
533
+ ```c
534
+ // hello.c
535
+ #include <stdio.h>
536
+
537
+ int main() {
538
+ printf("Hello from clang-tool-chain!\n");
539
+ return 0;
540
+ }
541
+ ```
542
+
543
+ ```bash
544
+ clang-tool-chain-c hello.c -o hello
545
+ ./hello
546
+ ```
547
+
548
+ ### Hello World (C++)
549
+
550
+ ```cpp
551
+ // hello.cpp
552
+ #include <iostream>
553
+
554
+ int main() {
555
+ std::cout << "Hello from clang-tool-chain!" << std::endl;
556
+ return 0;
557
+ }
558
+ ```
559
+
560
+ ```bash
561
+ clang-tool-chain-cpp hello.cpp -o hello
562
+ ./hello
563
+ ```
564
+
565
+ ### Multi-File Compilation
566
+
567
+ ```c
568
+ // math_ops.h
569
+ #ifndef MATH_OPS_H
570
+ #define MATH_OPS_H
571
+ int add(int a, int b);
572
+ int multiply(int a, int b);
573
+ #endif
574
+
575
+ // math_ops.c
576
+ #include "math_ops.h"
577
+ int add(int a, int b) { return a + b; }
578
+ int multiply(int a, int b) { return a * b; }
579
+
580
+ // main.c
581
+ #include <stdio.h>
582
+ #include "math_ops.h"
583
+
584
+ int main() {
585
+ printf("5 + 3 = %d\n", add(5, 3));
586
+ printf("5 * 3 = %d\n", multiply(5, 3));
587
+ return 0;
588
+ }
589
+ ```
590
+
591
+ ```bash
592
+ # Compile and link in one step
593
+ clang-tool-chain-c main.c math_ops.c -o program
594
+ ./program
595
+
596
+ # Or compile separately then link
597
+ clang-tool-chain-c -c math_ops.c -o math_ops.o
598
+ clang-tool-chain-c -c main.c -o main.o
599
+ clang-tool-chain-c main.o math_ops.o -o program
600
+ ./program
601
+ ```
602
+
603
+ ### Creating a Static Library
604
+
605
+ ```bash
606
+ # Compile source files to object files
607
+ clang-tool-chain-c -c math_ops.c -o math_ops.o
608
+ clang-tool-chain-c -c string_ops.c -o string_ops.o
609
+
610
+ # Create static library
611
+ clang-tool-chain-ar rcs libmylib.a math_ops.o string_ops.o
612
+
613
+ # Generate archive index (optional but recommended)
614
+ clang-tool-chain-ranlib libmylib.a
615
+
616
+ # Link against the library
617
+ clang-tool-chain-c main.c -L. -lmylib -o program
618
+ ./program
619
+ ```
620
+
621
+ ### Cross-Platform Build Script
622
+
623
+ ```bash
624
+ #!/bin/bash
625
+ # build.sh - Cross-platform build script
626
+
627
+ set -e
628
+
629
+ # Compile
630
+ echo "Compiling..."
631
+ clang-tool-chain-c -O2 -Wall -Wextra src/*.c -o myprogram
632
+
633
+ # Strip symbols for release
634
+ echo "Stripping symbols..."
635
+ clang-tool-chain-strip myprogram -o myprogram.release
636
+
637
+ echo "Build complete: myprogram.release"
638
+ ```
639
+
640
+ ---
641
+
642
+ ## 🚀 CI/CD Integration
643
+
644
+ ### GitHub Actions
645
+
646
+ ```yaml
647
+ # .github/workflows/build.yml
648
+ name: Build
649
+
650
+ on: [push, pull_request]
651
+
652
+ jobs:
653
+ build:
654
+ runs-on: ${{ matrix.os }}
655
+ strategy:
656
+ matrix:
657
+ os: [ubuntu-latest, windows-latest, macos-latest]
658
+
659
+ steps:
660
+ - uses: actions/checkout@v3
661
+
662
+ - name: Set up Python
663
+ uses: actions/setup-python@v4
664
+ with:
665
+ python-version: '3.11'
666
+
667
+ - name: Install clang-tool-chain
668
+ run: pip install clang-tool-chain
669
+
670
+ - name: Compile project
671
+ run: |
672
+ clang-tool-chain-c src/main.c -o program
673
+ ./program # Binaries download automatically on first use!
674
+
675
+ - name: Upload artifact
676
+ uses: actions/upload-artifact@v3
677
+ with:
678
+ name: program-${{ matrix.os }}
679
+ path: program*
680
+ ```
681
+
682
+ ### GitLab CI
683
+
684
+ ```yaml
685
+ # .gitlab-ci.yml
686
+ image: python:3.11
687
+
688
+ stages:
689
+ - build
690
+ - test
691
+
692
+ build:
693
+ stage: build
694
+ script:
695
+ - pip install clang-tool-chain
696
+ - clang-tool-chain-c src/main.c -o program # Auto-downloads on first use
697
+ - clang-tool-chain-strip program
698
+ artifacts:
699
+ paths:
700
+ - program
701
+
702
+ test:
703
+ stage: test
704
+ script:
705
+ - ./program
706
+ ```
707
+
708
+ ### Docker
709
+
710
+ ```dockerfile
711
+ # Dockerfile
712
+ FROM python:3.11-slim
713
+
714
+ # Install clang-tool-chain
715
+ RUN pip install clang-tool-chain
716
+
717
+ # Pre-download binaries (optional - they auto-download on first use)
718
+ RUN clang-tool-chain info || true
719
+
720
+ # Copy source code
721
+ COPY src/ /app/src/
722
+ WORKDIR /app
723
+
724
+ # Build
725
+ RUN clang-tool-chain-c src/main.c -o program
726
+
727
+ CMD ["./program"]
728
+ ```
729
+
730
+ **Build and run:**
731
+ ```bash
732
+ docker build -t myapp .
733
+ docker run myapp
734
+ ```
735
+
736
+ ### Azure Pipelines
737
+
738
+ ```yaml
739
+ # azure-pipelines.yml
740
+ trigger:
741
+ - main
742
+
743
+ pool:
744
+ vmImage: 'ubuntu-latest'
745
+
746
+ steps:
747
+ - task: UsePythonVersion@0
748
+ inputs:
749
+ versionSpec: '3.11'
750
+
751
+ - script: |
752
+ pip install clang-tool-chain
753
+ clang-tool-chain-c src/main.c -o program
754
+ displayName: 'Build with clang-tool-chain'
755
+
756
+ - task: PublishBuildArtifacts@1
757
+ inputs:
758
+ pathToPublish: 'program'
759
+ artifactName: 'executable'
760
+ ```
761
+
762
+ ---
763
+
764
+ ## 🌍 Platform Support Matrix
765
+
766
+ | Platform | Architecture | LLVM Version | Archive Size | Installed Size | Status |
767
+ |----------|--------------|--------------|--------------|----------------|--------|
768
+ | Windows | x86_64 | 21.1.5 | ~100 MB* | ~350 MB | ✅ Stable |
769
+ | Linux | x86_64 | 21.1.5 | ~88 MB | ~350 MB | ✅ Stable |
770
+ | Linux | ARM64 | 21.1.5 | ~91 MB | ~340 MB | ✅ Stable |
771
+ | macOS | x86_64 | 19.1.6 | ~75 MB | ~300 MB | ✅ Stable |
772
+ | macOS | ARM64 | 19.1.6 | ~71 MB | ~285 MB | ✅ Stable |
773
+
774
+ \* **Windows Downloads:**
775
+ - **GNU target (default):** ~100 MB (LLVM + MinGW-w64 sysroot)
776
+ - **MSVC target (opt-in):** ~50 MB (LLVM only, requires Visual Studio SDK)
777
+
778
+ **Note:** macOS uses LLVM 19.1.6 due to availability of pre-built binaries. LLVM 21.1.5 support coming soon.
779
+
780
+ ### Requirements
781
+
782
+ - **Python**: 3.10 or higher
783
+ - **Disk Space**: ~100 MB for archive + ~200-350 MB installed
784
+ - **Internet**: Required for initial download (works offline after installation)
785
+ - **Operating System**:
786
+ - Windows 10+ (x64)
787
+ - macOS 11+ (x64 or ARM64/Apple Silicon) - **Requires Xcode Command Line Tools**: `xcode-select --install`
788
+ - Linux with glibc 2.27+ (x64 or ARM64)
789
+
790
+ ---
791
+
792
+ ## ⚙️ Configuration
793
+
794
+ ### Environment Variables
795
+
796
+ - **`CLANG_TOOL_CHAIN_DOWNLOAD_PATH`**: Override default installation location
797
+
798
+ ```bash
799
+ # Linux/macOS
800
+ export CLANG_TOOL_CHAIN_DOWNLOAD_PATH=/custom/path
801
+ clang-tool-chain-c hello.c -o hello
802
+
803
+ # Windows
804
+ set CLANG_TOOL_CHAIN_DOWNLOAD_PATH=C:\custom\path
805
+ clang-tool-chain-c hello.c -o hello
806
+ ```
807
+
808
+ **Use cases:**
809
+ - Testing different toolchain versions
810
+ - Shared installations across projects
811
+ - Network or cache drives
812
+ - CI/CD artifact caching
813
+
814
+ ### macOS SDK Detection (Automatic)
815
+
816
+ macOS users no longer need to manually configure SDK paths! The toolchain automatically detects your Xcode Command Line Tools SDK using `xcrun`.
817
+
818
+ **Requirements:**
819
+ ```bash
820
+ xcode-select --install # One-time setup
821
+ ```
822
+
823
+ **How it works:**
824
+ - Automatically injects `-isysroot` when compiling on macOS
825
+ - Detects SDK via `xcrun --show-sdk-path`
826
+ - Respects `SDKROOT` environment variable if set
827
+ - Uses explicit `-isysroot` flag if provided by user
828
+ - Disabled with `CLANG_TOOL_CHAIN_NO_SYSROOT=1`
829
+
830
+ **Advanced Configuration:**
831
+ ```bash
832
+ # Use custom SDK path (standard macOS variable)
833
+ export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
834
+
835
+ # Disable automatic SDK detection (not recommended)
836
+ export CLANG_TOOL_CHAIN_NO_SYSROOT=1
837
+
838
+ # Explicit SDK path (takes priority)
839
+ clang-tool-chain-c -isysroot /path/to/sdk hello.c -o hello
840
+ ```
841
+
842
+ **Automatic injection is skipped when:**
843
+ - User explicitly provides `-isysroot` in arguments
844
+ - `SDKROOT` environment variable is set
845
+ - Freestanding compilation flags are used (`-nostdinc`, `-nostdinc++`, `-nostdlib`, `-ffreestanding`)
846
+ - `CLANG_TOOL_CHAIN_NO_SYSROOT=1` is set
847
+
848
+ No configuration needed - just compile!
849
+
850
+ ---
851
+
852
+ ## ⚡ Performance
853
+
854
+ ### Compilation Speed
855
+
856
+ clang-tool-chain uses unmodified LLVM binaries - expect **identical performance** to official LLVM releases.
857
+
858
+ ### Download Benchmarks (First Use)
859
+
860
+ | Connection | Archive Size | Download Time |
861
+ |------------|--------------|---------------|
862
+ | Fiber (100 Mbps) | 52 MB | ~5 seconds |
863
+ | Cable (20 Mbps) | 52 MB | ~25 seconds |
864
+ | DSL (5 Mbps) | 52 MB | ~90 seconds |
865
+
866
+ Subsequent compilations are **instant** (no download).
867
+
868
+ ---
869
+
870
+ ## 🎯 Windows Target Selection
871
+
872
+ ### Default Behavior (GNU ABI - Recommended)
873
+
874
+ The default Windows target is `x86_64-w64-mingw32` (GNU ABI) for cross-platform consistency:
875
+
876
+ ```bash
877
+ # These commands use GNU ABI by default on Windows:
878
+ clang-tool-chain-c hello.c -o hello
879
+ clang-tool-chain-cpp hello.cpp -o hello
880
+
881
+ # Equivalent to explicitly specifying:
882
+ clang-tool-chain-c --target=x86_64-w64-mingw32 hello.c -o hello
883
+ ```
884
+
885
+ **Why GNU ABI is default:**
886
+ 1. **Cross-platform consistency** - Same ABI on Linux/macOS/Windows
887
+ 2. **C++11 strict mode support** - MSVC headers require C++14 features even in C++11 mode
888
+ 3. **Embedded/Arduino compatibility** - Matches GCC toolchain behavior
889
+ 4. **Modern C++ standard library** - Uses LLVM's libc++ (same as macOS/Linux)
890
+
891
+ This matches the approach of [zig cc](https://ziglang.org/learn/overview/#cross-compiling-is-a-first-class-use-case) and other modern cross-platform toolchains.
892
+
893
+ ### MSVC ABI (Windows-Specific Projects)
894
+
895
+ For Windows-native projects that need MSVC compatibility:
896
+
897
+ ```bash
898
+ # Use MSVC variants for Windows-specific development:
899
+ clang-tool-chain-c-msvc main.c -o program.exe
900
+ clang-tool-chain-cpp-msvc main.cpp -o program.exe
901
+
902
+ # Or explicitly specify MSVC target with default commands:
903
+ clang-tool-chain-c --target=x86_64-pc-windows-msvc main.c -o program.exe
904
+ ```
905
+
906
+ **Use MSVC ABI when:**
907
+ - Linking with MSVC-compiled DLLs (with C++ APIs)
908
+ - Using Windows SDK features not in MinGW
909
+ - Requiring Visual Studio debugger integration
910
+ - Building COM/WinRT/Windows Runtime components
911
+
912
+ ### Comparison Table
913
+
914
+ | Feature | GNU ABI (Default) | MSVC ABI (Opt-in) |
915
+ |---------|------------------|------------------|
916
+ | **C++ Standard Library** | libc++ (LLVM) | MSVC STL |
917
+ | **C++ ABI** | Itanium (like GCC) | Microsoft |
918
+ | **Cross-platform consistency** | ✅ Yes | ❌ Windows-only |
919
+ | **C++11 strict mode** | ✅ Works | ❌ Requires C++14+ |
920
+ | **Link with MSVC libs** | ❌ C++ ABI mismatch | ✅ Compatible |
921
+ | **Arduino/embedded** | ✅ Compatible | ❌ Different ABI |
922
+ | **Download size** | ~100 MB | ~50 MB |
923
+ | **Requires Visual Studio** | ❌ No | ⚠️ Recommended |
924
+
925
+ ### Advanced: Manual Target Selection
926
+
927
+ You can override the target for any compilation:
928
+
929
+ ```bash
930
+ # Force GNU target (default on Windows anyway):
931
+ clang-tool-chain-c --target=x86_64-w64-mingw32 main.c
932
+
933
+ # Force MSVC target:
934
+ clang-tool-chain-c --target=x86_64-pc-windows-msvc main.c
935
+
936
+ # Cross-compile for Linux from Windows:
937
+ clang-tool-chain-c --target=x86_64-unknown-linux-gnu main.c
938
+
939
+ # Cross-compile for macOS from Windows:
940
+ clang-tool-chain-c --target=arm64-apple-darwin main.c
941
+ ```
942
+
943
+ **Note:** Cross-compilation requires appropriate sysroots (not included by default).
944
+
945
+ ---
946
+
947
+ ## 🔧 How It Works
948
+
949
+ ### Architecture Overview
950
+
951
+ `clang-tool-chain` uses a sophisticated three-layer architecture:
952
+
953
+ ```
954
+ ┌─────────────────────────────────────────────────────────────┐
955
+ │ CLI Layer (cli.py) │
956
+ │ Commands: info, version, list-tools, path, package-version │
957
+ └─────────────────────────────────────────────────────────────┘
958
+
959
+ ┌─────────────────────────────────────────────────────────────┐
960
+ │ Wrapper Layer (wrapper.py) │
961
+ │ • Platform Detection (win/linux/darwin) │
962
+ │ • Architecture Normalization (x86_64/arm64) │
963
+ │ • Binary Resolution (.exe handling, tool alternatives) │
964
+ │ • Process Execution (os.execv on Unix, subprocess on Win) │
965
+ │ • macOS SDK Auto-Detection (xcrun integration) │
966
+ └─────────────────────────────────────────────────────────────┘
967
+
968
+ ┌─────────────────────────────────────────────────────────────┐
969
+ │ Downloader Layer (downloader.py) │
970
+ │ • Fetch root manifest from GitHub │
971
+ │ • Fetch platform-specific manifest │
972
+ │ • Download .tar.zst archive with progress │
973
+ │ • Verify SHA256 checksum │
974
+ │ • Extract with pyzstd decompression │
975
+ │ • File locking (prevents concurrent downloads) │
976
+ │ • Atomic installation with 'done.txt' marker │
977
+ └─────────────────────────────────────────────────────────────┘
978
+ ```
979
+
980
+ ### Manifest-Based Distribution System
981
+
982
+ The package uses a **two-tier manifest system** for version management:
983
+
984
+ 1. **Root Manifest** (`downloads-bins/assets/clang/manifest.json`) - Indexes all platforms and architectures
985
+ 2. **Platform Manifests** (`downloads-bins/assets/clang/{platform}/{arch}/manifest.json`) - Contains version info, download URLs, and SHA256 checksums
986
+
987
+ **On first use:**
988
+ ```
989
+ User runs: clang-tool-chain-c hello.c -o hello
990
+
991
+ Check: ~/.clang-tool-chain/{platform}/{arch}/done.txt exists?
992
+ ↓ (No)
993
+ Acquire lock: ~/.clang-tool-chain/{platform}-{arch}.lock
994
+
995
+ Fetch: Root manifest → Platform manifest
996
+
997
+ Download: .tar.zst archive to temp directory
998
+
999
+ Verify: SHA256 checksum
1000
+
1001
+ Extract: Using pyzstd + tarfile (with safety filters)
1002
+
1003
+ Mark complete: Write done.txt
1004
+
1005
+ Release lock → Execute tool
1006
+ ```
1007
+
1008
+ ### Platform Detection
1009
+
1010
+ Automatic platform and architecture detection:
1011
+
1012
+ | System | Platform | Architecture | Install Path |
1013
+ |--------|----------|--------------|--------------|
1014
+ | Windows 10+ | `win` | `x86_64` | `~/.clang-tool-chain/clang/win/x86_64/` |
1015
+ | Linux | `linux` | `x86_64` | `~/.clang-tool-chain/clang/linux/x86_64/` |
1016
+ | Linux | `linux` | `arm64` | `~/.clang-tool-chain/clang/linux/arm64/` |
1017
+ | macOS | `darwin` | `x86_64` | `~/.clang-tool-chain/clang/darwin/x86_64/` |
1018
+ | macOS | `darwin` | `arm64` | `~/.clang-tool-chain/clang/darwin/arm64/` |
1019
+
1020
+ ### Binary Resolution
1021
+
1022
+ The wrapper automatically handles platform differences:
1023
+ - **Windows**: Adds `.exe` extension, uses `lld-link` instead of `lld`
1024
+ - **Unix**: Uses `lld` or `ld.lld`, handles `chmod +x` permissions
1025
+ - **macOS**: Automatically detects and injects SDK path via `xcrun`
1026
+ - **Alternative Names**: Supports tool aliases (e.g., `clang` → `clang-cl` on Windows)
1027
+
1028
+ ---
1029
+
1030
+ ## 🔧 Additional Utilities
1031
+
1032
+ ### clang-tool-chain-test
1033
+
1034
+ Run diagnostic tests to verify your installation:
1035
+
1036
+ ```bash
1037
+ # Run 7 diagnostic tests
1038
+ clang-tool-chain-test
1039
+
1040
+ # Or via main CLI:
1041
+ clang-tool-chain test
1042
+ ```
1043
+
1044
+ **Tests performed:**
1045
+ 1. Platform detection
1046
+ 2. Toolchain installation verification
1047
+ 3. clang binary resolution
1048
+ 4. clang++ binary resolution
1049
+ 5. clang version check
1050
+ 6. C compilation test
1051
+ 7. C++ compilation test
1052
+
1053
+ This command is especially useful for debugging installation issues in GitHub Actions or other CI/CD environments.
1054
+
1055
+ ### clang-tool-chain-fetch
1056
+
1057
+ Manual download utility for pre-fetching binaries:
1058
+
1059
+ ```bash
1060
+ # Fetch binaries for current platform
1061
+ clang-tool-chain-fetch
1062
+
1063
+ # Check what would be downloaded
1064
+ clang-tool-chain-fetch --dry-run
1065
+ ```
1066
+
1067
+ ### clang-tool-chain-paths
1068
+
1069
+ Get installation paths in JSON format (useful for scripting):
1070
+
1071
+ ```bash
1072
+ # Get all paths
1073
+ clang-tool-chain-paths
1074
+
1075
+ # Example output:
1076
+ # {
1077
+ # "install_dir": "/home/user/.clang-tool-chain/clang/linux/x86_64",
1078
+ # "bin_dir": "/home/user/.clang-tool-chain/clang/linux/x86_64/bin",
1079
+ # "clang": "/home/user/.clang-tool-chain/clang/linux/x86_64/bin/clang"
1080
+ # }
1081
+ ```
1082
+
1083
+ ```bash
1084
+ # Use in scripts
1085
+ BIN_DIR=$(clang-tool-chain-paths | python -c "import sys,json; print(json.load(sys.stdin)['bin_dir'])")
1086
+ echo "Binaries located at: $BIN_DIR"
1087
+ ```
1088
+
1089
+ ---
1090
+
1091
+ ## 🔬 Advanced Topics
1092
+
1093
+ ### Manual Installation (Without Auto-Download)
1094
+
1095
+ If you need to manually install binaries (e.g., for offline environments):
1096
+
1097
+ 1. **Download archive:**
1098
+ ```bash
1099
+ wget https://raw.githubusercontent.com/zackees/clang-tool-chain-bins/main/assets/clang/win/x86_64/llvm-21.1.5-win-x86_64.tar.zst
1100
+ ```
1101
+
1102
+ 2. **Extract to installation directory:**
1103
+ ```bash
1104
+ # Create installation directory
1105
+ mkdir -p ~/.clang-tool-chain/clang/win/x86_64
1106
+
1107
+ # Extract archive
1108
+ python -m clang_tool_chain.downloads.expand_archive \
1109
+ llvm-21.1.5-win-x86_64.tar.zst \
1110
+ ~/.clang-tool-chain/clang/win/x86_64
1111
+
1112
+ # Mark as complete
1113
+ touch ~/.clang-tool-chain/clang/win/x86_64/done.txt
1114
+ ```
1115
+
1116
+ 3. **Verify installation:**
1117
+ ```bash
1118
+ clang-tool-chain info
1119
+ ```
1120
+
1121
+ ### Offline Mode
1122
+
1123
+ After initial download, `clang-tool-chain` works completely offline:
1124
+
1125
+ ```bash
1126
+ # First use (requires internet)
1127
+ clang-tool-chain-c hello.c -o hello # Downloads binaries
1128
+
1129
+ # Subsequent uses (offline)
1130
+ clang-tool-chain-c world.c -o world # Uses cached binaries
1131
+ ```
1132
+
1133
+ **For fully offline environments:**
1134
+ 1. Pre-download binaries on a machine with internet
1135
+ 2. Package `~/.clang-tool-chain/` directory
1136
+ 3. Extract to target machines
1137
+ 4. Ensure `done.txt` exists in platform directory
1138
+
1139
+ ### Version Pinning
1140
+
1141
+ Pin specific LLVM versions in `requirements.txt`:
1142
+
1143
+ ```txt
1144
+ # requirements.txt
1145
+ clang-tool-chain==1.0.1 # Pins package version (currently uses LLVM 21.1.5/19.1.6)
1146
+ ```
1147
+
1148
+ **Future:** The package will support multiple LLVM versions via manifest updates.
1149
+
1150
+ ### Concurrent Build Safety
1151
+
1152
+ The downloader uses **file locking** (`fasteners.InterProcessLock`) to prevent race conditions:
1153
+
1154
+ ```python
1155
+ # Multiple processes can safely call this simultaneously
1156
+ clang-tool-chain-c hello.c -o hello # Process 1
1157
+ clang-tool-chain-c world.c -o world # Process 2
1158
+ ```
1159
+
1160
+ **What happens:**
1161
+ 1. Process 1 acquires lock `~/.clang-tool-chain/win-x86_64.lock`
1162
+ 2. Process 2 waits for lock
1163
+ 3. Process 1 downloads and installs binaries
1164
+ 4. Process 1 writes `done.txt` and releases lock
1165
+ 5. Process 2 acquires lock, sees `done.txt`, skips download
1166
+ 6. Both processes compile successfully
1167
+
1168
+ **Perfect for:**
1169
+ - Parallel CI/CD builds
1170
+ - Multi-core test runners
1171
+ - Concurrent development environments
1172
+
1173
+ ---
1174
+
1175
+ ## ❓ FAQ
1176
+
1177
+ ### What happens on first use?
1178
+
1179
+ On first use, `clang-tool-chain` automatically:
1180
+ 1. Detects your platform and architecture
1181
+ 2. Fetches the manifest for your platform
1182
+ 3. Downloads the appropriate archive (~52-91 MB)
1183
+ 4. Verifies the SHA256 checksum
1184
+ 5. Extracts to `~/.clang-tool-chain/clang/{platform}/{arch}/`
1185
+ 6. Executes your command
1186
+
1187
+ **Total time:** ~10-60 seconds depending on internet speed.
1188
+
1189
+ ### Can I use clang-tool-chain offline?
1190
+
1191
+ Yes! After the initial download, `clang-tool-chain` works completely offline. The binaries are cached in `~/.clang-tool-chain/`.
1192
+
1193
+ ### How do I update to a new LLVM version?
1194
+
1195
+ Currently, the LLVM version is tied to the package version. To update:
1196
+ ```bash
1197
+ pip install --upgrade clang-tool-chain
1198
+ ```
1199
+
1200
+ Future versions will support multiple LLVM versions via manifest updates.
1201
+
1202
+ ### Is it safe to delete `~/.clang-tool-chain/`?
1203
+
1204
+ Yes! Deleting this directory just removes the cached binaries. They will re-download automatically on next use.
1205
+
1206
+ ### Can I use multiple LLVM versions simultaneously?
1207
+
1208
+ Not currently. Each `clang-tool-chain` package version maps to specific LLVM versions (see Platform Support Matrix). Use virtual environments to isolate different package versions:
1209
+
1210
+ ```bash
1211
+ # Environment 1: LLVM 21.1.5
1212
+ python -m venv env1
1213
+ source env1/bin/activate
1214
+ pip install clang-tool-chain==1.0.1
1215
+
1216
+ # Environment 2: Future LLVM version
1217
+ python -m venv env2
1218
+ source env2/bin/activate
1219
+ pip install clang-tool-chain==1.1.0 # (hypothetical future version)
1220
+ ```
1221
+
1222
+ ### How does checksum verification work?
1223
+
1224
+ Every archive download is verified against SHA256 checksums stored in the platform manifests. If the checksum doesn't match, the download is rejected and an error is raised. This protects against:
1225
+ - Corrupted downloads
1226
+ - Man-in-the-middle attacks
1227
+ - File tampering
1228
+
1229
+ ### Why does macOS use LLVM 19.1.6 instead of 21.1.5?
1230
+
1231
+ LLVM 21.1.5 pre-built binaries for macOS were not available at the time of initial release. We're working on building and distributing LLVM 21.1.5 for macOS. Track progress in the repository issues.
1232
+
1233
+ ### Can I contribute new platforms or architectures?
1234
+
1235
+ Yes! See the [Maintainer Tools](#-maintainer-tools) section for how to create optimized archives. Pull requests welcome!
1236
+
1237
+ ### Does this work in Docker containers?
1238
+
1239
+ Absolutely! See the [CI/CD Integration](#-cicd-integration) section for Docker examples. The automatic download works seamlessly in containers.
1240
+
1241
+ ### How much disk space do I need?
1242
+
1243
+ - **Download:** ~52-91 MB (archive)
1244
+ - **Installed:** ~200-350 MB (extracted binaries)
1245
+ - **Total:** ~252-441 MB per platform
1246
+
1247
+ The archive is deleted after extraction, so you only need space for the installed binaries.
1248
+
1249
+ ### Can I use this with CMake?
1250
+
1251
+ Yes! Set the compiler in your `CMakeLists.txt` or via environment variables:
1252
+
1253
+ ```bash
1254
+ # Option 1: Environment variables
1255
+ export CC=clang-tool-chain-c
1256
+ export CXX=clang-tool-chain-cpp
1257
+ cmake -B build
1258
+
1259
+ # Option 2: CMake command line
1260
+ cmake -B build \
1261
+ -DCMAKE_C_COMPILER=clang-tool-chain-c \
1262
+ -DCMAKE_CXX_COMPILER=clang-tool-chain-cpp
1263
+ ```
1264
+
1265
+ ### What about Windows paths with spaces?
1266
+
1267
+ All paths are handled correctly, including those with spaces. The wrappers quote paths appropriately.
1268
+
1269
+ ### Do I need to install Xcode on macOS?
1270
+
1271
+ No! You only need the **Xcode Command Line Tools**, which is much smaller:
1272
+
1273
+ ```bash
1274
+ xcode-select --install
1275
+ ```
1276
+
1277
+ This provides the SDK headers needed for compilation without installing the full Xcode IDE.
1278
+
1279
+ ---
1280
+
1281
+ ## 🔍 Troubleshooting
1282
+
1283
+ ### Binaries Not Found
1284
+
1285
+ **Error:** `Clang binaries are not installed`
1286
+
1287
+ **Solution:**
1288
+ ```bash
1289
+ # Check installation status
1290
+ clang-tool-chain info
1291
+
1292
+ # Try manual fetch
1293
+ clang-tool-chain-fetch
1294
+
1295
+ # Verify installation directory exists
1296
+ ls ~/.clang-tool-chain/
1297
+ ```
1298
+
1299
+ ### Platform Not Supported
1300
+
1301
+ **Error:** `Unsupported platform`
1302
+
1303
+ **Solution:** Ensure you're on a supported platform:
1304
+ - Windows 10+ (x64)
1305
+ - Linux x64 or ARM64 (glibc 2.27+)
1306
+ - macOS 11+ (x64 or ARM64)
1307
+
1308
+ 32-bit systems are **not supported**.
1309
+
1310
+ ### Download Fails
1311
+
1312
+ **Error:** `Failed to download archive` or `Checksum verification failed`
1313
+
1314
+ **Solutions:**
1315
+ 1. **Check internet connection**
1316
+ 2. **Retry the command** (temporary network issue)
1317
+ 3. **Check GitHub raw content access:**
1318
+ ```bash
1319
+ curl -I https://raw.githubusercontent.com/zackees/clang-tool-chain-bins/main/assets/clang/manifest.json
1320
+ ```
1321
+ 4. **Clear partial downloads:**
1322
+ ```bash
1323
+ rm -rf ~/.clang-tool-chain/
1324
+ ```
1325
+
1326
+ ### Tool Execution Fails
1327
+
1328
+ **Error:** `Permission denied` (Linux/macOS)
1329
+
1330
+ **Solution:**
1331
+ ```bash
1332
+ # Ensure execute permissions
1333
+ chmod +x ~/.clang-tool-chain/clang/*/bin/*
1334
+
1335
+ # Or reinstall
1336
+ rm -rf ~/.clang-tool-chain/
1337
+ clang-tool-chain-c --version # Re-downloads with correct permissions
1338
+ ```
1339
+
1340
+ ### macOS: stdio.h or iostream Not Found
1341
+
1342
+ **Error:** `fatal error: 'stdio.h' file not found` or `'iostream' file not found`
1343
+
1344
+ **Cause:** Xcode Command Line Tools not installed or SDK not detected.
1345
+
1346
+ **Solution:**
1347
+ ```bash
1348
+ # Install Xcode Command Line Tools
1349
+ xcode-select --install
1350
+
1351
+ # Verify SDK is detected
1352
+ xcrun --show-sdk-path
1353
+
1354
+ # Should output something like:
1355
+ # /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
1356
+
1357
+ # Try compilation again
1358
+ clang-tool-chain-c hello.c -o hello
1359
+ ```
1360
+
1361
+ **Advanced troubleshooting:**
1362
+ ```bash
1363
+ # Manually specify SDK path
1364
+ clang-tool-chain-c -isysroot $(xcrun --show-sdk-path) hello.c -o hello
1365
+
1366
+ # Or set SDKROOT environment variable
1367
+ export SDKROOT=$(xcrun --show-sdk-path)
1368
+ clang-tool-chain-c hello.c -o hello
1369
+ ```
1370
+
1371
+ ### Slow First-Time Download
1372
+
1373
+ **Observation:** First compilation takes 30-60 seconds
1374
+
1375
+ **This is normal!** The toolchain is downloading. Subsequent compilations are instant. To pre-download:
1376
+
1377
+ ```bash
1378
+ # Pre-fetch binaries before your build
1379
+ clang-tool-chain-fetch
1380
+
1381
+ # Or just run any command
1382
+ clang-tool-chain-c --version
1383
+ ```
1384
+
1385
+ ### Import Errors
1386
+
1387
+ **Error:** `ModuleNotFoundError: No module named 'clang_tool_chain'`
1388
+
1389
+ **Solutions:**
1390
+ 1. **Ensure package is installed:**
1391
+ ```bash
1392
+ pip install clang-tool-chain
1393
+ ```
1394
+
1395
+ 2. **Check Python environment:**
1396
+ ```bash
1397
+ which python # Verify correct Python interpreter
1398
+ pip list | grep clang-tool-chain
1399
+ ```
1400
+
1401
+ 3. **Reinstall:**
1402
+ ```bash
1403
+ pip uninstall clang-tool-chain
1404
+ pip install clang-tool-chain
1405
+ ```
1406
+
1407
+ ### Custom Installation Path Not Working
1408
+
1409
+ **Error:** Binaries install to default location despite `CLANG_TOOL_CHAIN_DOWNLOAD_PATH`
1410
+
1411
+ **Solution:** Ensure the environment variable is set **before** running the command:
1412
+
1413
+ ```bash
1414
+ # Linux/macOS
1415
+ export CLANG_TOOL_CHAIN_DOWNLOAD_PATH=/custom/path
1416
+ clang-tool-chain-c hello.c
1417
+
1418
+ # Windows (CMD)
1419
+ set CLANG_TOOL_CHAIN_DOWNLOAD_PATH=C:\custom\path
1420
+ clang-tool-chain-c hello.c
1421
+
1422
+ # Windows (PowerShell)
1423
+ $env:CLANG_TOOL_CHAIN_DOWNLOAD_PATH="C:\custom\path"
1424
+ clang-tool-chain-c hello.c
1425
+ ```
1426
+
1427
+ ---
1428
+
1429
+ ## 🔒 Security
1430
+
1431
+ Security is a top priority for this project.
1432
+
1433
+ ### Checksum Verification
1434
+
1435
+ - **Automatic:** SHA256 checksums are verified during download (enabled by default)
1436
+ - **Manifest-Based:** Checksums stored in version-controlled manifests
1437
+ - **Protection:** Detects corrupted downloads, MITM attacks, and file tampering
1438
+ - **Transparency:** All checksums visible in `downloads-bins/assets/clang/{platform}/{arch}/manifest.json`
1439
+
1440
+ ### Safe Extraction
1441
+
1442
+ - **Python 3.12+ Tarfile Safety:** Uses `filter="data"` to prevent path traversal attacks
1443
+ - **Temporary Directory:** Extraction happens in temp directory, then moved atomically
1444
+ - **Validation:** Verifies archive integrity before extraction
1445
+
1446
+ ### Download Security
1447
+
1448
+ Binaries are served from GitHub raw content (`raw.githubusercontent.com`):
1449
+ - ✅ **Checksum Verified:** SHA256 validation on every download
1450
+ - ✅ **Version Locked:** Manifests are version-controlled in the repository
1451
+ - ⚠️ **Trust Model:** You're trusting this package maintainer + GitHub infrastructure
1452
+ - 🔒 **HTTPS Only:** All downloads use encrypted connections
1453
+
1454
+ **For maximum security:**
1455
+ ```bash
1456
+ # Option 1: Manual verification
1457
+ clang-tool-chain-fetch --dry-run # Shows download URLs
1458
+ # Verify checksums in downloads-bins/assets/clang/<platform>/<arch>/manifest.json
1459
+
1460
+ # Option 2: Offline installation
1461
+ # Download archive, verify checksum independently, then extract manually
1462
+ ```
1463
+
1464
+ ### Reporting Security Issues
1465
+
1466
+ For security vulnerabilities, please see our [Security Policy](SECURITY.md) for responsible disclosure instructions.
1467
+
1468
+ **Do NOT** report security issues in public GitHub issues.
1469
+
1470
+ ---
1471
+
1472
+ ## 👨‍💻 Development
1473
+
1474
+ ### Development Setup
1475
+
1476
+ ```bash
1477
+ # Clone repository
1478
+ git clone https://github.com/zackees/clang-tool-chain.git
1479
+ cd clang-tool-chain
1480
+
1481
+ # Install dependencies (using uv - recommended)
1482
+ ./install
1483
+
1484
+ # Or manually:
1485
+ uv venv --python 3.11
1486
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
1487
+ uv pip install -e ".[dev]"
1488
+ pre-commit install
1489
+ ```
1490
+
1491
+ ### Running Tests
1492
+
1493
+ ```bash
1494
+ # Run all tests with coverage (parallel execution)
1495
+ ./test
1496
+
1497
+ # Or manually with pytest:
1498
+ uv run pytest # Run with coverage reporting
1499
+ uv run pytest -n auto # Run in parallel
1500
+ uv run pytest tests/test_cli.py # Run specific test file
1501
+ uv run pytest -m "not slow" # Skip slow tests
1502
+
1503
+ # Run single test
1504
+ uv run pytest tests/test_cli.py::MainTester::test_imports -v
1505
+ ```
1506
+
1507
+ ### Code Quality
1508
+
1509
+ ```bash
1510
+ # Run all linters and formatters
1511
+ ./lint
1512
+
1513
+ # Individual tools:
1514
+ uv run ruff check --fix src tests # Lint with auto-fix
1515
+ uv run black src tests # Format code
1516
+ uv run isort --profile black src tests # Sort imports
1517
+ uv run pyright src tests # Type checking
1518
+ uv run mypy src tests # Alternative type checking
1519
+ ```
1520
+
1521
+ ### Pre-commit Hooks
1522
+
1523
+ ```bash
1524
+ # Install pre-commit hooks
1525
+ pre-commit install
1526
+
1527
+ # Run all pre-commit checks manually
1528
+ pre-commit run --all-files
1529
+
1530
+ # Update hook versions
1531
+ pre-commit autoupdate
1532
+ ```
1533
+
1534
+ ### Building and Publishing
1535
+
1536
+ ```bash
1537
+ # Build the package
1538
+ uv run python -m build
1539
+
1540
+ # Check the built package
1541
+ twine check dist/*
1542
+
1543
+ # Upload to PyPI (maintainers only)
1544
+ ./upload_package.sh
1545
+ ```
1546
+
1547
+ ---
1548
+
1549
+ ## 🛠️ Maintainer Tools
1550
+
1551
+ <details>
1552
+ <summary><b>Click to expand maintainer documentation</b> (for package maintainers only)</summary>
1553
+
1554
+ ### Archive Creation Pipeline
1555
+
1556
+ The `clang-tool-chain-fetch-archive` command automates the complete packaging process:
1557
+
1558
+ ```bash
1559
+ # Create optimized archive for Windows x86_64
1560
+ clang-tool-chain-fetch-archive --platform win --arch x86_64
1561
+
1562
+ # Create archive for Linux x86_64
1563
+ clang-tool-chain-fetch-archive --platform linux --arch x86_64
1564
+
1565
+ # Create archive for macOS ARM64 (Apple Silicon)
1566
+ clang-tool-chain-fetch-archive --platform darwin --arch arm64
1567
+
1568
+ # Use existing extracted binaries (skip download)
1569
+ clang-tool-chain-fetch-archive \
1570
+ --platform win --arch x86_64 \
1571
+ --source-dir ./assets/win
1572
+ ```
1573
+
1574
+ **What it does:**
1575
+
1576
+ 1. ✅ Downloads LLVM 21.1.5 from official GitHub releases (~400-900 MB)
1577
+ 2. ✅ Extracts the archive
1578
+ 3. ✅ Strips unnecessary files (docs, examples, static libs)
1579
+ 4. ✅ Deduplicates identical binaries (~571 MB savings via MD5 hash detection)
1580
+ 5. ✅ Creates hard-linked structure (reduces size without data loss)
1581
+ 6. ✅ Compresses with **zstd level 22** (94.3% reduction!)
1582
+ 7. ✅ Generates checksums (SHA256, MD5)
1583
+ 8. ✅ Names archive: `llvm-{version}-{platform}-{arch}.tar.zst`
1584
+ 9. ✅ Places in `downloads-bins/assets/clang/{platform}/{arch}/`
1585
+ 10. ✅ Updates platform manifest with URLs and checksums
1586
+
1587
+ **Result:** 51.53 MB archive (from 902 MB original) for Windows x86_64!
1588
+
1589
+ ### Individual Maintainer Scripts
1590
+
1591
+ Available as Python modules in `clang_tool_chain.downloads`:
1592
+
1593
+ #### download_binaries.py
1594
+ Download LLVM releases from GitHub:
1595
+
1596
+ ```bash
1597
+ python -m clang_tool_chain.downloads.download_binaries \
1598
+ --platform win --arch x86_64 --version 21.1.5
1599
+
1600
+ # Download for current platform only
1601
+ python -m clang_tool_chain.downloads.download_binaries --current-only
1602
+
1603
+ # Skip checksum verification (not recommended)
1604
+ python -m clang_tool_chain.downloads.download_binaries --current-only --no-verify
1605
+ ```
1606
+
1607
+ #### strip_binaries.py
1608
+ Optimize binary size by removing unnecessary files:
1609
+
1610
+ ```bash
1611
+ python -m clang_tool_chain.downloads.strip_binaries \
1612
+ work/clang+llvm-21.1.5-x86_64-pc-windows-msvc \
1613
+ downloads-bins/assets/clang/win/x86_64 \
1614
+ --platform win
1615
+ ```
1616
+
1617
+ **Removes:**
1618
+ - Documentation (`share/doc`, `share/man`)
1619
+ - Headers and examples
1620
+ - Static libraries (`*.a`, `*.lib`)
1621
+ - CMake files
1622
+ - Debug symbols (using `llvm-strip`)
1623
+
1624
+ **Keeps:**
1625
+ - 14 essential binaries
1626
+ - Runtime libraries (`*.so`, `*.dll`, `*.dylib`)
1627
+ - License files
1628
+
1629
+ **Size reduction:** ~3.5 GB → ~200-400 MB per platform
1630
+
1631
+ #### deduplicate_binaries.py
1632
+ Find duplicate binaries by MD5 hash:
1633
+
1634
+ ```bash
1635
+ python -m clang_tool_chain.downloads.deduplicate_binaries \
1636
+ work/clang+llvm-21.1.5-x86_64-pc-windows-msvc/bin
1637
+ ```
1638
+
1639
+ **Output:**
1640
+ ```
1641
+ Duplicate groups found: 45
1642
+ Total duplicates: 158 files
1643
+ Potential space savings: 571.23 MB
1644
+
1645
+ Duplicate group #1 (MD5: a1b2c3d4...):
1646
+ - clang.exe (12.5 MB)
1647
+ - clang++.exe (12.5 MB)
1648
+ - clang-cl.exe (12.5 MB)
1649
+ ```
1650
+
1651
+ #### create_hardlink_archive.py
1652
+ Create hard-linked TAR archives (preserves hard links during extraction):
1653
+
1654
+ ```bash
1655
+ python -m clang_tool_chain.downloads.create_hardlink_archive \
1656
+ input/win \
1657
+ output/llvm-21.1.5-win-x86_64.tar.zst \
1658
+ --compression-level 22
1659
+ ```
1660
+
1661
+ **Benefits:**
1662
+ - Preserves hard links (deduplication survives extraction)
1663
+ - Ultra-high compression (zstd level 22)
1664
+ - Maintains file permissions and metadata
1665
+
1666
+ #### expand_archive.py
1667
+ Extract `.tar.zst` archives:
1668
+
1669
+ ```bash
1670
+ python -m clang_tool_chain.downloads.expand_archive \
1671
+ llvm-21.1.5-win-x86_64.tar.zst \
1672
+ output/win
1673
+ ```
1674
+
1675
+ **Features:**
1676
+ - Handles zstd compression
1677
+ - Preserves hard links
1678
+ - Shows extraction progress
1679
+ - Validates archive integrity
1680
+
1681
+ #### test_compression.py
1682
+ Compare compression methods and levels:
1683
+
1684
+ ```bash
1685
+ python -m clang_tool_chain.downloads.test_compression \
1686
+ input/win \
1687
+ --methods zstd gzip xz \
1688
+ --levels 1 9 22
1689
+ ```
1690
+
1691
+ **Output:**
1692
+ ```
1693
+ Testing compression methods...
1694
+
1695
+ zstd level 1: Size: 156 MB, Time: 2.3s
1696
+ zstd level 9: Size: 78 MB, Time: 8.7s
1697
+ zstd level 22: Size: 51 MB, Time: 45.2s ⭐ BEST RATIO
1698
+
1699
+ gzip level 9: Size: 124 MB, Time: 15.6s
1700
+ xz level 9: Size: 89 MB, Time: 67.3s
1701
+ ```
1702
+
1703
+ ### Compression Statistics
1704
+
1705
+ **Windows x86_64 (LLVM 21.1.5):**
1706
+ - Original: 902 MB
1707
+ - After stripping: 200 MB
1708
+ - After deduplication (hard links): 200 MB (same size, but ~571 MB savings on disk)
1709
+ - After zstd level 22: **51.53 MB** (94.3% reduction from original!)
1710
+
1711
+ **Linux x86_64 (LLVM 21.1.5):**
1712
+ - Original: ~850 MB
1713
+ - After optimization: **88 MB archive**
1714
+
1715
+ **macOS ARM64 (LLVM 19.1.6):**
1716
+ - Original: ~750 MB
1717
+ - After optimization: **71 MB archive**
1718
+
1719
+ ### Updating Manifests
1720
+
1721
+ After creating archives, update the manifest files:
1722
+
1723
+ 1. **Generate SHA256 checksum:**
1724
+ ```bash
1725
+ sha256sum downloads-bins/assets/clang/win/x86_64/llvm-21.1.5-win-x86_64.tar.zst
1726
+ ```
1727
+
1728
+ 2. **Update platform manifest** (`downloads-bins/assets/clang/win/x86_64/manifest.json`):
1729
+ ```json
1730
+ {
1731
+ "latest": "21.1.5",
1732
+ "21.1.5": {
1733
+ "href": "https://raw.githubusercontent.com/zackees/clang-tool-chain-bins/main/assets/clang/win/x86_64/llvm-21.1.5-win-x86_64.tar.zst",
1734
+ "sha256": "3c21e45edeee591fe8ead5427d25b62ddb26c409575b41db03d6777c77bba44f"
1735
+ }
1736
+ }
1737
+ ```
1738
+
1739
+ 3. **Commit and push to downloads-bins submodule:**
1740
+ ```bash
1741
+ cd downloads-bins
1742
+ git add assets/clang/
1743
+ git commit -m "chore: add LLVM 21.1.5 for Windows x86_64"
1744
+ git push
1745
+ cd ..
1746
+ git add downloads-bins
1747
+ git commit -m "chore: update submodule to latest binaries"
1748
+ git push
1749
+ ```
1750
+
1751
+ </details>
1752
+
1753
+ ---
1754
+
1755
+ ## 📄 License
1756
+
1757
+ This package is distributed under the **Apache License 2.0**. See [LICENSE](LICENSE) for details.
1758
+
1759
+ The bundled LLVM/Clang binaries are licensed under the **Apache License 2.0 with LLVM Exception**. See [LLVM License](https://llvm.org/LICENSE.txt) for details.
1760
+
1761
+ ---
1762
+
1763
+ ## 🙏 Acknowledgments
1764
+
1765
+ - **[LLVM Project](https://llvm.org/)** - For the excellent Clang/LLVM toolchain
1766
+ - **[GitHub LLVM Releases](https://github.com/llvm/llvm-project/releases)** - For providing pre-built binaries
1767
+ - **[Zstandard (zstd)](https://facebook.github.io/zstd/)** - For incredible compression performance
1768
+ - **[pyzstd](https://github.com/animalize/pyzstd)** - For Python zstd bindings
1769
+ - **[fasteners](https://github.com/harlowja/fasteners)** - For cross-platform file locking
1770
+
1771
+ ---
1772
+
1773
+ ## 📊 Version History
1774
+
1775
+ ### 1.0.1 (2025-11-09)
1776
+ - ✅ Automatic macOS SDK detection via xcrun
1777
+ - ✅ Improved error messages and troubleshooting
1778
+ - ✅ Enhanced documentation with platform-specific guidance
1779
+
1780
+ ### 1.0.0 (2025-11-07) - Initial Release
1781
+ - ✅ Core wrapper infrastructure for 22 wrapper commands
1782
+ - ✅ Automatic download and installation system
1783
+ - ✅ Manifest-based distribution with SHA256 verification
1784
+ - ✅ Binary optimization pipeline (stripping, deduplication, compression)
1785
+ - ✅ CLI management commands (`info`, `version`, `list-tools`, `path`)
1786
+ - ✅ Cross-platform support (Windows x64, macOS x64/ARM64, Linux x64/ARM64)
1787
+ - ✅ File locking for concurrent-safe downloads
1788
+ - ✅ Ultra-compressed archives (zstd level 22, 94.3% size reduction)
1789
+ - ✅ LLVM 21.1.5 for Windows/Linux, 19.1.6 for macOS
1790
+ - ✅ Comprehensive test suite with CI/CD integration
1791
+
1792
+ ---
1793
+
1794
+ ## 🚀 Getting Started
1795
+
1796
+ Ready to compile? Install and run:
1797
+
1798
+ ```bash
1799
+ pip install clang-tool-chain
1800
+ echo 'int main() { return 0; }' > hello.c
1801
+ clang-tool-chain-c hello.c -o hello
1802
+ ./hello
1803
+ ```
1804
+
1805
+ That's all you need! The toolchain downloads automatically. Happy compiling! 🎉
1806
+
1807
+ ---
1808
+
1809
+ **Repository:** [github.com/zackees/clang-tool-chain](https://github.com/zackees/clang-tool-chain)
1810
+ **Issues:** [github.com/zackees/clang-tool-chain/issues](https://github.com/zackees/clang-tool-chain/issues)
1811
+ **PyPI:** [pypi.org/project/clang-tool-chain/](https://pypi.org/project/clang-tool-chain/)
1812
+
1813
+ ---
1814
+
1815
+ **Keywords:** clang wrapper, llvm python, portable clang, clang installer, llvm toolchain, cross-platform compiler, python clang, automated llvm, clang docker, ci/cd compiler