You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by "Miranda, Russel" <ru...@lmco.com> on 2021/06/24 20:59:29 UTC

log4cxx build issue on Centos 7.6

Dear log4cxx developers,

I am trying to build log4cxx on a Centos 7.6 system, using:
* CMake 3.13.4,
* g++ 4.8.5
* Boost 1.53.0
* apr-1.6.2
* apr-devel-1.6.2
* apr-util-1.6.0
* apr-util-devel-1.6.0

But I am not having much success. The CMake appears to run without error, excluding the JAVA pieces (we should be OK to skip those tests): 

[build (test-v0.12.0 %)]$ cmake3 ..
-- Found APR: -L/usr/lib64;-lapr-1
-- Boost version: 1.53.0
-- Found the following Boost libraries:
--   thread
--   chrono
--   system
--   date_time
--   atomic
-- Could NOT find Java (missing: Java_JAVAC_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVADOC_EXECUTABLE Java_JAVAH_EXECUTABLE Development) (found version "1.8.0.201")
--
--
-- log4cxx configuration summary:
--
--   Build shared library ............ : ON
--   Build tests ..................... : ON
--   Build site ...................... : OFF
--   Install prefix .................. : /usr/local
--   C++ compiler .................... : /usr/bin/c++
--   log4cxx char API ................ : utf-8
--   log4cxx wchar API ............... : ON
--   log4cxx unichar API ............. : OFF
--   logchar type .................... : utf-8
--   charset ......................... : locale
--   Using libESMTP .................. : OFF
--   ODBC library .................... : OFF
--   syslog .......................... : ON
--   Qt support ...................... : OFF
--   shared_mutex implementation ..... :
-- Applications required for tests:
--   zip ............................. : /usr/bin/zip
--   sed ............................. : /usr/bin/sed
--   gzip ............................ : /usr/bin/gzip
-- Configuring done
-- Generating done
-- Build files have been written to: /home/shared/ramirand/git2/oamlog4cxx/log4cxx/build

... but then the build runs into errors:

[build (test-v0.12.0 %)]$ make
Checking configuration
[  0%] Built target configure_log4cxx
Scanning dependencies of target log4cxx
[  1%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/action.cpp.o
In file included from /home/shared/ramirand/git2/oamlog4cxx/log4cxx/src/main/cpp/action.cpp:18:0:
/home/shared/ramirand/git2/oamlog4cxx/log4cxx/src/main/include/log4cxx/rolling/action.h:51:3: error: 'mutex' in namespace 'std' does not name a type
   std::mutex mutex;
   ^
/home/shared/ramirand/git2/oamlog4cxx/log4cxx/src/main/cpp/action.cpp: In member function 'void log4cxx::rolling::Action::run(log4cxx::helpers::Pool&)':
/home/shared/ramirand/git2/oamlog4cxx/log4cxx/src/main/cpp/action.cpp:43:36: error: 'mutex' was not declared in this scope
  std::unique_lock<std::mutex> lock(mutex);
                                    ^
/home/shared/ramirand/git2/oamlog4cxx/log4cxx/src/main/cpp/action.cpp:43:36: note: suggested alternative:
In file included from /home/shared/ramirand/git2/oamlog4cxx/log4cxx/src/main/cpp/action.cpp:19:0:
/usr/include/c++/4.8.2/mutex:117:9: note:   'std::mutex'
   class mutex : private __mutex_base
         ^
/home/shared/ramirand/git2/oamlog4cxx/log4cxx/src/main/cpp/action.cpp: In member function 'void log4cxx::rolling::Action::close()':
/home/shared/ramirand/git2/oamlog4cxx/log4cxx/src/main/cpp/action.cpp:66:36: error: 'mutex' was not declared in this scope
  std::unique_lock<std::mutex> lock(mutex);
                                    ^
/home/shared/ramirand/git2/oamlog4cxx/log4cxx/src/main/cpp/action.cpp:66:36: note: suggested alternative:
In file included from /home/shared/ramirand/git2/oamlog4cxx/log4cxx/src/main/cpp/action.cpp:19:0:
/usr/include/c++/4.8.2/mutex:117:9: note:   'std::mutex'
   class mutex : private __mutex_base
         ^
make[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/action.cpp.o] Error 1
make[1]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/all] Error 2
make: *** [all] Error 2
[build (test-v0.12.0 %)]$


I've tried with and without adding CMAKE_CXX_FLAGS=-std=c++11, with no discernable effect.

I've tried guessing where to drop some "#include <mutex>" lines, and if I do that, the build heads straight into problems with shared_mutex (which it should be getting from Boost) instead.

I noticed that in CMakeCache.txt, it has detected STD_MUTEX_FOUND:INTERNAL=TRUE, but Boost_SHARED_MUTEX_FOUND:INTERAL=FALSE:

[build (test-v0.12.0 %)]$ grep -i mutex CMakeCache.txt
Boost_MUTEX_FOUND:INTERNAL=FALSE
Boost_SHARED_MUTEX_FOUND:INTERNAL=FALSE
STD_MUTEX_FOUND:INTERNAL=TRUE
STD_SHARED_MUTEX_FOUND:INTERNAL=FALSE
[build (test-v0.12.0 %)]$

This seems wrong, since it appeared that CMake had correctly detected that Boost 1.5.3 (with thread) is installed.

Is it possible that CMake might detect Boost thread is there, but still silently fail the test compile?
How can I determine what is causing it not to detect the Boost::shared_mutex implementation?
Has anyone successfully built log4cxx 0.12.0 on Centos 7.6?

Based on the release notes, I thought we'd be able to build 0.12.0, because g++ 4.8.5 should support C++11, and we do have Boost for shared_mutex.
I know g++ 4.8.5 is old, but upgrading that isn't likely to be feasible for us in the short term, so I'd like to try to get it to build.

Any assistance would be greatly appreciated. We're on log4cxx 0.10.0 now, and there are a number of bug fixes we'd like to have.

Thanks,

Russ Miranda


Re: log4cxx build issue on Centos 7.6

Posted by Robert Middleton <rm...@apache.org>.
Russ,

> I've tried guessing where to drop some "#include <mutex>" lines, and if I do that, the build heads straight into problems with shared_mutex (which it should be getting from Boost) instead.

If you could provide a patch/PR for that, that would be great - GCC
likes to move things around headers sometimes, so things may not
always compile with different versions. :(

Anyway, if you look at the configuration output, you'll see the following:

> -- log4cxx configuration summary:
> <snip>
> --   shared_mutex implementation ..... :

That should print out either std::shared_mutex, or
boost::shared_mutex.  That would match with what you're seeing on the
output with the variables being defined as they are.

According to the Boost documentation, shared_mutex should be available
with version 1.53.  If you look at the log4cxx sources, you can try
compiling src/cmake/boost-fallback/test-boostsharedmutex.cpp and see
if it fails.  If it compiles properly, there may just be a bug with
the detection of boost.  Otherwise perhaps boost isn't compiled with
needed support for shared_mutex?

-Robert Middleton

On Thu, Jun 24, 2021 at 4:59 PM Miranda, Russel <ru...@lmco.com> wrote:
>
> Dear log4cxx developers,
>
> I am trying to build log4cxx on a Centos 7.6 system, using:
> * CMake 3.13.4,
> * g++ 4.8.5
> * Boost 1.53.0
> * apr-1.6.2
> * apr-devel-1.6.2
> * apr-util-1.6.0
> * apr-util-devel-1.6.0
>
> But I am not having much success. The CMake appears to run without error, excluding the JAVA pieces (we should be OK to skip those tests):
>
> [build (test-v0.12.0 %)]$ cmake3 ..
> -- Found APR: -L/usr/lib64;-lapr-1
> -- Boost version: 1.53.0
> -- Found the following Boost libraries:
> --   thread
> --   chrono
> --   system
> --   date_time
> --   atomic
> -- Could NOT find Java (missing: Java_JAVAC_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVADOC_EXECUTABLE Java_JAVAH_EXECUTABLE Development) (found version "1.8.0.201")
> --
> --
> -- log4cxx configuration summary:
> --
> --   Build shared library ............ : ON
> --   Build tests ..................... : ON
> --   Build site ...................... : OFF
> --   Install prefix .................. : /usr/local
> --   C++ compiler .................... : /usr/bin/c++
> --   log4cxx char API ................ : utf-8
> --   log4cxx wchar API ............... : ON
> --   log4cxx unichar API ............. : OFF
> --   logchar type .................... : utf-8
> --   charset ......................... : locale
> --   Using libESMTP .................. : OFF
> --   ODBC library .................... : OFF
> --   syslog .......................... : ON
> --   Qt support ...................... : OFF
> --   shared_mutex implementation ..... :
> -- Applications required for tests:
> --   zip ............................. : /usr/bin/zip
> --   sed ............................. : /usr/bin/sed
> --   gzip ............................ : /usr/bin/gzip
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/shared/ramirand/git2/oamlog4cxx/log4cxx/build
>
> ... but then the build runs into errors:
>
> [build (test-v0.12.0 %)]$ make
> Checking configuration
> [  0%] Built target configure_log4cxx
> Scanning dependencies of target log4cxx
> [  1%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/action.cpp.o
> In file included from /home/shared/ramirand/git2/oamlog4cxx/log4cxx/src/main/cpp/action.cpp:18:0:
> /home/shared/ramirand/git2/oamlog4cxx/log4cxx/src/main/include/log4cxx/rolling/action.h:51:3: error: 'mutex' in namespace 'std' does not name a type
>    std::mutex mutex;
>    ^
> /home/shared/ramirand/git2/oamlog4cxx/log4cxx/src/main/cpp/action.cpp: In member function 'void log4cxx::rolling::Action::run(log4cxx::helpers::Pool&)':
> /home/shared/ramirand/git2/oamlog4cxx/log4cxx/src/main/cpp/action.cpp:43:36: error: 'mutex' was not declared in this scope
>   std::unique_lock<std::mutex> lock(mutex);
>                                     ^
> /home/shared/ramirand/git2/oamlog4cxx/log4cxx/src/main/cpp/action.cpp:43:36: note: suggested alternative:
> In file included from /home/shared/ramirand/git2/oamlog4cxx/log4cxx/src/main/cpp/action.cpp:19:0:
> /usr/include/c++/4.8.2/mutex:117:9: note:   'std::mutex'
>    class mutex : private __mutex_base
>          ^
> /home/shared/ramirand/git2/oamlog4cxx/log4cxx/src/main/cpp/action.cpp: In member function 'void log4cxx::rolling::Action::close()':
> /home/shared/ramirand/git2/oamlog4cxx/log4cxx/src/main/cpp/action.cpp:66:36: error: 'mutex' was not declared in this scope
>   std::unique_lock<std::mutex> lock(mutex);
>                                     ^
> /home/shared/ramirand/git2/oamlog4cxx/log4cxx/src/main/cpp/action.cpp:66:36: note: suggested alternative:
> In file included from /home/shared/ramirand/git2/oamlog4cxx/log4cxx/src/main/cpp/action.cpp:19:0:
> /usr/include/c++/4.8.2/mutex:117:9: note:   'std::mutex'
>    class mutex : private __mutex_base
>          ^
> make[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/action.cpp.o] Error 1
> make[1]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/all] Error 2
> make: *** [all] Error 2
> [build (test-v0.12.0 %)]$
>
>
> I've tried with and without adding CMAKE_CXX_FLAGS=-std=c++11, with no discernable effect.
>
> I've tried guessing where to drop some "#include <mutex>" lines, and if I do that, the build heads straight into problems with shared_mutex (which it should be getting from Boost) instead.
>
> I noticed that in CMakeCache.txt, it has detected STD_MUTEX_FOUND:INTERNAL=TRUE, but Boost_SHARED_MUTEX_FOUND:INTERAL=FALSE:
>
> [build (test-v0.12.0 %)]$ grep -i mutex CMakeCache.txt
> Boost_MUTEX_FOUND:INTERNAL=FALSE
> Boost_SHARED_MUTEX_FOUND:INTERNAL=FALSE
> STD_MUTEX_FOUND:INTERNAL=TRUE
> STD_SHARED_MUTEX_FOUND:INTERNAL=FALSE
> [build (test-v0.12.0 %)]$
>
> This seems wrong, since it appeared that CMake had correctly detected that Boost 1.5.3 (with thread) is installed.
>
> Is it possible that CMake might detect Boost thread is there, but still silently fail the test compile?
> How can I determine what is causing it not to detect the Boost::shared_mutex implementation?
> Has anyone successfully built log4cxx 0.12.0 on Centos 7.6?
>
> Based on the release notes, I thought we'd be able to build 0.12.0, because g++ 4.8.5 should support C++11, and we do have Boost for shared_mutex.
> I know g++ 4.8.5 is old, but upgrading that isn't likely to be feasible for us in the short term, so I'd like to try to get it to build.
>
> Any assistance would be greatly appreciated. We're on log4cxx 0.10.0 now, and there are a number of bug fixes we'd like to have.
>
> Thanks,
>
> Russ Miranda
>