You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

构建Bevy时alsa-sys与libudev-sys编译失败的解决咨询

问题

入门Bevy开发时,已按官方文档配置nightly工具链,但构建项目时出现以下错误:

error: failed to run custom build command for `alsa-sys v0.3.1`
error: failed to run custom build command for `libudev-sys v0.1.4`

当前Cargo.toml配置:

[package]
name = "Bevy_1"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[profile.dev]
opt-level = 1

[profile.dev.package.*]
opt-level = 3

[dependencies]
bevy = {version = "0.10", features = ["dynamic_linking"]}

rust-toolchain.toml配置:

[toolchain]
channel = "nightly"

解决方案

这两个错误是缺少系统级开发依赖库导致的,针对不同Linux发行版执行对应命令安装即可:

  • Debian/Ubuntu 系列
    sudo apt-get install libasound2-dev libudev-dev
    
  • Fedora/RHEL 系列
    sudo dnf install alsa-lib-devel systemd-devel
    
  • Arch Linux
    sudo pacman -S alsa-lib systemd
    

安装完成后,重新运行cargo build即可完成构建。

内容的提问来源于stack exchange,提问作者Pioneer_11

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.25 15:32:09