plotters icon indicating copy to clipboard operation
plotters copied to clipboard

No package 'freetype2' found

Open colindaven opened this issue 5 years ago • 9 comments
trafficstars

The error

configure: error: Package requirements (freetype2) were not met:

No package 'freetype2' found

could be solved on Ubuntu 20.04 with sudo apt install libfreetype6-dev

colindaven avatar Oct 18 '20 18:10 colindaven

This makes cross compilation (ie. compiling from MacOS for linux) kind of impossible ? I haven't found a fix yet. This needs a fix.

Ragarnoy avatar Jul 13 '21 13:07 Ragarnoy

This makes cross compilation (ie. compiling from MacOS for linux) kind of impossible ? I haven't found a fix yet. This needs a fix.

@Ragarnoy, @MrGibus hey, I just searched for issues with cross compiling with plotters, cause my PR for adding a different backend feature which uses a pure Rust text rendering library was merged recently. Are you still dealing with this?

Edit: That is to say, cross compiling plotters is now relatively easy with the right feature set.

Monadic-Cat avatar Oct 09 '22 16:10 Monadic-Cat

I didn't think the additional dependency was too restrictive in Linux. No plans to work on this.

MrGibus avatar Oct 12 '22 06:10 MrGibus

With plotters 0.3.5 I have now this error, so looks that still cross compilation is hard/unavailable

cross build --target armv7-unknown-linux-gnueabihf --release
# or
cargo build --target armv7-unknown-linux-gnueabihf --release
error: failed to run custom build command for `yeslogic-fontconfig-sys v3.2.0`

Caused by:
  process didn't exit successfully: `/target/release/build/yeslogic-fontconfig-sys-88f49ca8bf2e6e30/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_ALLOW_CROSS_armv7-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_armv7_unknown_linux_gnueabihf
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
  cargo:rerun-if-env-changed=PKG_CONFIG_armv7-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_armv7_unknown_linux_gnueabihf
  cargo:rerun-if-env-changed=TARGET_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_armv7-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_armv7_unknown_linux_gnueabihf
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_armv7-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_armv7_unknown_linux_gnueabihf
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_armv7-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_armv7_unknown_linux_gnueabihf
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

  --- stderr
  thread 'main' panicked at /cargo/registry/src/index.crates.io-6f17d22bba15001f/yeslogic-fontconfig-sys-3.2.0/build.rs:8:48:
  called `Result::unwrap()` on an `Err` value: "\npkg-config exited with status code 1\n> PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig/: PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags fontconfig\n\nThe system library `fontconfig` required by crate `yeslogic-fontconfig-sys` was not found.\nThe file `fontconfig.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.\nPKG_CONFIG_PATH contains the following:\n    - /usr/lib/arm-linux-gnueabihf/pkgconfig/\n    - \n\nHINT: you may need to install a package such as fontconfig, fontconfig-dev or fontconfig-devel.\n"

qarmin avatar Jan 18 '24 08:01 qarmin

@qarmin The answer is cross compilation is hard, if you need to use fontconfig. You'll need to create a cross sysroot.

You could try disabling the ttf feature and using the ab_glyph one instead. See the list of features.

I actually added the ab_glyph feature specifically to make it easier for me to cross compile something I was doing to run on an ARM machine, way back when.

Monadic-Cat avatar Jan 18 '24 14:01 Monadic-Cat