Boost logo

Boost :

Subject: [boost] [Log] Problem with attributes + gcc -fvisibility=hidden
From: Tony Astolfi (tastolfi_at_[hidden])
Date: 2010-04-05 12:57:31


I'm evaluating boost::log for use in a project I'm working on, and I found a
potential issue.

If I compile my program using gcc with the '-fvisibility=hidden' option
enabled, then some log event attributes don't show up in the output. For
example:

#include <boost/log/attributes/clock.hpp>
#include <boost/log/common.hpp>
#include <boost/log/utility/init/to_console.hpp>

int main ()
{
    boost::log::init_log_to_console(
        std::cout,
        boost::log::keywords::format = "[%TimeStamp%] %_%"
    );

    boost::log::core::get()->add_global_attribute(
        "TimeStamp", boost::make_shared< boost::log::attributes::local_clock
>()
    );

    boost::log::sources::logger l;

    BOOST_LOG( l ) << "Error!";

    return 0;
}

Output:

% g++ main.cpp -I../../../glnxa64/include -L../../../glnxa64/lib -lboost_log
-lboost_system -lboost_log_setup && ./a.out
[2010-Apr-05 12:39:14.872961] Error!

% g++ main.cpp -I../../../glnxa64/include -L../../../glnxa64/lib -lboost_log
-lboost_system -lboost_log_setup -fvisibility=hidden && ./a.out
[] Error!

I've found issues like this in the past caused by boost libraries not
marking certain types as export-visibility, resulting in a failure later on
to match two type-id objects that ought to be identical.

Could something like this be happening in the recently accepted Boost.Log
library? Is this something the author would be interested in
fixing/supporting?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk