Menu

Compiling Boost.Log version 2.0-r799 with GCC 6.3.0

Help
2017-09-26
2017-09-28
  • Lukasz Walewski

    Lukasz Walewski - 2017-09-26

    Hi,

    I am dealing with an application that has been developed some years ago using Boost version 1.49.0 and Boost.Log version 2.0-r799. In particular it #includes <boost/log/filters.hpp>, which seems to have disappeared already in version 2.0-r800. The Boost libraries, including Boost.Log, plus the application used to be compiled with GCC 4.7.2. I am now porting the whole thing to GCC 6.3.0, which results in the following error when building Boost:

    gcc.compile.c++ bin.v2/libs/log/build/gcc-6.3.0/release/threading-multi/global_logger_storage.o
    In file included from ./boost/log/detail/snprintf.hpp:19:0,
                     from libs/log/src/global_logger_storage.cpp:20:
    ./boost/compatibility/cpp_c_headers/cstdio:17:11: error: ‘::gets’ has not been declared
       using ::gets;
               ^~~~
    

    where the full command line was:

    "g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pthread -fPIC -fno-strict-aliasing -DBOOST_ALL_NO_LIB=1 -DBOOST_CHRONO_DYN_LINK=1 -DBOOST_DATE_TIME_DYN_LINK=1 -DBOOST_FILESYSTEM_DYN_LINK=1 -DBOOST_LOG_BUILDING_THE_LIB=1 -DBOOST_LOG_DLL -DBOOST_LOG_USE_NATIVE_SYSLOG=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_THREAD_BUILD_DLL=1 -DBOOST_THREAD_DONT_USE_CHRONO=1 -DBOOST_THREAD_POSIX -DBOOST_THREAD_USE_DLL=1 -DDATE_TIME_INLINE -DNDEBUG  -I"." -c -o "bin.v2/libs/log/build/gcc-6.3.0/release/threading-multi/global_logger_storage.o" "libs/log/src/global_logger_storage.cpp"
    

    My question is, how to get Boost.Log 2.0-r799 compiled with a modern (C++11) compiler?

    I know I could port the application to the modern version of Boost.Log instead, but I would like to have a reference build of the original source, before I start playing with it (porting to the current Boost version would be the next step then).

    Thanks and regards,
    Lukasz

     
  • Andrey Semashev

    Andrey Semashev - 2017-09-26

    You can probably start by removing boost/compatibility/cpp_c_headers from your include paths. These headers are intended for ancient compilers that don't provide the C-library headers like cstdio. They are not really updated nowdays and do not account for gets removal from C++11.

    You can also try forcing C++03 compatibility by passing -std=c++03 to the compiler. GCC 6 switched to C++14 by defaullt.

     
  • Lukasz Walewski

    Lukasz Walewski - 2017-09-28

    Thanks for the quick answer! Forcing C++03 worked well. I could not give my feedback earlier due to sf going offline. Cheers!

     

Log in to post a comment.