Package: libwxgtk3.2-dev
Version: 3.2.1+dfsg-1

When including the file /usr/include/wx-3.2/wx/matrix.h compilation fails. Example output from compiling opencpn below.

This is upstream bug https://github.com/wxWidgets/wxWidgets/issues/22790. The bug is acknowledged and a fix is under way for 3.2.2 or 3.2.3.

Attaching a patch based in the already merged fixes upstream. The original fixes are quite complex since they have to deal with all sorts of configurations not available on Debian. The patch is simplified, just aiming top solve the actual problem in Debian until next upstream release is available.

[ 11%] Building CXX object libs/gdal/CMakeFiles/GDAL.dir/src/ogrfeaturedefn.cpp.o cd /home/mk/OpenCPN/OpenCPN/obj-x86_64-linux-gnu/libs/gdal && /usr/bin/g++-10 -DHAVE_WEBVIEW -DHAVE_WX_GESTURE_EVENTS -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DocpnUSE_GL -DocpnUSE_SVG -DwxUSE_WEBVIEW=1 -I/home/mk/OpenCPN/OpenCPN/libs/gdal/include/gdal -I/home/mk/OpenCPN/OpenCPN/libs/gdal/include -isystem /usr/lib/x86_64-linux-gnu/wx/include/gtk3-unicode-3.2 -isystem /usr/include/wx-3.2 -g -O2 -ffile-prefix-map=/home/mk/OpenCPN/OpenCPN=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -pthread -O2 -g -DNDEBUG -DPREFIX=\"/usr\" -fvisibility=hidden -Wall -Wno-unused -fexceptions -rdynamic -fno-strict-aliasing -Wno-deprecated-declarations -std=gnu++11 -MD -MT libs/gdal/CMakeFiles/GDAL.dir/src/ogrfeaturedefn.cpp.o -MF CMakeFiles/GDAL.dir/src/ogrfeaturedefn.cpp.o.d -o CMakeFiles/GDAL.dir/src/ogrfeaturedefn.cpp.o -c /home/mk/OpenCPN/OpenCPN/libs/gdal/src/ogrfeaturedefn.cpp
In file included from /usr/include/wx-3.2/wx/defs.h:550,
                 from /usr/include/wx-3.2/wx/wxprec.h:12,
                 from /home/mk/OpenCPN/OpenCPN/src/chartsymbols.cpp:27:
/usr/include/wx-3.2/wx/matrix.h:44:1: error: expected identifier before ‘__attribute__’
   44 | WXDLLIMPEXP_CORE wxTransformMatrix: public wxObject
      | ^~~~~~~~~~~~~~~~
In file included from /home/mk/OpenCPN/OpenCPN/include/bbox.h:9,
                 from /home/mk/OpenCPN/OpenCPN/include/s52s57.h:31,
                 from /home/mk/OpenCPN/OpenCPN/include/s52plib.h:31,
                 from /home/mk/OpenCPN/OpenCPN/include/chartsymbols.h:28,
                 from /home/mk/OpenCPN/OpenCPN/src/chartsymbols.cpp:36:
/usr/include/wx-3.2/wx/matrix.h:44:35: error: expected initializer before ‘:’ token
From 03eca5af92d4a395efc65dd8a6e936e33293f5b8 Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.a...@gmail.com>
Date: Mon, 21 Nov 2022 14:20:15 +0100
Subject: [PATCH] matrix.h: Patch attributes handling (wxwidgets#22790).

Bug: https://github.com/wxWidgets/wxWidgets/issues/22790
Forwarded: not-needed

---
 defs.h   | 21 +++++++++++++++++++++
 matrix.h |  3 ++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/defs.h b/defs.h
index e048cb7..d491939 100644
--- a/defs.h
+++ b/defs.h
@@ -169,6 +169,27 @@
 #else /* !g++ */
 #   define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name)
 #endif
+/*
+    Some gcc versions choke on __has_cpp_attribute(gnu::visibility) due to the
+    presence of the colon, but we only need this macro in C++ code, so just
+    don't define it when using C.
+ */
+
+#ifdef __cplusplus
+
+/*
+    Special macro used for the classes that are exported and deprecated.
+    It exists because standard [[deprecated]] attribute can't be combined with
+    legacy __attribute__((visibility)), but we can't use [[visibility]] instead
+    of the latter because it can't be use in the same place in the declarations
+    where we use WXDLLIMPEXP_CORE. So we define this special macro which uses
+    the standard visibility attribute just where we can't do otherwise.
+
+    Heavily simplified for wxWidgets and gcc -- Alec Leamas
+ */
+    #define wxDEPRECATED_EXPORT_CORE(msg) \
+	__attribute__((visibility("default")))
+#endif
 
 /*
    Clang Support
diff --git a/matrix.h b/matrix.h
index d18a0d2..a3392b5 100644
--- a/matrix.h
+++ b/matrix.h
@@ -41,7 +41,8 @@ class
 #ifndef WXBUILDING
 wxDEPRECATED_MSG("use wxAffineMatrix2D instead")
 #endif
-WXDLLIMPEXP_CORE wxTransformMatrix: public wxObject
+wxDEPRECATED_EXPORT_CORE("use wxAffineMatrix2D instead")
+wxTransformMatrix: public wxObject
 {
 public:
     wxTransformMatrix();
-- 
2.30.2

Reply via email to