servo / servo/font-kit

Linker error compiling examples

Open
#272 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
840
Forks
137
Avg merge
4h 56m
Merged PRs (30d)
1

Description

I get a linker error when trying to run any of the examples, e.g. with

cargo run --example render-glyph

The problem are undefined symbols in libfontconfig, for example

  = note: rust-lld: error: undefined symbol: XML_GetCurrentLineNumber
          >>> referenced by fcxml.o:(FcConfigMessage) in archive /usr/lib/x86_64-linux-gnu/libfontconfig.a
          >>> referenced by fcxml.o:(FcConfigMessage) in archive /usr/lib/x86_64-linux-gnu/libfontconfig.a

Here is the full log.

I am running Ubuntu 24.04 with pkg-config, libfreetype-dev, libfontconfig1-dev installed.

A workaround is to manually link to libexpat:

RUSTFLAGS="-lexpat" cargo run --example render-glyph

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with cargo run --example render-glyph on Ubuntu 24.04 and review the linked full log, focusing on the undefined XML_GetCurrentLineNumber references from libfontconfig.a. Compare the failing command with the reported RUSTFLAGS="-lexpat" workaround; done means the example links and runs without manually adding that flag.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, rust, ubuntu
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.