# RSVG Package: Missing librsvg-2-2.dll

**URL:** <https://racket.discourse.group/t/rsvg-package-missing-librsvg-2-2-dll/2285>\
**Category:** Questions & Answers\
**Created:** [September 4, 2023, 1:14pm UTC](https://racket.discourse.group/t/rsvg-package-missing-librsvg-2-2-dll/2285 "2023-09-04T13:14:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bakgatviooldoos](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/bakgatviooldoos/32/1381_2.png) [@bakgatviooldoos](https://racket.discourse.group/u/bakgatviooldoos)\
**Post date:** [September 4, 2023, 1:14pm UTC](https://racket.discourse.group/t/rsvg-package-missing-librsvg-2-2-dll/2285/1 "2023-09-04T13:14:18Z")

</div>

Hi, Racket Discourse.

I am trying to import `.svg` files to use in concert with the `metapict` library. I want to make use of the `rsvg` package to import the pertinent files, but I receive the following error:

> ..\..\..\..\..\..\Program Files\Racket\collects\ffi\unsafe.rkt:131:0: ffi-lib: could not load foreign library  
> path: librsvg-2-2.dll  
> system error: The specified procedure could not be found.; win\_err=127

I installed the `mingw64/mingw-w64-x86_64-librsvg` variant of the library, which at least delayed the aforementioned error but when I again try to import the file, I get following error from DrRacket:

> The procedure entry point g\_string\_free\_and\_steal could not be located in the dynamic link library C:\msys64\mingw64\bin\libgdk\_pixbuf-2.0-0.dll.

I can confirm that the `.dll` above is present in the same directory.

Could this be due to the fact that I am using the mingw64 variant? I haven't used the FFI much, apart from some idle tinkering, so I'm not sure whether this assumption is even vaguely correct.

I make this assumption because I see that there has been a similar question in the past, on the old Google Racket Users group, [here](https://groups.google.com/g/racket-users/c/AZyyGCi730c).

Any help would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [September 4, 2023, 1:47pm UTC](https://racket.discourse.group/t/rsvg-package-missing-librsvg-2-2-dll/2285/2 "2023-09-04T13:47:32Z")

</div>

It seems `librsvg` depends`on Pango. So does the graphic system (Cairo) used by Racket. I think, your`librsvg`needs to be built with the same (maybe just the same version) shared library as used by`racket/draw`. It might be worth trying the DLL that Doug used - and  
the same version of Racket as he used. Just to test that it is possible to get it  
working on Windows.

FWIW on my machine with macOS `librsvg` works with Racket v.7.5 but not on the latest v8.8.  
I can't remember how I got it working, but I see that I have a copy of the Github repo of  
`librsvg` so maybe I compiled it myself?

Do you need full support for SVGs or is support for SVG paths enough?

There is a parser for svg paths included with MetaPict.  
Here is an example where it is used to draw a bishop in the same style as on Lichess.

```scheme
(define (draw-bishop dc brush pen-butt pen-round/miter decoration-pen)
  (define p1 (parse-svg-path (~a "M9 36c3.39-.97 10.11.43 13.5-2 3.39 2.43 10.11 1.03 13.5 2 "
                                 "0 0 1.65.54 3 2-.68.97-1.65.99-3 .5-3.39-.97-10.11.46-13.5-1-3.39 "
                                 "1.46-10.11.03-13.5 1-1.354.49-2.323.47-3-.5 1.354-1.94 3-2 3-2z")))
  (define p2 (parse-svg-path (~a "M15 32c2.5 2.5 12.5 2.5 15 0 .5-1.5 0-2 0-2 0-2.5-2.5-4-2.5-4 "
                                 "5.5-1.5 6-11.5-5-15.5-11 4-10.5 14-5 15.5 0 0-2.5 1.5-2.5 4 0 0-.5.5 0 2z")))
  (define p3 (parse-svg-path "M25 8a2.5 2.5 0 1 1-5 0 2.5 2.5 0 1 1 5 0z"))
  (define p4 (parse-svg-path "M17.5 26h10M15 30h15m-7.5-14.5v5M20 18h5"))

  (send dc set-brush brush)
  (send dc set-pen pen-butt)
  (draw-paths dc (svg-path->paths p1) 0 0 'odd-even)
  (draw-paths dc (svg-path->paths p2) 0 0 'odd-even)
  (draw-paths dc (svg-path->paths p3) 0 0 'odd-even)
  ; decorations
  (send dc set-brush transparent-brush)
  (send dc set-pen decoration-pen)
  (draw-paths dc (svg-path->paths p4)))

```

The example is from:  
[https://github.com/soegaard/metapict/blob/master/metapict/svg/chess.rkt](https://github.com/soegaard/metapict/blob/master/metapict/svg/chess.rkt)

---

<div class="post-metadata">

**Author:** ![bakgatviooldoos](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/bakgatviooldoos/32/1381_2.png) [@bakgatviooldoos](https://racket.discourse.group/u/bakgatviooldoos)\
**Post date:** [September 4, 2023, 3:03pm UTC](https://racket.discourse.group/t/rsvg-package-missing-librsvg-2-2-dll/2285/3 "2023-09-04T15:03:59Z")

</div>

Hi, @soegaard.

Thank you for the helpful link/advice 👍.

I probably don't need full support for SVGs, since I can likely retrieve the paths easily enough by inspecting the files; but then again, I could probably just convert them to more standard formats for my uses.

I will continue to have a look at the path route (I see lots of unfamiliar things, given that I've never paid much attention to SVG files), as well as trying out the particular DLL/version combination you mention from Doug's replies.

I'll update if I make any progress.
