bandwhich 带宽监控工具多平台编译安装指南:如何搞定 Rust 1.88+ 版本兼容
【免费下载链接】bandwhichTerminal bandwidth utilization tool项目地址: https://gitcode.com/gh_mirrors/ba/bandwhich
你 clone 完仓库、cargo build一把,报错requires rustc 1.88.0 or newer;或者linking with cc failed直接砸脸。终端带宽监控工具 bandwhich 的 Rust 版本兼容问题,装不上多半出在这两堵墙上。
30 秒预检:先判断该走哪条路
先敲rustc --version看一眼:低于 1.88.0(Cargo.toml 里rust-version定的门槛)就先rustup update一把,再往下走。✅ 版本达标后,按这张表选路:
| 安装路径 | 适用人群 | 耗时 | 注意事项 |
|---|---|---|---|
| 包管理器 | 日常使用、不折腾 | 约 1 分钟 | 预编译好,不碰 Rust 环境 |
| 源码编译 | 要最新功能 / 发行版没包 | 5~10 分钟 | 必须 rustc ≥ 1.88.0,且装好系统依赖 |
| rustup 管理 toolchain | 机器上多个 Rust 版本并存 | 2 分钟 | override 只影响当前目录 |
三条安装路径的最短命令序列
每条路径只给能跑通的最少命令,照抄就行。
路径一:包管理器直接装
sudo pacman -S bandwhich # Arch sudo dnf copr enable atim/bandwhich -y && sudo dnf install bandwhich # Fedora brew install bandwhich # macOS / Linux (Homebrew) sudo port install bandwhich # macOS (MacPorts) choco install bandwhich # Windows一条命令搞定,依赖全替你装好,是最省心的路。
路径二:源码编译
各平台差别只在 libpcap 的名字(Windows 则依赖另一套):
| 系统 | 依赖命令 |
|---|---|
| Ubuntu/Debian | sudo apt install -y libpcap-dev |
| Fedora | sudo dnf install -y libpcap-devel |
| macOS | brew install libpcap |
| Windows | choco install winpcap,另需 VS Build Tools |
然后统一的四步走:
git clone https://gitcode.com/gh_mirrors/ba/bandwhich cd bandwhich cargo build --release sudo cp target/release/bandwhich /usr/local/bin/clone 拿代码,build 出 release 二进制,cp 放进 PATH,完事。
路径三:rustup 切换 Rust 版本
机器上项目多、版本互相打架时,按目录钉住 toolchain:
rustup install 1.88.0 # 只装不切换 rustup override set 1.88.0 # 当前目录钉死用这版报错速查表:症状 / 原因 / 动作
⚠️ 报错先对号入座,九成命中下面四种:
| 症状 | 原因 | 动作 |
|---|---|---|
requires rustc 1.88.0 or newer | rustc 版本过低 | rustup update或rustup install 1.88.0 |
linking with cc failed | 缺 libpcap 开发包 | 按上表装 libpcap / libpcap-devel |
| Windows 下编译失败 | WinPcap 或 VS Build Tools 没装齐 | 装齐两者后重跑cargo build |
failed to select a version for ... | 依赖版本冲突 | cargo update刷新 Cargo.lock |
表里没覆盖的情况,翻 INSTALL.md 逐发行版比对一遍。
版本对齐、依赖装齐,bandwhich 的安装就是几分钟的事。想改代码,看 src/network/ 的抓包解析和 src/display/ 的界面渲染,动手前读 CONTRIBUTING.md。
【免费下载链接】bandwhichTerminal bandwidth utilization tool项目地址: https://gitcode.com/gh_mirrors/ba/bandwhich
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考