我试着在Ubutnu机器上用glium
在Rust中编译这个代码。
#[macro_use]
extern crate glium;
fn main() {
println!("Hello, world!");
}
这将导致以下错误:
--- stderr
thread 'main' panicked at '`"pkg-config" "--libs" "--cflags" "fontconfig" "fontconfig >= 2.11.1"` did not exit successfully: exit status: 1
error: could not find system library 'fontconfig' required by the 'servo-fontconfig-sys' crate
--- stderr
Package fontconfig was not found in the pkg-config search path.
Perhaps you should add the directory containing `fontconfig.pc'
to the PKG_CONFIG_PATH environment variable
No package 'fontconfig' found
Package fontconfig was not found in the pkg-config search path.
Perhaps you should add the directory containing `fontconfig.pc'
to the PKG_CONFIG_PATH environment variable
No package 'fontconfig' found
', /home/matej/.cargo/registry/src/github.com-1ecc6299db9ec823/servo-fontconfig-sys-5.1.0/build.rs:34:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error[E0554]: `#![feature]` may not be used on the stable release channel
--> /home/matej/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-1.0.38/src/lib.rs:238:34
|
238 | #![cfg_attr(provide_any, feature(provide_any))]
| ^^^^^^^^^^^
第一个错误说找不到fontconfig
库。我该怎么办?我该怎么安装那个库?我也不知道该怎么处理第二个错误。
操作系统:Ubuntu 22.04
我已经将glium = "*"
添加到货物依赖项中。
- 增编**
第一个错误在运行cargo clean
后得到解决-但第二个错误仍然存在。有什么想法吗?
1条答案
按热度按时间5gfr0r5j1#
在终端中使用以下命令,安装所需的依赖项:
sudo apt install libfontconfig1-dev