我试图学习如何在拉斯特绘制地图, 并找到使用绘图师的指南(如果有人知道有更好的图书馆可以让我知道) 。
https://plotters-rs.github.io/book/intro/getting_started.html
总之,我是在Fedora 37, 并使用指南的“获取开始”部分所展示的例子, 遇到一个问题。
代码是:
/*
Example of plotting in Rust
*/
use plotters::prelude::*;
fn main() {
let root_drawing_area = BitMapBackend::new("0.1.png", (1024, 768))
.into_drawing_area();
root_drawing_area.fill(&WHITE).unwrap();
let mut chart = ChartBuilder::on(&root_drawing_area)
.build_cartesian_2d(-3.14..3.14, -1.2..1.2)
.unwrap();
chart.draw_series(LineSeries::new(
(-314..314).map(|x| x as f64 / 100.0)
.map(|x| (x, x.sin())), &RED))
.unwrap();
}
在我的货物.toml 文件中,我用 cargo 添加了依赖性,添加了绘图器
但当我用 cargo building
来运行代码时, 我就会发现这个错误 :
Compiling yeslogic-fontconfig-sys v3.2.0
error: failed to run custom build command for `yeslogic-fontconfig-sys v3.2.0`
Caused by:
process didn t exit successfully: `/home/usr/Dev/RustyKrab/plotting/plot_example/target/debug/build/yeslogic-fontconfig-sys-3bf9e95194fbfdbd/build-script-build` (exit status: 101)
继续坚持下去
--- stdout
cargo:rerun-if-env-changed=RUST_FONTCONFIG_DLOPEN
cargo:rerun-if-env-changed=FONTCONFIG_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=FONTCONFIG_STATIC
cargo:rerun-if-env-changed=FONTCONFIG_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 called `Result::unwrap()` on an `Err` value: "`"pkg-config" "--libs" "--cflags" "fontconfig"` did not exit successfully: exit status: 1
error: could not find system library fontconfig required by the yeslogic-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
Package fontconfig , required by virtual:world , not found
" , /home/usr/.cargo/registry/src/github.com-1ecc6299db9ec823/yeslogic-fontconfig-sys-3.2.0/build.rs:8:48
错误最后一行为 note: 使用 `RUST_BACKTRACE=1' 环境变量运行,以显示回溯跟踪
。 我尝试运行 RUST_BACKTRACE=1 alacrity
,但只是不起作用。
我怎么能在这附近工作 这样我才能在拉斯特用绘图机?
注意: 我已经安装了字体配置, 使用 sudo dnf 安装字体配置