rust glium编译错误,在Ubuntu上缺少包。

huangapple go评论48阅读模式
英文:

rust glium compile error missing package on ubuntu

问题

I try compile this in Rust with glium on an Ubutnu machine.

#[macro_use]
extern crate glium;

fn main() {
    println!("Hello, world!");
}

It results in this error:

  --- 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))]
    |                                  ^^^^^^^^^^^

The first error says it cannot find the fontconfig library. What should I do here? How do I get that library installed? I do not know what to do with the second error, either.

OS: Ubuntu 22.04 LTS

I have added glium = "*" to cargo dependencies.

Addendum

The first error is solved after running cargo clean -
but the second error still persists. Any ideas?

英文:

I try compile this in Rust with glium on an Ubutnu machine.

#[macro_use]
extern crate glium;

fn main() {
    println!("Hello, world!");
}

It results in this error:

  --- 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))]
    |                                  ^^^^^^^^^^^

The first error says it cannot find the fontconfig library. What should I do here? How do I get that library installed? I do not know what to do with the second error, either.

OS: Ubuntu 22.04 LTS

I have added glium = "*" to cargo dependencies.

Addendum

The first error is solved after running cargo clean -
but the second error still persists. Any ideas?

答案1

得分: 1

使用以下命令在终端中安装所需的依赖项:

sudo apt install libfontconfig1-dev

英文:

Using this command in the terminal, install the required dependency:

sudo apt install libfontconfig1-dev

huangapple
  • 本文由 发表于 2023年2月10日 04:09:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/75403926.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定