Skip to content

docs: shim inkscape -> rsvg-convert in docs build (fixes #4040)#4043

Merged
andypugh merged 3 commits into
LinuxCNC:masterfrom
grandixximo:docs-inkscape-rsvg-shim
May 19, 2026
Merged

docs: shim inkscape -> rsvg-convert in docs build (fixes #4040)#4043
andypugh merged 3 commits into
LinuxCNC:masterfrom
grandixximo:docs-inkscape-rsvg-shim

Conversation

@grandixximo
Copy link
Copy Markdown
Contributor

@grandixximo grandixximo commented May 19, 2026

Summary

dblatex hardcodes inkscape -D --export-filename=OUT IN for SVG conversion, which floods the build log with Pango/GtkRecentManager warnings on headless runs (#4040).

Drops a small bash shim named inkscape in scripts/ (already on the docs build PATH via docs/src/Submakefile:7) that translates the dblatex call into rsvg-convert. No changes to dblatex, a2x, or any Makefile recipe.

The shim is fail-safe and falls back to the real inkscape when:

  • args do not match the dblatex pattern (any other inkscape invocation passes through),
  • rsvg-convert is missing,
  • LINUXCNC_DOCS_NO_RSVG=1 is set.

librsvg2-bin added to DOC_DEPENDS. inkscape stays in the list as the fallback dependency.

Measured

  • Master_Documentation PDF build: 51.5s -> 46.8s (9% faster).
  • Zero pixel diff across all 1055 pages (compare -fuzz 5%).
  • Per-SVG conversion in isolation: ~6-8x faster (Inkscape spawns Pango/GTK, rsvg does not).

Test plan

  • make pdfdocs completes without Failed to wrap object / PangoFT2FontMap / GtkRecentManager warnings.
  • PDFs render correctly (visual spot-check on figures with embedded text).
  • LINUXCNC_DOCS_NO_RSVG=1 make pdfdocs still works (fallback path).
  • scripts/inkscape --version returns the real Inkscape version (unknown-args passthrough).

dblatex hardcodes 'inkscape -D --export-filename=OUT IN' for SVG
conversion, which spams the build log with Pango/GtkRecentManager
warnings on headless runs (issue LinuxCNC#4040).

Drop a small shim named 'inkscape' in scripts/ (already on the docs
build PATH per docs/src/Submakefile:7) that translates the dblatex
call into rsvg-convert. Falls back to the real inkscape if args do
not match the expected pattern, if rsvg-convert is missing, or if
LINUXCNC_DOCS_NO_RSVG=1 is set.

Add librsvg2-bin to DOC_DEPENDS; inkscape stays as fallback.

Measured: Master_Documentation PDF build 51.5s -> 46.8s (9%), zero
pixel diff across all 1055 pages. Per-SVG conversion ~6x faster
in isolation.
@BsAtHome
Copy link
Copy Markdown
Contributor

On CI:

  • package-indep (debian:sid) - uses real inkscape
  • package-indep (debian:trixie) - uses real inkscape
  • package-indep (debian:bookworm) - uses real inkscape

This is an example of where it happens:

inkscape -z -D --export-png=fig21.png /__w/linuxcnc/linuxcnc/docs/src/uk/gcode/images/comp-path_en.svg
Warning: Option --without-gui= is deprecated
Warning: Option --export-png= is deprecated

** (inkscape:105441): WARNING **: 11:42:22.392: Failed to wrap object of type 'GtkRecentManager'. Hint: this error is commonly caused by failing to call a library init() function.

CI runners on debian bookworm/trixie/sid use an older dblatex variant
that invokes inkscape with the 0.x syntax:

    inkscape -z -D --export-png=OUT IN
    inkscape -z -D --export-pdf=OUT IN
    inkscape -z -D --export-eps=OUT IN

The shim only matched the 1.x --export-filename= form, so on those
runners every call fell through to the real Inkscape and the
GtkRecentManager warnings persisted.

Accept -z and --without-gui as no-ops, parse --export-{png,pdf,eps}=
with explicit format, and keep extension inference for the 1.x form.
@grandixximo
Copy link
Copy Markdown
Contributor Author

Good catch. CI runners use older dblatex that invokes Inkscape 0.x syntax:

inkscape -z -D --export-png=OUT IN

My shim only matched the 1.x --export-filename= form, so on bookworm/trixie/sid every call fell through to the real Inkscape and the warnings persisted.

Pushed 0e99880: accept -z and --without-gui as no-ops, parse --export-{png,pdf,eps}= with explicit format, keep extension inference for the 1.x form. Smoke-tested both syntaxes locally.

Re-running CI should now hit rsvg-convert on all three debian flavors.

@BsAtHome
Copy link
Copy Markdown
Contributor

package-indep (debian:sid) and (debian:trixie):

inkscape -D --export-filename=fig0.png /__w/linuxcnc/linuxcnc/docs/src/es/getting-started/images/LCNC_Architecture_C1.drawio.svg
** (inkscape:95762): WARNING **: 12:53:32.494: Failed to wrap object of type 'PangoFT2FontMap'. Hint: this error is commonly caused by failing to call a library init() function.
** (inkscape:95762): WARNING **: 12:53:32.766: Ignoring unrecognized CSS property: color-scheme
** (inkscape:95762): WARNING **: 12:53:32.766: Ignoring unrecognized CSS property: background-color
** (inkscape:95762): WARNING **: 12:53:32.766: Ignoring unrecognized CSS property: background
...
inkscape -D --export-filename=fig0.png /__w/linuxcnc/linuxcnc/docs/src/fr/code/homing.svg
** (inkscape:96874): WARNING **: 12:53:44.598: Failed to wrap object of type 'PangoFT2FontMap'. Hint: this error is commonly caused by failing to call a library init() function.
** (inkscape:96874): WARNING **: 12:53:44.879: Failed to wrap object of type 'GtkRecentManager'. Hint: this error is commonly caused by failing to call a library init() function.
...

git index had mode 100644 from initial commit (core.fileMode=false
locally masked the +x bit). On CI the file was checked out as
non-executable and inkscape calls fell through to /usr/bin/inkscape
on every system, leaving the warnings in place. Set the executable
bit in the index.
@grandixximo
Copy link
Copy Markdown
Contributor Author

Root cause for the persistent warnings: shim was committed with mode 100644 (core.fileMode=false masked the executable bit locally). On CI it got checked out non-executable, so dblatex resolved inkscape on PATH past the shim straight to /usr/bin/inkscape.

Pushed c1b2cc7: git update-index --chmod=+x scripts/inkscape.

Also reviewing the arm bookworm failure now.

@grandixximo
Copy link
Copy Markdown
Contributor Author

ARM bookworm fail is unrelated: tests/abort/on_abort_command-crazy-move leaves untracked sim.var.new and the verify-clean-repo.sh post-step trips on it. Not caused by this PR.

Waiting on the new CI run with the executable-bit fix.

@grandixximo
Copy link
Copy Markdown
Contributor Author

No more inkscape warnings, all green 💪

@BsAtHome
Copy link
Copy Markdown
Contributor

And three times 4000+ fewer junk lines.

@andypugh
Copy link
Copy Markdown
Collaborator

It's a pity we can't patch dblatex instead, inserting a shim/emulator is cunning, but possibly confusing in the future.

@andypugh andypugh merged commit 60597ee into LinuxCNC:master May 19, 2026
15 checks passed
@BsAtHome
Copy link
Copy Markdown
Contributor

On Fedora with package dblatex-0.3.12-28.fc43.noarch it already uses rsvg-convert and no longer takes to inkscape.
(in file: /usr/lib/python3.14/site-packages/dbtexmf/core/imagedata.py)

On Trixie it is dblatex 0.3.12py3-5 (file /usr/lib/python3/dist-packages/dbtexmf/core/imagedata.py) and it uses inkscape.

So it probably got patched in the RPM build.

@grandixximo
Copy link
Copy Markdown
Contributor Author

Patching dblatex would just prop up an unmaintained stack (asciidoc-py is dead upstream, dblatex is niche, the XSL to LaTeX pipeline is dead weight). asciidoctor + asciidoctor-pdf looks like the obvious target: actively maintained, near drop-in for the source, prawn-svg renders SVG natively (no Inkscape, no LaTeX, no XSL).

Has this already been discussed, or is a different docs-toolchain direction already on the cards?

@BsAtHome
Copy link
Copy Markdown
Contributor

We actually need to drop the ...TeX build step completely. There have been several discussions already that the docs need "fixing", but it is a huge undertaking (and complicated by the translations). Fixing the docs is not going to be easy nor pretty in the short run and may trip on a few toes in the process too.

@hansu
Copy link
Copy Markdown
Member

hansu commented May 19, 2026

asciidoctor + asciidoctor-pdf looks like the obvious target: actively maintained, near drop-in for the source, prawn-svg renders SVG natively (no Inkscape, no LaTeX, no XSL).

Has this already been discussed, or is a different docs-toolchain direction already on the cards?

Some time ago I tried that but it turned out that all the internal adoc references need to have a relative path like this:

- * the <<cha:hal-introduction,Hardware Abstraction Layer>> (HAL), which provides a method of linking all
+ * the <<hal/intro.adoc#cha:hal-introduction,Hardware Abstraction Layer>> (HAL), which provides a method of linking all

So it got stuck somewhere writing a script to convert the references, see here:
master...hansu:linuxcnc:hansu/asciidoctor-migration

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 this pull request may close these issues.

4 participants