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

Build failure: error: 'RsvgRectangle' was not declared in this scope; did you mean 'RsvgHandle'? #142

Open
barracuda156 opened this issue Nov 2, 2024 · 4 comments

Comments

@barracuda156
Copy link
Contributor

/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_graphics_timg/timg/work/timg-1.6.0/src/svg-image-source.cc: In member function 'virtual bool timg::SVGImageSource::LoadAndScale(const timg::DisplayOptions&, int, int)':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_graphics_timg/timg/work/timg-1.6.0/src/svg-image-source.cc:56:5: error: 'RsvgRectangle' was not declared in this scope; did you mean 'RsvgHandle'?
   56 |     RsvgRectangle viewbox;
      |     ^~~~~~~~~~~~~
      |     RsvgHandle
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_graphics_timg/timg/work/timg-1.6.0/src/svg-image-source.cc:58:5: error: 'RsvgLength' was not declared in this scope
   58 |     RsvgLength svg_width, svg_height;
      |     ^~~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_graphics_timg/timg/work/timg-1.6.0/src/svg-image-source.cc:59:64: error: 'svg_width' was not declared in this scope; did you mean 'orig_width_'?
   59 |     rsvg_handle_get_intrinsic_dimensions(svg, &out_has_width, &svg_width,
      |                                                                ^~~~~~~~~
      |                                                                orig_width_
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_graphics_timg/timg/work/timg-1.6.0/src/svg-image-source.cc:60:60: error: 'svg_height' was not declared in this scope; did you mean 'orig_height_'?
   60 |                                          &out_has_height, &svg_height,
      |                                                            ^~~~~~~~~~
      |                                                            orig_height_
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_graphics_timg/timg/work/timg-1.6.0/src/svg-image-source.cc:61:61: error: 'viewbox' was not declared in this scope
   61 |                                          &out_has_viewbox, &viewbox);
      |                                                             ^~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_graphics_timg/timg/work/timg-1.6.0/src/svg-image-source.cc:59:5: error: 'rsvg_handle_get_intrinsic_dimensions' was not declared in this scope; did you mean 'rsvg_handle_get_dimensions'?
   59 |     rsvg_handle_get_intrinsic_dimensions(svg, &out_has_width, &svg_width,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |     rsvg_handle_get_dimensions
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_graphics_timg/timg/work/timg-1.6.0/src/svg-image-source.cc:96:18: error: expected ';' before 'viewport'
   96 |     RsvgRectangle viewport = {
      |                  ^~~~~~~~~
      |                  ;
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_graphics_timg/timg/work/timg-1.6.0/src/svg-image-source.cc:108:58: error: 'viewport' was not declared in this scope
  108 |     bool success = rsvg_handle_render_document(svg, cr, &viewport, nullptr);
      |                                                          ^~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_graphics_timg/timg/work/timg-1.6.0/src/svg-image-source.cc:108:20: error: 'rsvg_handle_render_document' was not declared in this scope; did you mean 'rsvg_handle_render_cairo'?
  108 |     bool success = rsvg_handle_render_document(svg, cr, &viewport, nullptr);
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                    rsvg_handle_render_cairo
make[2]: *** [src/CMakeFiles/timg.dir/svg-image-source.cc.o] Error 1
@barracuda156
Copy link
Contributor Author

@hzeller Will it be possible to avoid API which requires rusty version of librsvg? I guess that is the reason why the build fails.
Unfortunately, this was introduced already in da75ff6 (so reverting can only work to pre-librsvg code here).

@barracuda156
Copy link
Contributor Author

I have found out that librsvg support can be disabled in configure (sorry, I did not check initially, since MacPorts omitted the argument in the portfile). But it is nevertheless desirable to have it fixed rather than disabled, if possible.

@hzeller
Copy link
Owner

hzeller commented Dec 13, 2024

Yes, you can disable building using librsvg by setting -DWITH_RSVG=OFF at configure time.

On all my systems it could compile against a current version of librsvg; I suspect, you have a different version on the librsvg library, which is why it doesn't find all the symbols. Can you by any chance see what version is available on your system ? (on my system I see 2.58.3).

The choice of librsvg was mostly because it looked like a somewhat well-maintained library for SVG processing.
If you know a nicer library that can render SVG and links against c/c++ and is more common, I'd like to know

@barracuda156
Copy link
Contributor Author

@hzeller Thank you for responding!

Versions of librsvg after 2.40.x require rust, so cannot build on platforms where rust itself is broken (i.e. older versions of macOS, some non-mainstream archs for OpenBSD etc.).
MacPorts uses 2.40.21 where rust is not building, so this is what I use myself. I think this is the latest rust-free version, unless someone has fixed newer ones or backported newer APIs onto 2.40.x.

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

No branches or pull requests

2 participants