Uploaded image for project: 'Log4cxx'
  1. Log4cxx
  2. LOGCXX-552

Log4cxx 0.12.1 it is not working on windows platform

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 0.12.1
    • 0.12.1
    • Build, Documentation
    • None

    Description

      Hi,

      We want to upgrade log4cxx from 0.11.0 to 0.12.1.
      We have some problems when trying to use log4cxx 0.12.1 on windows platform.
      We succeded to compile it (here steps (we are using c++17)):
      -copy src/main/include/log4cxx/log4cxx.hw to src/main/include/log4cxx/log4cxx.h
      -copy src/main/include/log4cxx/private/log4cxx_private.hw src/main/include/log4cxx/private/log4cxx_private.h
      -we disable odbc by commenting:
          apache-log4cxx-0.12.1\src\main\include\CMakeLists.txt
                          #if(WIN32)
                          #    CHECK_INCLUDE_FILES(sqlext.h HAS_ODBC)
                          #else()
                          #    include(FindPkgConfig)
                          #
                          #    pkg_check_modules( odbc QUIET odbc )
                          #    if(${odbc_FOUND})
                          #        set(HAS_ODBC 1)
                          #    endif(${odbc_FOUND})
                          #endif(WIN32)
      -we use x64 Native Tools Command Prompt for VS 2019 (c++17)
          cmake -S . -B build -G"Visual Studio 16 2019" -A x64 -DAPR_INCLUDE_DIR=path_to_apr\include\apr-1\ -DAPR_LIBRARIES=path_to_apr\lib\libapr-1.lib -DAPR_UTIL_INCLUDE_DIR=path_to_apr-util\include\apr-1\ -DAPR_UTIL_LIBRARIES=path_to_apr-util\lib\libaprutil-1.lib
          -DBUILD_TESTING=OFF -DEXPAT_LIBRARY=path_to_expat\lib\expat.lib -DEXPAT_INCLUDE_DIR=path_to_expat\include
      -open build/log4cxx.sln with VS 2019 and compile it in release mode x64 (with Windows SDK Version 10.0.19041.0)
      -copy from src/main/include all .h files to a different location
      -copy from build/src/main/cpp/Release/ log4cxx dll and lib files to a different location
      -delete build folder
      -in another x64 Native Tools Command Prompt for VS 2019
          cmake -S . -B build -G"Visual Studio 16 2019" -A x64 -DBUILD_SHARED_LIBS=OFF -DAPR_INCLUDE_DIR=path_to_apr\include\apr-1\ -DAPR_LIBRARIES=path_to_apr\lib\libapr-1.lib -DAPR_UTIL_INCLUDE_DIR=path_to_apr-util\include\apr-1\ -DAPR_UTIL_LIBRARIES=path_to_apr-util\lib\libaprutil-1.lib
          -DBUILD_TESTING=OFF -DEXPAT_LIBRARY=path_to_expat\lib\expat.lib -DEXPAT_INCLUDE_DIR=path_to_expat\include
      -open build/log4cxx.sln with VS 2019 and compile it in release mode x64 (with Windows SDK Version 10.0.19041.0 and Code Generation -> Runtime Library -> Multi-threaded(/MT)) 
      -copy build/src/main/cpp/Release/log4cxx.lib to a different location

      When we try to compile a module which is using log4cxx code we get a stack full of errors
      generated from PATH_to_log4cxx_0.12.1\include\log4cxx/logger.h caused by log4cxx::helpers::ObjectPtrT<T>.
      We saw that log4cxx.hw was not updated and we replaced all apparitions of log4cxx::helpers::ObjectPtrT<T>
      with std::shared_ptr<T>. With this we managed to get rid of all that errors, but we have this stack of errors
      generated directly from log4cxx code:

      PATH_to_log4cxx_0.12.1\include\log4cxx/logger.h(105): error C2039: 'LoggerRepositoryWeakPtr': is not a member of 'log4cxx::spi'
      PATH_to_log4cxx_0.12.1\include\log4cxx/logger.h(45): note: see declaration of 'log4cxx::spi'
      PATH_to_log4cxx_0.12.1\include\log4cxx/logger.h(105): error C3646: 'repository': unknown override specifier
      PATH_to_log4cxx_0.12.1\include\log4cxx/logger.h(105): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
      PATH_to_log4cxx_0.12.1\include\log4cxx/logger.h(626): error C2039: 'LoggerRepositoryWeakPtr': is not a member of 'log4cxx::spi'
      PATH_to_log4cxx_0.12.1\include\log4cxx/logger.h(45): note: see declaration of 'log4cxx::spi'
      PATH_to_log4cxx_0.12.1\include\log4cxx/logger.h(626): error C3646: 'getLoggerRepository': unknown override specifier
      PATH_to_log4cxx_0.12.1\include\log4cxx/logger.h(626): error C2059: syntax error: '('
      PATH_to_log4cxx_0.12.1\include\log4cxx/logger.h(626): error C2238: unexpected token(s) preceding ';'
      PATH_to_log4cxx_0.12.1\include\log4cxx/logger.h(1467): error C2039: 'LoggerRepositoryWeakPtr': is not a member of 'log4cxx::spi'
      PATH_to_log4cxx_0.12.1\include\log4cxx/logger.h(45): note: see declaration of 'log4cxx::spi'
      PATH_to_log4cxx_0.12.1\include\log4cxx/logger.h(1467): error C2061: syntax error: identifier 'LoggerRepositoryWeakPtr'
      PATH_to_log4cxx_0.12.1\include\log4cxx/logger.h(1729): error C3646: 'mutex': unknown override specifier
      PATH_to_log4cxx_0.12.1\include\log4cxx/logger.h(1729): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
      PATH_to_log4cxx_0.12.1\include\log4cxx/appenderskeleton.h(77): error C2039: 'shared_mutex': is not a member of 'log4cxx'
      PATH_to_log4cxx_0.12.1\include\log4cxx/appenderskeleton.h(35): note: see declaration of 'log4cxx'
      PATH_to_log4cxx_0.12.1\include\log4cxx/appenderskeleton.h(77): error C3646: 'mutex': unknown override specifier
      PATH_to_log4cxx_0.12.1\include\log4cxx/appenderskeleton.h(77): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
      PATH_to_log4cxx_0.12.1\include\log4cxx/writerappender.h(28): fatal error C1083: Cannot open include file: 'log4cxx/boost-std-configuration.h': No such file or directory

      I mention that we mananged to upgrade succesfully on unix (RHEL 8.3 and Suse 15.2) to log4cxx 0.12.1.
      Also I adapted our code regarding this https://logging.apache.org/log4cxx/latest_stable/changelog.html

      Please patch log4cxx 0.12.1 on windows platform or if there are some step which we are missing/doing wrong when we compile log4cxx 0.12.1 on windows please guide us.

      Can you check if log4cxx.hw needs more changes to fix this or is also a problem elsewhere?

       

      Thanks,
      Stefan Jipa

      Attachments

        Activity

          People

            Unassigned Unassigned
            stefanjipa Stefan Jipa
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: