Subject: Re: [boost] [log] Boost.Log formal review closing down
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-03-21 12:54:05


----- Original Message -----
From: "vicente.botet" <vicente.botet_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, March 18, 2010 11:14 PM
Subject: Re: [boost] [log] Boost.Log formal review closing down

>
>
> ----- Original Message -----
> From: "Andrey Semashev" <andrey.semashev_at_[hidden]>
> To: <boost_at_[hidden]>
> Sent: Thursday, March 18, 2010 8:24 PM
> Subject: Re: [boost] [log] Boost.Log formal review closing down
>
>
>>
>> On 03/18/2010 10:12 PM, Zachary Turner wrote:
>>>>>>> It is the Message Compiler. It is required for the Event Log backend on
>>>>>>> Windows.
>>>>>>
>>>>>> Could this be used conditionaly?
>>>>>
>>>>> Not right now, I'm afraid. But I have plans of improving configurability
>>>>> of the library.
>>>>
>>>> Great. Let me know when the library will be able to run on platforms not
>>>> supporting wide chars, without dependencies to external tools (mc) and in
>>>> single thread.
>>
>> You already can disable wide character support.
>
> Can you tell me how? Do I need to download a new version?
>
> I have placed the log file on the directory for /boost_1_41_0
>
> I do
>
> $ bjam --with-log threading=multi define=BOOST_LOG_USE_CHAR > mt.2.log
> lib.jam: No such file or directory
>
> The Jamfile on build contains
> import lib
> that seems to fail.
>
> Next, here it is the log:
> gcc.compile.c++ ../../../bin.v2/libs/log/test/util_string_literal.test/gcc-3.4.4/debug/threading-multi/run/util_string_literal.o
> run\util_string_literal.cpp: In member function `void string_literal_ctors::test_method()':
> run\util_string_literal.cpp:48: error: `wstring_literal' is not a member of `logging'
>
> I have needed to add all the lines following //BUG WCHAR
>
> ***********************************************
> //BUG WCHAR
> #ifdef BOOST_LOG_USE_WCHAR_T
> // Copying
> {
> logging::wstring_literal lit1 = L"Hello";
> logging::wstring_literal lit2 = lit1;
> BOOST_CHECK(wcscmp(lit2.c_str(), L"Hello") == 0);
> BOOST_CHECK(wcscmp(lit1.c_str(), lit2.c_str()) == 0);
> }
> //BUG WCHAR
> #endif
> // Generator functions
> {
> logging::string_literal lit1 = logging::str_literal("Wow!");
> BOOST_CHECK(strcmp(lit1.c_str(), "Wow!") == 0);
>
> //BUG WCHAR
> #ifdef BOOST_LOG_USE_WCHAR_T
> logging::wstring_literal lit2 = logging::str_literal(L"Wow!");
> BOOST_CHECK(wcscmp(lit2.c_str(), L"Wow!") == 0);
> //BUG WCHAR
> #endif
> ***********************************************
>
> More errors
> gcc.compile.c++ ../../../bin.v2/libs/log/build/gcc-3.4.4/debug/threading-multi/code_conversion.o
> In file included from C:\cygwin\boost_1_41_0\libs\log\src\code_conversion.cpp:20:
> ../../../boost/log/detail/code_conversion.hpp:107: error: variable or field `code_convert' declared void
>
> I have needed to add all the lines following //BUG WCHAR
>
> ***********************************************
> // BUG WCHAR
> #ifdef BOOST_LOG_USE_WCHAR_T
> //! The function converts one string to the character type of another
> inline void code_convert(std::wstring const& str1, std::string& str2)
> {
> converting_ostringstreambuf< wchar_t > buf(str2);
> buf.sputn(str1.data(), static_cast< std::streamsize >(str1.size()));
> buf.pubsync();
> }
> //! The function converts one string to the character type of another
> inline void code_convert(std::wstring const& str1, std::wstring& str2)
> {
> str2 = str1;
> }
> //! The function converts one string to the character type of another
> inline void code_convert(std::string const& str1, std::wstring& str2)
> {
> converting_ostringstreambuf< char > buf(str2);
> buf.sputn(str1.data(), static_cast< std::streamsize >(str1.size()));
> buf.pubsync();
> }
> // BUG WCHAR
> #endif
>
> //! The function converts the passed string to the narrow-character encoding
> inline std::string const& to_narrow(std::string const& str)
> {
> return str;
> }
>
> // BUG WCHAR
> #ifdef BOOST_LOG_USE_WCHAR_T
> //! The function converts the passed string to the narrow-character encoding
> inline std::string to_narrow(std::wstring const& str)
> {
> std::string res;
> aux::code_convert(str, res);
> return res;
> }
>
> //! The function converts the passed string to the wide-character encoding
> inline std::wstring const& to_wide(std::wstring const& str)
> {
> return str;
> }
>
> //! The function converts the passed string to the wide-character encoding
> inline std::wstring to_wide(std::string const& str)
> {
> std::wstring res;
> aux::code_convert(str, res);
> return res;
> }
> // BUG WCHAR
> #endif
> ***********************************************
> More
> gcc.compile.c++ ../../../bin.v2/libs/log/build/gcc-3.4.4/debug/threading-multi/text_file_backend.o
> C:\cygwin\boost_1_41_0\libs\log\src\text_file_backend.cpp:150: error: ISO C++ forbids declaration of `wstring' with no type
> C:\cygwin\boost_1_41_0\libs\log\src\text_file_backend.cpp:150: error: invalid use of `::'
>
> ***********************************************
> //BUG WCHAR
> #ifdef BOOST_LOG_USE_WCHAR_T
> template< >
> struct file_char_traits< wchar_t >
> {
> typedef wchar_t char_type;
>
> static const char_type percent = L'%';
> static const char_type number_placeholder = L'N';
> static const char_type day_placeholder = L'd';
> static const char_type month_placeholder = L'm';
> static const char_type year_placeholder = L'y';
> static const char_type full_year_placeholder = L'Y';
> static const char_type frac_sec_placeholder = L'f';
> static const char_type seconds_placeholder = L'S';
> static const char_type minutes_placeholder = L'M';
> static const char_type hours_placeholder = L'H';
> static const char_type space = L' ';
> static const char_type plus = L'+';
> static const char_type minus = L'-';
> static const char_type zero = L'0';
> static const char_type dot = L'.';
> static const char_type newline = L'\n';
>
> static bool is_digit(wchar_t c) { return (iswdigit(c) != 0); }
> static std::wstring default_file_name_pattern() { return L"%5N.log"; }
> };
> #ifndef BOOST_LOG_BROKEN_STATIC_CONSTANTS_LINKAGE
> const file_char_traits< wchar_t >::char_type file_char_traits< wchar_t >::percent;
> const file_char_traits< wchar_t >::char_type file_char_traits< wchar_t >::number_placeholder;
> const file_char_traits< wchar_t >::char_type file_char_traits< wchar_t >::day_placeholder;
> const file_char_traits< wchar_t >::char_type file_char_traits< wchar_t >::month_placeholder;
> const file_char_traits< wchar_t >::char_type file_char_traits< wchar_t >::year_placeholder;
> const file_char_traits< wchar_t >::char_type file_char_traits< wchar_t >::full_year_placeholder;
> const file_char_traits< wchar_t >::char_type file_char_traits< wchar_t >::frac_sec_placeholder;
> const file_char_traits< wchar_t >::char_type file_char_traits< wchar_t >::seconds_placeholder;
> const file_char_traits< wchar_t >::char_type file_char_traits< wchar_t >::minutes_placeholder;
> const file_char_traits< wchar_t >::char_type file_char_traits< wchar_t >::hours_placeholder;
> const file_char_traits< wchar_t >::char_type file_char_traits< wchar_t >::space;
> const file_char_traits< wchar_t >::char_type file_char_traits< wchar_t >::plus;
> const file_char_traits< wchar_t >::char_type file_char_traits< wchar_t >::minus;
> const file_char_traits< wchar_t >::char_type file_char_traits< wchar_t >::zero;
> const file_char_traits< wchar_t >::char_type file_char_traits< wchar_t >::dot;
> const file_char_traits< wchar_t >::char_type file_char_traits< wchar_t >::newline;
> #endif // BOOST_LOG_BROKEN_STATIC_CONSTANTS_LINKAGE
> //BUG WCHAR
> #endif
> ***********************************************
>
> I have added in file prologue.hpp
>
> //BUG WCHAR
> #ifdef BOOST_NO_STD_WSTRING
> //BUG WCHAR
> # undef BOOST_LOG_USE_WCHAR_T
> //BUG WCHAR
> #endif
>
> So the user don't needs to state that he wants only use CHAR when WCHAR is not available.
>
> =========================
>
> After modifying these files:
>
> gcc.compile.c++ ../../../bin.v2/libs/log/build/gcc-3.4.4/debug/threading-multi/syslog_backend.o
> In file included from ../../../boost/asio/detail/io_control.hpp:25,
> from ../../../boost/asio/socket_base.hpp:25,
> from C:\cygwin\boost_1_41_0\libs\log\src\syslog_backend.cpp:25:
> ../../../boost/asio/detail/socket_types.hpp:37:5: warning: #warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.
> ../../../boost/asio/detail/socket_types.hpp:38:5: warning: #warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line.
> ../../../boost/asio/detail/socket_types.hpp:39:5: warning: #warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).
> ../../../boost/asio/detail/socket_types.hpp:73:5: #error You must add -D__USE_W32_SOCKETS to your compiler options.
> In file included from ../../../boost/asio/detail/socket_types.hpp:79,
> from ../../../boost/asio/detail/io_control.hpp:25,
> from ../../../boost/asio/socket_base.hpp:25,
> from C:\cygwin\boost_1_41_0\libs\log\src\syslog_backend.cpp:25:
> /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:103:2: warning: #warning "fd_set and associated macros have been defined in sys/types. This may cause runtime problems with W32 sockets"
> In file included from ../../../boost/asio/detail/socket_types.hpp:79,
> from ../../../boost/asio/detail/io_control.hpp:25,
> from ../../../boost/asio/socket_base.hpp:25,
> from C:\cygwin\boost_1_41_0\libs\log\src\syslog_backend.cpp:25:
> /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:635: error: declaration of C function `int gethostname(char*, int)' conflicts with
> /usr/include/sys/unistd.h:206: error: previous declaration `int gethostname(char*, size_t)' here
> In file included from ../../../boost/asio/detail/fd_set_adapter.hpp:25,
> from ../../../boost/asio/detail/select_reactor.hpp:32,
> from ../../../boost/asio/impl/io_service.ipp:27,
> from ../../../boost/asio/io_service.hpp:641,
> from C:\cygwin\boost_1_41_0\libs\log\src\syslog_backend.cpp:26:
> ../../../boost/asio/detail/win_fd_set_adapter.hpp: In member function `bool boost::asio::detail::win_fd_set_adapter::is_set(boost::asio::detail::socket_type) const':
> ../../../boost/asio/detail/win_fd_set_adapter.hpp:56: error: `__WSAFDIsSet' undeclared (first use this function)
> ../../../boost/asio/detail/win_fd_set_adapter.hpp:56: error: (Each undeclared identifier is reported only once for each function it appears in.)
>
>
> I have comment
> #syslog_backend.cpp
>
> =================
> Next
>
> gcc.compile.c++ ../../../bin.v2/libs/log/build/gcc-3.4.4/debug/threading-multi/trivial.o
> ../../../boost/log/formatters/wrappers.hpp: In instantiation of `boost::log_mt_posix::formatters::wrap_if<char, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::mpl::not_<boost::log_mt_posix::formatters::is_formatter<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >':
> ../../../boost/log/formatters/wrappers.hpp:148: instantiated from `boost::log_mt_posix::formatters::wrap_if_not_formatter<char, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >'
> C:\cygwin\boost_1_41_0\libs\log\src\trivial.cpp:134: instantiated from here
> ../../../boost/log/formatters/wrappers.hpp:141: error: base `boost::log_mt_posix::formatters::wrap_if_c<char, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, true>' with only non-default constructor in class without a constructor
> ../../../boost/log/formatters/wrappers.hpp: In instantiation of `boost::log_mt_posix::formatters::wrap_if_not_formatter<char, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >':
> C:\cygwin\boost_1_41_0\libs\log\src\trivial.cpp:134: instantiated from here
> ../../../boost/log/formatters/wrappers.hpp:148: error: base `boost::log_mt_posix::formatters::wrap_if<char, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::mpl::not_<boost::log_mt_posix::formatters::is_formatter<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >' with only non-default constructor in class without a constructor
> C:\cygwin\boost_1_41_0\libs\log\src\trivial.cpp: In function `void boost::log_mt_posix::trivial::aux::init()':
> C:\cygwin\boost_1_41_0\libs\log\src\trivial.cpp:134: error: no match for 'operator<<' in 'boost::log_mt_posix::formatters::stream_placeholder<CharT>::operator<<(const T&) const [with T = boost::log_mt_posix::formatters::fmt_attr<char, unsigned int, boost::log_mt_posix::formatters::throw_policy>, CharT = char](((const boost::log_mt_posix::formatters::fmt_attr<char, unsigned int, boost::log_mt_posix::formatters::throw_policy>&)((const boost::log_mt_posix::formatters::fmt_attr<char, unsigned int, boost::log_mt_posix::formatters::throw_policy>*)(&boost::log_mt_posix::formatters::attr(const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&) [with AttributeValueTypesT = unsigned int]())))) << " ["'
>
> Here I have stopped for cygcin-gcc-3.4, as I don't thisk this is related toWCHAR.
>
> As you can say your library was not able to work only with CHAR on cygcin-gcc-3.4.
>
> Let me know if you want we continue to remove the other compile errors.
>
>>> Unless I'm mistaken, you can already use it without dependency on external
>>> tools if you're not using the event log backend. If you are using the event
>>> log backend, the the mc compiler isn't a requirement of boost.log, it's a
>>> requirement of windows itself so I don't see any obvious ways around it.
>>
>> Well, order to build without mc, the event log sink would have to be
>> removed from the Jamfile.
>
> Can you tell me how? I didn't see which define is needed to do that. Do I need to download a new version?

Andrey,

I would like to be able to compile Boost.Log. Please could you see what you can do?

Thanks,
Vicente