在 pkg-config 搜索路径中未找到软件包 alsa。也许您应该添加包含“alsa.pc”的目录

在 pkg-config 搜索路径中未找到软件包 alsa。也许您应该添加包含“alsa.pc”的目录

我在使用 bevy 框架时遇到了问题。

抱歉,我是这个网站的新手,我不知道如何使我的问题更“可读”。当我尝试运行时,完整的退出代码:cargo run --example hello_world

  • 我尝试定位alsa.pc-> 但什么也没有返回。
  • 有些代码在同一行,因为我不知道如何在这里换行“\n”:c
#########################################################################################

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

Caused by:
  process didn't exit successfully: `/root/plib/Download/bevy/target/debug/build/alsa-sys-15ce9f331cc5c6c6/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=ALSA_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=ALSA_STATIC
  cargo:rerun-if-env-changed=ALSA_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

  --- stderr
  thread 'main' panicked at '`"pkg-config" "--libs" "--cflags" "alsa"` did not exit successfully: exit status: 1
  error: could not find system library 'alsa' required by the 'alsa-sys' crate

  --- stderr
  Package alsa was not found in the pkg-config search path.
  Perhaps you should add the directory containing `alsa.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'alsa' found
  ', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/alsa-sys-0.3.1/build.rs:13:18
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
#########################################################################################

答案1

得到需要阿尔萨斯你必须找到的文件对应包 然后安装它

sudo apt-get update
sudo apt-get install libasound2-dev

并且

sudo apt-get install libudev-dev

然后重试。

跟随https://bevyengine.org/learn/book/getting-started/如果不确定该做什么。

相关内容