Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Error on build: "could not find system library 'fontconfig' required by the 'servo-fontconfig-sys' crate" #56

Closed
HenryWConklin opened this issue Oct 31, 2022 · 3 comments · Fixed by #57

Comments

@HenryWConklin
Copy link
Contributor

I get an error running following the instructions in the readme, installing the missing dependency with sudo apt install libfontconfig-dev fixes the error. I'll put in a PR to add that to the readme, but adding here to document it and maybe you know of a way to avoid the extra step. Full error is below:

error: failed to run custom build command for `servo-fontconfig-sys v5.1.0`

Caused by:
  process didn't exit successfully: `/home/henry/workspace/blackjack/target/debug/build/servo-fontconfig-sys-2618e6ca9957a126/build-script-build` (exit status: 101)
  --- stdout
  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 '`"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/henry/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/servo-fontconfig-sys-5.1.0/build.rs:34:17
@setzer22
Copy link
Owner

setzer22 commented Nov 3, 2022

How strange, this native dependency seems to be pulled in by winit (you can check it out with cargo tree), but this requirement is not mentioned anywhere in their documentation. Might be worth checking if you can compiling other winit programs on your system without this package, and letting them know upstream if that's not the case. Are you using some kind of minimal distribution or trying to run this inside a docker container perhaps?

Either way, thanks for reporting 👍

@HenryWConklin
Copy link
Contributor Author

I'm using a pretty standard Ubuntu 22.04 install. I don't think I've had to install too many dev packages since the last time I did a clean install.

I do get the error building winit from their repo at the latest release, but it seems to be fixed on master. I found this issue where fontconfig comes up several times, but I didn't really follow it on a quick skim: rust-windowing/winit#2373

@setzer22
Copy link
Owner

setzer22 commented Nov 4, 2022

Nice catch 🤔 this seems to be exactly it. This chain of dependencies shown in the issue is the one requiring fontconfig as a native dependency:
sctk-adwaita ->crossfont -> servo-fontconfig -> servo-fontconfig-sys

So, it seems this will be fixed in the next version of winit. Still worth documenting this as a temporary dependency for other people with the same issue 👍 I've added a new comment to the PR

@setzer22 setzer22 closed this as completed Nov 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants