diff options
author | Khem Raj <raj.khem@gmail.com> | 2024-03-07 16:18:27 -0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2024-03-08 10:07:28 -0800 |
commit | b5ea420d4e8ce1eac873d6ed7908abe283c521c3 (patch) | |
tree | 5fc7c1c83738a109c0e9ea5ec0c6fa57e949ec8e | |
parent | 6b0da50505e8d12bb8c0e56ff88a02714f0dca29 (diff) | |
download | meta-openembedded-b5ea420d4e8ce1eac873d6ed7908abe283c521c3.tar.gz |
mariadb: Fix build with libxml2 2.12 ABI changes
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | meta-oe/recipes-dbs/mysql/mariadb.inc | 1 | ||||
-rw-r--r-- | meta-oe/recipes-dbs/mysql/mariadb/0001-MDEV-33439-Fix-build-with-libxml2-2.12.patch | 170 |
2 files changed, 171 insertions, 0 deletions
diff --git a/meta-oe/recipes-dbs/mysql/mariadb.inc b/meta-oe/recipes-dbs/mysql/mariadb.inc index 9e6d490cb..33da32fb2 100644 --- a/meta-oe/recipes-dbs/mysql/mariadb.inc +++ b/meta-oe/recipes-dbs/mysql/mariadb.inc | |||
@@ -24,6 +24,7 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \ | |||
24 | file://lfs64.patch \ | 24 | file://lfs64.patch \ |
25 | file://0001-Add-missing-includes-cstdint-and-cstdio.patch \ | 25 | file://0001-Add-missing-includes-cstdint-and-cstdio.patch \ |
26 | file://0001-Remove-the-compile_time_assert-lines.patch \ | 26 | file://0001-Remove-the-compile_time_assert-lines.patch \ |
27 | file://0001-MDEV-33439-Fix-build-with-libxml2-2.12.patch \ | ||
27 | " | 28 | " |
28 | SRC_URI:append:libc-musl = " file://ppc-remove-glibc-dep.patch" | 29 | SRC_URI:append:libc-musl = " file://ppc-remove-glibc-dep.patch" |
29 | SRC_URI[sha256sum] = "5239a245ed90517e96396605cd01ccd8f73cd7442d1b3076b6ffe258110e5157" | 30 | SRC_URI[sha256sum] = "5239a245ed90517e96396605cd01ccd8f73cd7442d1b3076b6ffe258110e5157" |
diff --git a/meta-oe/recipes-dbs/mysql/mariadb/0001-MDEV-33439-Fix-build-with-libxml2-2.12.patch b/meta-oe/recipes-dbs/mysql/mariadb/0001-MDEV-33439-Fix-build-with-libxml2-2.12.patch new file mode 100644 index 000000000..3e42535da --- /dev/null +++ b/meta-oe/recipes-dbs/mysql/mariadb/0001-MDEV-33439-Fix-build-with-libxml2-2.12.patch | |||
@@ -0,0 +1,170 @@ | |||
1 | From dae52f5916ef59434c93f0b716270f59dd0c3a94 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jan Tojnar <jtojnar@gmail.com> | ||
3 | Date: Sun, 7 Jan 2024 10:19:54 +0100 | ||
4 | Subject: [PATCH] MDEV-33439 Fix build with libxml2 2.12 | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | libxml2 2.12.0 made `xmlGetLastError()` return `const` pointer: | ||
10 | |||
11 | https://gitlab.gnome.org/GNOME/libxml2/-/commit/61034116d0a3c8b295c6137956adc3ae55720711 | ||
12 | |||
13 | Clang 16 does not like this: | ||
14 | |||
15 | error: assigning to 'xmlErrorPtr' (aka '_xmlError *') from 'const xmlError *' (aka 'const _xmlError *') discards qualifiers | ||
16 | error: cannot initialize a variable of type 'xmlErrorPtr' (aka '_xmlError *') with an rvalue of type 'const xmlError *' (aka 'const _xmlError *') | ||
17 | |||
18 | Let’s update the variables to `const`. | ||
19 | For older versions, it will be automatically converted. | ||
20 | |||
21 | But then `xmlResetError(xmlError*)` will not like the `const` pointer: | ||
22 | |||
23 | error: no matching function for call to 'xmlResetError' | ||
24 | note: candidate function not viable: 1st argument ('const xmlError *' (aka 'const _xmlError *')) would lose const qualifier | ||
25 | |||
26 | Let’s replace it with `xmlResetLastError()`. | ||
27 | |||
28 | ALso remove `LIBXMLDOC::Xerr` protected member property. | ||
29 | It was introduced in 65b0e5455b547a3d574fa77b34cce23ae3bea0a0 | ||
30 | along with the `xmlResetError` calls. | ||
31 | It does not appear to be used for anything. | ||
32 | |||
33 | Upstream-Status: Backport [https://github.com/MariaDB/server/pull/2983] | ||
34 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
35 | --- | ||
36 | storage/connect/libdoc.cpp | 39 +++++++++++++++++++------------------- | ||
37 | 1 file changed, 19 insertions(+), 20 deletions(-) | ||
38 | |||
39 | diff --git a/storage/connect/libdoc.cpp b/storage/connect/libdoc.cpp | ||
40 | index 67f22ce2..ab588dd4 100644 | ||
41 | --- a/storage/connect/libdoc.cpp | ||
42 | +++ b/storage/connect/libdoc.cpp | ||
43 | @@ -93,7 +93,6 @@ class LIBXMLDOC : public XMLDOCUMENT { | ||
44 | xmlXPathContextPtr Ctxp; | ||
45 | xmlXPathObjectPtr Xop; | ||
46 | xmlXPathObjectPtr NlXop; | ||
47 | - xmlErrorPtr Xerr; | ||
48 | char *Buf; // Temporary | ||
49 | bool Nofreelist; | ||
50 | }; // end of class LIBXMLDOC | ||
51 | @@ -327,7 +326,6 @@ LIBXMLDOC::LIBXMLDOC(char *nsl, char *nsdf, char *enc, PFBLOCK fp) | ||
52 | Ctxp = NULL; | ||
53 | Xop = NULL; | ||
54 | NlXop = NULL; | ||
55 | - Xerr = NULL; | ||
56 | Buf = NULL; | ||
57 | Nofreelist = false; | ||
58 | } // end of LIBXMLDOC constructor | ||
59 | @@ -365,8 +363,8 @@ bool LIBXMLDOC::ParseFile(PGLOBAL g, char *fn) | ||
60 | Encoding = (char*)Docp->encoding; | ||
61 | |||
62 | return false; | ||
63 | - } else if ((Xerr = xmlGetLastError())) | ||
64 | - xmlResetError(Xerr); | ||
65 | + } else if (xmlGetLastError()) | ||
66 | + xmlResetLastError(); | ||
67 | |||
68 | return true; | ||
69 | } // end of ParseFile | ||
70 | @@ -505,9 +503,9 @@ int LIBXMLDOC::DumpDoc(PGLOBAL g, char *ofn) | ||
71 | #if 1 | ||
72 | // This function does not crash ( | ||
73 | if (xmlSaveFormatFileEnc((const char *)ofn, Docp, Encoding, 0) < 0) { | ||
74 | - xmlErrorPtr err = xmlGetLastError(); | ||
75 | + const xmlError *err = xmlGetLastError(); | ||
76 | strcpy(g->Message, (err) ? err->message : "Error saving XML doc"); | ||
77 | - xmlResetError(Xerr); | ||
78 | + xmlResetLastError(); | ||
79 | rc = -1; | ||
80 | } // endif Save | ||
81 | // rc = xmlDocDump(of, Docp); | ||
82 | @@ -546,8 +544,8 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp) | ||
83 | if (Nlist) { | ||
84 | xmlXPathFreeNodeSet(Nlist); | ||
85 | |||
86 | - if ((Xerr = xmlGetLastError())) | ||
87 | - xmlResetError(Xerr); | ||
88 | + if (xmlGetLastError()) | ||
89 | + xmlResetLastError(); | ||
90 | |||
91 | Nlist = NULL; | ||
92 | } // endif Nlist | ||
93 | @@ -555,8 +553,8 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp) | ||
94 | if (Xop) { | ||
95 | xmlXPathFreeObject(Xop); | ||
96 | |||
97 | - if ((Xerr = xmlGetLastError())) | ||
98 | - xmlResetError(Xerr); | ||
99 | + if (xmlGetLastError()) | ||
100 | + xmlResetLastError(); | ||
101 | |||
102 | Xop = NULL; | ||
103 | } // endif Xop | ||
104 | @@ -564,8 +562,8 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp) | ||
105 | if (NlXop) { | ||
106 | xmlXPathFreeObject(NlXop); | ||
107 | |||
108 | - if ((Xerr = xmlGetLastError())) | ||
109 | - xmlResetError(Xerr); | ||
110 | + if (xmlGetLastError()) | ||
111 | + xmlResetLastError(); | ||
112 | |||
113 | NlXop = NULL; | ||
114 | } // endif NlXop | ||
115 | @@ -573,8 +571,8 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp) | ||
116 | if (Ctxp) { | ||
117 | xmlXPathFreeContext(Ctxp); | ||
118 | |||
119 | - if ((Xerr = xmlGetLastError())) | ||
120 | - xmlResetError(Xerr); | ||
121 | + if (xmlGetLastError()) | ||
122 | + xmlResetLastError(); | ||
123 | |||
124 | Ctxp = NULL; | ||
125 | } // endif Ctxp | ||
126 | @@ -590,6 +588,7 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp) | ||
127 | /******************************************************************/ | ||
128 | xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp) | ||
129 | { | ||
130 | + const xmlError *xerr; | ||
131 | xmlNodeSetPtr nl; | ||
132 | |||
133 | if (trace(1)) | ||
134 | @@ -649,11 +648,11 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp) | ||
135 | } else | ||
136 | xmlXPathFreeObject(Xop); // Caused node not found | ||
137 | |||
138 | - if ((Xerr = xmlGetLastError())) { | ||
139 | - strcpy(g->Message, Xerr->message); | ||
140 | - xmlResetError(Xerr); | ||
141 | + if ((xerr = xmlGetLastError())) { | ||
142 | + strcpy(g->Message, xerr->message); | ||
143 | + xmlResetLastError(); | ||
144 | return NULL; | ||
145 | - } // endif Xerr | ||
146 | + } // endif xerr | ||
147 | |||
148 | } // endif Xop | ||
149 | |||
150 | @@ -1079,7 +1078,7 @@ void XML2NODE::AddText(PGLOBAL g, PCSZ txtp) | ||
151 | /******************************************************************/ | ||
152 | void XML2NODE::DeleteChild(PGLOBAL g, PXNODE dnp) | ||
153 | { | ||
154 | - xmlErrorPtr xerr; | ||
155 | + const xmlError *xerr; | ||
156 | |||
157 | if (trace(1)) | ||
158 | htrc("DeleteChild: node=%p\n", dnp); | ||
159 | @@ -1122,7 +1121,7 @@ void XML2NODE::DeleteChild(PGLOBAL g, PXNODE dnp) | ||
160 | if (trace(1)) | ||
161 | htrc("DeleteChild: errmsg=%-.256s\n", xerr->message); | ||
162 | |||
163 | - xmlResetError(xerr); | ||
164 | + xmlResetLastError(); | ||
165 | } // end of DeleteChild | ||
166 | |||
167 | /* -------------------- class XML2NODELIST ---------------------- */ | ||
168 | -- | ||
169 | 2.44.0 | ||
170 | |||