package/log4cxx: fix build without wchar
authorFabrice Fontaine <fontaine.fabrice@gmail.com>
Mon, 28 Sep 2020 19:17:30 +0000 (21:17 +0200)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Wed, 30 Sep 2020 20:50:05 +0000 (22:50 +0200)
Fix build with log4cxx in version 0.11.0

Fixes:
 - http://autobuild.buildroot.org/results/bab5329fdeb894471bfd5192ce04d3fbd2f9be5c

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/log4cxx/0001-fix-build-without-wchar.patch [new file with mode: 0644]

diff --git a/package/log4cxx/0001-fix-build-without-wchar.patch b/package/log4cxx/0001-fix-build-without-wchar.patch
new file mode 100644 (file)
index 0000000..fc0e7be
--- /dev/null
@@ -0,0 +1,55 @@
+From 1fa70eaf24d75e84625f22779ec347fd29bf1ae6 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Thu, 24 Sep 2020 08:47:37 +0200
+Subject: [PATCH] fix build without wchar
+
+Disable wencode without wchar or the build will fail on:
+
+odbcappender.cpp: In static member function 'static void log4cxx::db::ODBCAppender::encode(wchar_t**, const LogString&, log4cxx::helpers::Pool&)':
+odbcappender.cpp:362:22: error: 'wencode' is not a member of 'log4cxx::helpers::Transcoder'
+  *dest = Transcoder::wencode(src, p);
+                      ^~~~~~~
+
+Fixes:
+ - http://autobuild.buildroot.org/results/bab5329fdeb894471bfd5192ce04d3fbd2f9be5c
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+[Retrieved from:
+https://github.com/apache/logging-log4cxx/commit/f171f818c798d48631d5b45851e4593953f31d9c]
+---
+ src/main/cpp/odbcappender.cpp              | 2 ++
+ src/main/include/log4cxx/db/odbcappender.h | 2 ++
+ 2 files changed, 4 insertions(+)
+
+diff --git a/src/main/cpp/odbcappender.cpp b/src/main/cpp/odbcappender.cpp
+index 6bfa519e..218df132 100644
+--- a/src/main/cpp/odbcappender.cpp
++++ b/src/main/cpp/odbcappender.cpp
+@@ -357,10 +357,12 @@ void ODBCAppender::setSql(const LogString& s)
+       }
+ }
++#if LOG4CXX_WCHAR_T_API || LOG4CXX_LOGCHAR_IS_WCHAR_T || defined(WIN32) || defined(_WIN32)
+ void ODBCAppender::encode(wchar_t** dest, const LogString& src, Pool& p)
+ {
+       *dest = Transcoder::wencode(src, p);
+ }
++#endif
+ void ODBCAppender::encode(unsigned short** dest,
+       const LogString& src, Pool& p)
+diff --git a/src/main/include/log4cxx/db/odbcappender.h b/src/main/include/log4cxx/db/odbcappender.h
+index a26bc35b..fdc144ff 100644
+--- a/src/main/include/log4cxx/db/odbcappender.h
++++ b/src/main/include/log4cxx/db/odbcappender.h
+@@ -300,8 +300,10 @@ class LOG4CXX_EXPORT ODBCAppender : public AppenderSkeleton
+       private:
+               ODBCAppender(const ODBCAppender&);
+               ODBCAppender& operator=(const ODBCAppender&);
++#if LOG4CXX_WCHAR_T_API || LOG4CXX_LOGCHAR_IS_WCHAR_T || defined(WIN32) || defined(_WIN32)
+               static void encode(wchar_t** dest, const LogString& src,
+                       log4cxx::helpers::Pool& p);
++#endif
+               static void encode(unsigned short** dest, const LogString& src,
+                       log4cxx::helpers::Pool& p);
+ }; // class ODBCAppender