Skip to content

mapcairo.c: allow build with librsvg < 2.46 - #7462

Open
ness31 wants to merge 3 commits into
MapServer:mainfrom
ness31:librsvg
Open

mapcairo.c: allow build with librsvg < 2.46#7462
ness31 wants to merge 3 commits into
MapServer:mainfrom
ness31:librsvg

Conversation

@ness31

@ness31 ness31 commented Mar 24, 2026

Copy link
Copy Markdown

Allow building with librsvg < 2.46 (restoring branch 8.4 behavior)

@jmckenna

Copy link
Copy Markdown
Member

thanks @ness31 Can you rebase this against main branch? (we can then backport it to branch-8-6)

@ness31
ness31 changed the base branch from branch-8-6 to main March 24, 2026 16:15
@ness31

ness31 commented Mar 24, 2026

Copy link
Copy Markdown
Author

@jmckenna done thank you

@jmckenna

Copy link
Copy Markdown
Member

@ness31 I pushed a minor styling change into your PR here (to hopefully fix a failing automated test, regarding linting)

@geographika

Copy link
Copy Markdown
Member

@ness31 - what is the rationale behind supporting librsvg < 2.46? Is it tied to a Debian stable version? Looking at the release tags the last 2.45 release was in 2019.

@ness31

ness31 commented Mar 24, 2026

Copy link
Copy Markdown
Author

@geographika I'm building on Almalinux 8 embedding librsvg2-devel-2.42.7 package; otherwise I'll have to compile librsvg from source

@ltclm

ltclm commented Mar 24, 2026

Copy link
Copy Markdown

Thank you @jmckenna
We've tested this PR by applying the patch and rebuilding MapServer 8.6 using the camptocamp/mapserver base image, but unfortunately the SVG scaling issue from #7430 still persists.

Our test environment:

Base image: camptocamp/mapserver:8.6-gdal3.12
MapServer version: 8.6.0
librsvg version: 2.58.0 (Ubuntu 24.04)

The issue remains because librsvg 2.58.0 is >= 2.46, so the code still uses the rsvg_handle_render_document() path which has the viewport sizing problem with some SVG symbols.

See #7430 for our test case with SVG samples and screenshots. We're currently using an LD_PRELOAD shim to redirect to the legacy rsvg_handle_render_cairo() API as a workaround.

@johanez

johanez commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

We also tested this patch and unfortunately the scaling issue is not fixed when using a an up to date stack (Mapserver 8.6.5, librsvg 2.61.3, Ubuntu 26.04 LTS).

  • using the code from this PR (compile path to use rsvg_handle_render_document vor librsvg >=v2.46) does not work with librsvg v2.61.3, both if the svg has a viewbox or not
  • adaptinng mapcairo.c to always fall back to the legacy function rsvg_handle_render_cairo does work

So maybe using rsvg_handle_render_cairo could be applied as workaround until a better solution exists, as @linea974 and @ltclm are doing? Obviously this is not a long term solution as that function is marked as depreciated.
I can open a new PR if this is helpful.

@jmckenna could you maybe re-open issue 7430 as long as it is not solved?

@jmckenna

Copy link
Copy Markdown
Member

Thanks @johanez. Yes it would be great if you could open a new Pull Request with a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport branch-8-6 To backport a pull request to branch-8-6

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants