wxQt: undefined reference to `cairo_surface_get_device_scale' (Issue #26218)

4 views
Skip to first unread message

Carlo Bramini

unread,
7:37 AM (14 hours ago) 7:37 AM
to wx-...@googlegroups.com, Subscribed
carlo-bramini created an issue (wxWidgets/wxWidgets#26218)

Build System Used

I build wxWidgets and/or my application using:

  • CMake
  • configure
  • mingw32-make with makefile.gcc
  • MSBuild (Microsoft Visual Studio solution file)
  • nmake with makefile.vc
  • Xcode

Description

I compiled wxQt of wxWidgets-3.2.9 but I got this error during process:

src/generic/graphicc.cpp.o: in function `wxCairoContext::OffsetHelper::OffsetHelper(bool, _cairo*, wxGraphicsPen const&)':
src/generic/graphicc.cpp:1971:(.text+0x1d12): undefined reference to `cairo_surface_get_device_scale'
ld: /usr/src/debug/wxWidgets_3.2-3.2.9-1/src/generic/graphicc.cpp:1971:(.text+0x20e2): undefined reference to `cairo_surface_get_device_scale'
ld: /usr/src/debug/wxWidgets_3.2-3.2.9-1/src/generic/graphicc.cpp:1971:(.text+0x23a2): undefined reference to `cairo_surface_get_device_scale'
ld: libs/core/CMakeFiles/wxcore.dir/__/__/__/__/src/generic/graphicc.cpp.o: in function `wxCairoPenData::Apply(wxGraphicsContext*)':
src/generic/graphicc.cpp:1040:(.text+0x30fa): undefined reference to `cairo_surface_get_device_scale'
collect2: error: ld returned 1 exit status

I fixed the error with this tiny patch:

--- wxWidgets-3.2.9.old\src\common\cairo.cpp	Sun Dec 07 23:59:42 2025
+++ wxWidgets-3.2.9\src\common\cairo.cpp	Thu Feb 19 12:06:31 2026
@@ -186,7 +186,9 @@
     m( cairo_user_to_device_distance, \
        (cairo_t* cr, double *dx, double* dy), (cr, dx, dy) ) \
     m( cairo_surface_mark_dirty, \
-       (cairo_surface_t* surface), (surface))
+       (cairo_surface_t* surface), (surface)) \
+    m( cairo_surface_get_device_scale, \
+       (cairo_surface_t *surface, double *x_scale, double *y_scale), (surface, x_scale, y_scale))
 
 #ifdef __WXMAC__
 #define wxCAIRO_PLATFORM_METHODS(m) \

I wanted to contribute this patch as a PR, but I have not understood how to contribute it for 3.2.9.
Thank you very much.

Platform and version information

  • wxWidgets version you are building: 3.2.9
  • wxWidgets port you are building: wxQt
  • OS and its version: CYGWIN
  • Compiler being used: gcc-13.4.0
  • Non-default compiler options, if any : None


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26218@github.com>

VZ

unread,
8:01 AM (13 hours ago) 8:01 AM
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26218)

To create a PR against 3.2 you just need to pick "3.2" branch as "target" when opening it in the GitHub web UI.

I'm not sure why is this needed only for 3.2, however: cairo_surface_get_device_scale() seems to be used in master too?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26218/3938745509@github.com>

Carlo Bramini

unread,
8:16 AM (13 hours ago) 8:16 AM
to wx-...@googlegroups.com, Subscribed
carlo-bramini left a comment (wxWidgets/wxWidgets#26218)

I'm not sure why is this needed only for 3.2, however: cairo_surface_get_device_scale() seems to be used in master too?

I also compiled version 3.3.1 but this error didn't happen, so I didn't check if this function is also used by sources into the master branch.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26218/3938763862@github.com>

AliKet

unread,
8:30 AM (13 hours ago) 8:30 AM
to wx-...@googlegroups.com, Subscribed
AliKet left a comment (wxWidgets/wxWidgets#26218)

wx 3.2.x uses cairo renderer by default under linux and this has changed in wx 3.3 which uses its own implementation

https://github.com/wxWidgets/wxWidgets/blob/896e4f587615b832ce27b8325357cb504997e1d3/src/generic/graphicc.cpp#L3645-L3652


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26218/3938782925@github.com>

VZ

unread,
3:28 PM (6 hours ago) 3:28 PM
to wx-...@googlegroups.com, Subscribed

Closed #26218 as completed via 583d44d.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issue/26218/issue_event/22971902231@github.com>

Reply all
Reply to author
Forward
0 new messages