Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use dlib for easier cross compiling #11

Closed
Be-ing opened this issue Feb 14, 2022 · 0 comments · Fixed by #12
Closed

use dlib for easier cross compiling #11

Be-ing opened this issue Feb 14, 2022 · 0 comments · Fixed by #12

Comments

@Be-ing
Copy link
Contributor

Be-ing commented Feb 14, 2022

I'm trying to cross compile my application from x86-64 Linux to aarch64-unknown-linux-gnu to build it for my Pinephone and I am stumbling over Slint's dependency on fontconfig. I tried using an ARM64 container to cross compile, but using emulation with QEMU requires 2 hours to build! Slint currently uses the unsafe servo-fontconfig crate, so I opened an issue for that, but I think it would be better to improve this crate and switch Slint to using this.

The servo-fontconfig crate falls back to statically linking a vendored copy of libfontconfig if pkgconfig does not find it. This is problematic for two reasons. Most importantly, using a different copy of fontconfig than the system doesn't work as desired. Also, fontconfig requires a lot of C dependencies that need to be linked, which makes it difficult to get the vendored copy to build:

moire on  main [$!] is 📦 v0.1.0 via 🦀 v1.58.1
❯ pkg-config fontconfig --static --libs
-lfontconfig -lfreetype -lz -lbz2 -lpng16 -lm -lm -lz -lharfbuzz -lm -lglib-2.0 -lm -lpcre -lsysprof-capture-4 -pthread -lgraphite2 -lbrotlidec -lbrotlicommon -lxml2 -lz -llzma -lm

A solution to this would be using the dlib to let the user of the library either directly link fontconfig at build time or use dlopen to load it at runtime and remove the build time dependency. I recently helped implement this for the Rust JACK bindings and it makes cross compiling really easy. The Rust Wayland bindings use dlib as well and the X11 bindings have a similar option to use dlopen with the x11-dl crate.

@Be-ing Be-ing changed the title use dlopen for easier cross compiling use dlib for easier cross compiling Feb 14, 2022
Be-ing added a commit to Be-ing/fontconfig-rs that referenced this issue Feb 14, 2022
Be-ing added a commit to Be-ing/fontconfig-rs that referenced this issue Feb 14, 2022
Be-ing added a commit to Be-ing/fontconfig-rs that referenced this issue Feb 14, 2022
Be-ing added a commit to Be-ing/fontconfig-rs that referenced this issue Feb 15, 2022
Be-ing added a commit to Be-ing/fontconfig-rs that referenced this issue Feb 15, 2022
Be-ing added a commit to Be-ing/fontconfig-rs that referenced this issue Feb 15, 2022
Be-ing added a commit to Be-ing/fontconfig-rs that referenced this issue Feb 15, 2022
Be-ing added a commit to Be-ing/fontconfig-rs that referenced this issue Feb 15, 2022
Be-ing added a commit to Be-ing/fontconfig-rs that referenced this issue Feb 15, 2022
Be-ing added a commit to Be-ing/fontconfig-rs that referenced this issue Feb 16, 2022
Be-ing added a commit to Be-ing/fontconfig-rs that referenced this issue Feb 17, 2022
Be-ing added a commit to Be-ing/fontconfig-rs that referenced this issue Feb 17, 2022
Be-ing added a commit to Be-ing/fontconfig-rs that referenced this issue Feb 17, 2022
@wezm wezm closed this as completed in #12 Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant