SpectrumIM / spectrum2

Spectrum 2 IM transports
https://spectrum.im
408 stars 91 forks source link

Build failure with log4cxx 1.0.0 #464

Closed thesamesam closed 1 year ago

thesamesam commented 1 year ago

I recently updated our log4cxx package in Gentoo to 1.0.0 and hit the following build failure:

FAILED: plugin/cpp/CMakeFiles/transport-plugin.dir/Logging.cpp.o
/var/tmp/portage/net-im/spectrum2-2.1.3-r1/temp/clang-wrappers/x86_64-pc-linux-gnu-g++ -DBOOST_FILESYSTEM_VERSION=3 -DSPECTRUM_VERSION=\"2.1.x-git-89867b7\" -DSUPPORT_LEGACY_CAPS -DWITH_LIBEVENT -DWITH_LOG4CXX -DWITH_PROTOBUF -DWITH_SQLITE -Dtransport_plugin_EXPORTS -I/var/tmp/portage/net-im/spectrum2-2.1.3-r1/work/spectrum2-2.1.3/include  -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -Wreturn-type  -ggdb3 -std=c++11 -fPIC -fdiagnostics-color=always   -fPIC -MD -MT plugin/cpp/CMakeFiles/transport-plugin.dir/Logging.cpp.o -MF plugin/cpp/CMakeFiles/transport-plugin.dir/Logging.cpp.o.d -o plugin/cpp/CMakeFiles/transport-plugin.dir/Logging.cpp.o -c /var/tmp/portage/net-im/spectrum2-2.1.3-r1/work/spectrum2-2.1.3/plugin/cpp/Logging.cpp
In file included from /usr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp:22,
                 from /usr/include/boost/smart_ptr/detail/yield_k.hpp:23,
                 from /usr/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp:14,
                 from /usr/include/boost/smart_ptr/detail/spinlock.hpp:42,
                 from /usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:25,
                 from /usr/include/boost/smart_ptr/shared_ptr.hpp:29,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /usr/include/boost/program_options/options_description.hpp:16,
                 from /usr/include/boost/program_options.hpp:15,
                 from /var/tmp/portage/net-im/spectrum2-2.1.3-r1/work/spectrum2-2.1.3/include/transport/Config.h:23,
                 from /var/tmp/portage/net-im/spectrum2-2.1.3-r1/work/spectrum2-2.1.3/plugin/cpp/Logging.cpp:22:
/usr/include/boost/bind.hpp:36:1: note: ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’
   36 | BOOST_PRAGMA_MESSAGE(
      | ^~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/net-im/spectrum2-2.1.3-r1/work/spectrum2-2.1.3/plugin/cpp/Logging.cpp: In function ‘void Transport::Logging::initLogging(Transport::Config*, std::string, bool)’:
/var/tmp/portage/net-im/spectrum2-2.1.3-r1/work/spectrum2-2.1.3/plugin/cpp/Logging.cpp:103:92: error: no matching function for call to ‘log4cxx::ConsoleAppender::ConsoleAppender(log4cxx::PatternLayout*)’
  103 |                 root->addAppender(new ConsoleAppender(new PatternLayout("%d %-5p %c: %m%n")));
      |                                                                                            ^
In file included from /var/tmp/portage/net-im/spectrum2-2.1.3-r1/work/spectrum2-2.1.3/include/transport/Logging.h:31,
                 from /var/tmp/portage/net-im/spectrum2-2.1.3-r1/work/spectrum2-2.1.3/plugin/cpp/Logging.cpp:21:
/usr/include/log4cxx/consoleappender.h:63:17: note: candidate: ‘log4cxx::ConsoleAppender::ConsoleAppender(const log4cxx::LayoutPtr&, const log4cxx::LogString&)’
   63 |                 ConsoleAppender(const LayoutPtr& layout, const LogString& target);
      |                 ^~~~~~~~~~~~~~~
/usr/include/log4cxx/consoleappender.h:63:17: note:   candidate expects 2 arguments, 1 provided
/usr/include/log4cxx/consoleappender.h:55:17: note: candidate: ‘log4cxx::ConsoleAppender::ConsoleAppender(const log4cxx::LayoutPtr&)’
   55 |                 ConsoleAppender(const LayoutPtr& layout);
      |                 ^~~~~~~~~~~~~~~
/usr/include/log4cxx/consoleappender.h:55:50: note:   no known conversion for argument 1 from ‘log4cxx::PatternLayout*’ to ‘const log4cxx::LayoutPtr&’ {aka ‘const std::shared_ptr<log4cxx::Layout>&’}
   55 |                 ConsoleAppender(const LayoutPtr& layout);
      |                                 ~~~~~~~~~~~~~~~~~^~~~~~
/usr/include/log4cxx/consoleappender.h:48:17: note: candidate: ‘log4cxx::ConsoleAppender::ConsoleAppender()’
   48 |                 ConsoleAppender();
      |                 ^~~~~~~~~~~~~~~
/usr/include/log4cxx/consoleappender.h:48:17: note:   candidate expects 0 arguments, 1 provided
/var/tmp/portage/net-im/spectrum2-2.1.3-r1/work/spectrum2-2.1.3/plugin/cpp/Logging.cpp:126:24: error: cannot convert ‘log4cxx::helpers::FileInputStream*’ to ‘log4cxx::helpers::InputStreamPtr’ {aka ‘std::shared_ptr<log4cxx::helpers::InputStream>’}
  126 |                 p.load(istream);
      |                        ^~~~~~~
      |                        |
      |                        log4cxx::helpers::FileInputStream*

Full build log: build.log. Let me know if I can grab more info, thanks!

vitalyster commented 1 year ago

Which latest version worked before? I'm not sure I tested anything after 0.11

ConiKost commented 1 year ago

Version before, which was working, was 0.11, see: https://packages.gentoo.org/packages/dev-libs/log4cxx

vitalyster commented 1 year ago

Well, log4cxx break backward compatibility but we need to be compatible with old versions. You can use Debian patches, it seems they fix both log4cxx 0.12+ and swiften 5.0+ issues - https://salsa.debian.org/xmpp-team/spectrum2/-/tree/master/debian/patches

ConiKost commented 1 year ago

Well, log4cxx break backward compatibility but we need to be compatible with old versions.

I am not sure, why you need? Can't be this added for new releases?

vitalyster commented 1 year ago

Because we need to run Spectrum on Debian stable and other non-rolling distros

ConiKost commented 1 year ago

I am not sure, if you are aware, that Debian 12 will be released summer 2023 and includes log4cxx 1.0.0? I think, it would be a could idea, if somehow both versions could be supported. Maybe some compile flag?

vitalyster commented 1 year ago

Sure, we had in the past a lot of #ifdefs to support both Swiften 2 and 4. Right now we need the same for Swiften 4/5, log4cxx 0.11/1.0.0. When Debian stable with log4cxx 1.0 will be released we actually can stop support older versions, but not right now.