cxvm: per-project GCC and Clang versions on Linux
说明与用途
cxvm 允许在 Linux 上为每个项目固定 GCC/Clang 版本,避免全局更改和需要 root 权限。
问题
Embedded Linux developers need per-project GCC/Clang versions that differ from the system compiler, but existing solutions require root or affect all projects.
结果
cxvm allows developers to pin exact GCC/Clang versions per project, avoiding global changes, root access, and ensuring correct libstdc++ linkage via rpath.
工作流
- Install cxvm via curl or cargo
- Use
cxvm install gcc@13to download GCC 13.4.0 - Navigate to project directory and run
cxvm use gcc@13to pin the compiler and generate .cxvm/ and .cxvmrc - Run CMake with the generated toolchain file or use
cxvm exec -- makefor non-CMake projects - Use
cxvm currentto verify active compiler
证据
cxvm keeps any number of GCC and Clang versions side by side under ~/.local/share/cxvm, and each project says which one it uses in a small file you commit
The CMake toolchain file adds an rpath to the pinned GCC's lib64, so the program finds the right libstdc++.so.6 on its own
cxvm is written in Rust and ships as one static musl binary
- 记录日期: 2026-10-12T14:55:55.558Z