gpt4 book ai didi

linux - 在将 'alsa-sys' crate 构建为依赖项时,如何安装和连接 alsa.pc?

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:13:26 45 4
gpt4 key购买 nike

我正在尝试使用 travis-ci 构建一个 rust 二进制文件。我设法让 windows 和 osx 构建工作,但 linux 构建一直失败。

似乎“alsa-sys” crate (依赖项之一)无法在 linux-vm 中找到 alsa.pc。

.travis.yml:

language: rust
cache: cargo
rust:
- stable

matrix:
allow_failures:
- rust: nightly
fast_finish: true
os:
- osx
- windows
- linux

script:
- cargo build --verbose --release

before_deploy:
- if [[ -f target/release/soundsense-rs ]]; then mv target/release/soundsense-rs "target/release/soundsense-rs-$TRAVIS_TAG-$TRAVIS_OS_NAME"; fi
- if [[ -f target/release/soundsense-rs.exe ]]; then mv target/release/soundsense-rs.exe "target/release/soundsense-rs-$TRAVIS_TAG-$TRAVIS_OS_NAME.exe"; fi

deploy:
- provider: releases
skip_cleanup: true
on:
tags: true
condition: "$TRAVIS_RUST_VERSION = stable"
branch: release
file_glob: true
file:
- target/release/soundsense-rs-*
api_key:
secure: IRdsT0enLWr2qaa63GPnITLaYdar4vDKcKfo9Fm1PlDoWi1gigTZ2elegApdBQmWzcgdHEtiEayg9KtQw76R/l7bH2Yst3kvZPyd635g6Cwj9XUp70opApLeKdVGQhnvGA2fMehYXNfcLi8wn65th3katabvJhuU26C1ICAFt1ExVu2iDbIjUYPmg5O4f3BAvHYlGe5BNyA3C20sakD25ocp+Z/KaI1gfRdYvm3cwVuci63N2O0c+j2IHkaUg/bfA7XHRUqzxO1U4MNrRyYAwRRiIJ+wgKVh9qISt4N0Uw8IZR8ZmBkeK4OPkh+ggb05ONoOpCuOVDGKqMzbEG0SNKbDpwXdxfCkmbtNeXrORX6ZSlNPJOGaPhrD36WYZdRGOZMNC4lSgev/O2lZ/TfJc1Qj9kXlD7kbmG/vKrSkQYs4i/5p4a93E0zgBfyWiK1wiUYCc01PF5YKjbc0n7aymSO3z3CzGijwykH6MKFnInk1JtJ2aUjBM722oKVuCaW/JDikN4wMgPrlIMUY+dLrXBJZLXra89B/RS6un1NsTO0IPyMDQYKRgp6yTkvWJHux0m0Gwexnc+S/dPhb9Z023UDA0pb504XNc7ggpo9xtb5sUa/z/xQRoX3fKFSUEOoNLI3Kw/DE4QwHmnvVSdOGF4+s3Kj2JqnKSZusq3yycnw=

错误信息:

     Running `/home/travis/build/prixt/soundsense-rs/target/release/build/alsa-sys-9e3efef5874a428f/build-script-build`

error: failed to run custom build command for `alsa-sys v0.1.2`

Caused by:

process didn't exit successfully: `/home/travis/build/prixt/soundsense-rs/target/release/build/alsa-sys-9e3efef5874a428f/build-script-build` (exit code: 101)

--- stderr

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "`\"pkg-config\" \"--libs\" \"--cflags\" \"alsa\"` did not exit successfully: exit code: 1\n--- stderr\nPackage alsa was not found in the pkg-config search path.\nPerhaps you should add the directory containing `alsa.pc\'\nto the PKG_CONFIG_PATH environment variable\nNo package \'alsa\' found\n"', src/libcore/result.rs:999:5

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

warning: build failed, waiting for other jobs to finish...

error: build failed

The command "cargo build --verbose --release" exited with 101.

我需要添加什么命令来解决这个问题?

最佳答案

按照@Jmb 的建议,我在 before_install 步骤中添加了一些包安装命令:

before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y libasound2-dev ; sudo apt-get install -y libwebkit2gtk-4.0 ; fi

(我还需要为另一个依赖项安装 libwebkit2gtk 包)这解决了问题。

关于linux - 在将 'alsa-sys' crate 构建为依赖项时,如何安装和连接 alsa.pc?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57727066/

45 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com