Skip to content

compile failure with AsyncBuffer #563

@rm5248

Description

@rm5248

It's not immediatetly obvious to me as to why this is broken, but g++ 12.2 on Debian doesn't compile cleanly:

robert@debian:~/logging-log4cxx/build$ cmake ..
-- The CXX compiler identification is GNU 12.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.1") 
-- Checking for module 'apr-1'
--   Found apr-1, version 1.7.2
-- Found APR: /usr/lib/x86_64-linux-gnu/libapr-1.so  
-- Checking for module 'apr-util-1'
--   Found apr-util-1, version 1.6.3
-- Found APR-Util: /usr/lib/x86_64-linux-gnu/libaprutil-1.so;/usr/lib/x86_64-linux-gnu/libldap.so;/usr/lib/x86_64-linux-gnu/liblber.so  
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Looking for C++ include locale
-- Looking for C++ include locale - found
-- Looking for mbsrtowcs
-- Looking for mbsrtowcs - found
-- Looking for wcstombs
-- Looking for wcstombs - found
-- Looking for fwide
-- Looking for fwide - found
-- Looking for syslog
-- Looking for syslog - found
-- Looking for pthread_sigmask
-- Looking for pthread_sigmask - found
-- Looking for pthread_self
-- Looking for pthread_self - found
-- 
-- 
-- Log4cxx configuration summary:
-- 
--   C++ compiler .................... : /usr/bin/c++
--   C++ features requested: ......... : 20
--   Build shared library ............ : ON
--   Build tests ..................... : ON
--   Build examples................... : ON
--   Build fuzzers.................... : OFF
--   Build site ...................... : OFF
--   Install prefix .................. : /usr/local
--   log4cxx library name ............ : log4cxx
--   log4cxx namespace ............... : log4cxx
--   log4cxx char API ................ : ON
--   log4cxx wchar API ............... : ON
--   log4cxx unichar API ............. : OFF
--   log4cxx char type ............... : utf-8
--   character encoding .............. : utf-8
--   Networking support .............. : ON
--   DOMConfigurator support ......... : ON
--   Qt support ...................... : OFF
--   LOG4CXX_XXXX_ASYNC macros ....... : ON
--   LOG4CXX_XXXX_FMT_ASYNC macros ... : OFF
-- C++ version and Boost settings:
--   Prefer boost: ................... : OFF
--   make_unique implementation :..... : std::make_unique
--   filesystem implementation ....... : std::filesystem
--   format implementation ........... : fmt::format
--   thread_local support? ........... : TRUE
-- Applications required for tests:
--   zip ............................. : /usr/bin/zip
--   sed ............................. : /usr/bin/sed
--   gzip ............................ : /usr/bin/gzip
-- Available appenders:
--   Async Appender .................. : ON
--   ODBC Appender ................... : OFF
--   DB Appender ..................... : ON
--   SMTP Appender ................... : OFF
--   XMLSocketAppender ............... : ON
--   SyslogAppender .................. : ON
--   Using syslog.h .................. : ON
--   TelnetAppender .................. : ON
--   ConsoleAppender ................. : ON
--   FileAppender .................... : ON
--   RollingFileAppender ............. : ON
--   MultiprocessRollingFileAppender . : OFF
-- Available layouts:
--   HTMLLayout ...................... : ON
--   JSONLayout ...................... : ON
--   PatternLayout ................... : ON
--   SimpleLayout .................... : ON
--   XMLLayout ....................... : ON
--   FMTLayout ....................... : OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /home/robert/logging-log4cxx/build
robert@debian:~/logging-log4cxx/build$ make
[  1%] Building CXX object src/main/include/CMakeFiles/log4cxx-include.dir/empty-lib-stub.cpp.o
[  1%] Linking CXX static library liblog4cxx-include.a
[  1%] Built target log4cxx-include
[  1%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/action.cpp.o
[  1%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/andfilter.cpp.o
In file included from /home/robert/logging-log4cxx/src/main/include/log4cxx/logger.h:26,
                 from /home/robert/logging-log4cxx/src/main/include/log4cxx/spi/loggingevent.h:23,
                 from /home/robert/logging-log4cxx/src/main/include/log4cxx/spi/filter.h:23,
                 from /home/robert/logging-log4cxx/src/main/include/log4cxx/filter/andfilter.h:21,
                 from /home/robert/logging-log4cxx/src/main/cpp/andfilter.cpp:18:
/home/robert/logging-log4cxx/src/main/include/log4cxx/helpers/asyncbuffer.h: In member function ‘log4cxx::helpers::AsyncBuffer& log4cxx::helpers::AsyncBuffer::operator<<(const T&)’:
/home/robert/logging-log4cxx/src/main/include/log4cxx/helpers/asyncbuffer.h:87:39: error: static assertion failed: operator<<(std::ostream&) overload must be provided
   87 |                         static_assert(false, "operator<<(std::ostream&) overload must be provided");
      |                                       ^~~~~
/home/robert/logging-log4cxx/src/main/include/log4cxx/helpers/asyncbuffer.h: In member function ‘log4cxx::helpers::AsyncBuffer& log4cxx::helpers::AsyncBuffer::operator<<(const T&&)’:
/home/robert/logging-log4cxx/src/main/include/log4cxx/helpers/asyncbuffer.h:142:39: error: static assertion failed: operator<<(std::ostream&) overload must be provided
  142 |                         static_assert(false, "operator<<(std::ostream&) overload must be provided");
      |                                       ^~~~~
make[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:90: src/main/cpp/CMakeFiles/log4cxx.dir/andfilter.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1352: src/main/cpp/CMakeFiles/log4cxx.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

I can get around the problem by setting the C++ standard to 17

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions