Unfortunately, still had no luck to link the logging library under linux.

Please find the list of libraires my application links with:

System Libs
=========
pthread rt dl
                
Boost Libs
========
system${boost_suffix}
filesystem${boost_suffix}
date_time${boost_suffix}
program_options${boost_suffix}
chrono${boost_suffix}
thread${boost_suffix}
log${boost_suffix}
log_setup${boost_suffix}


boost_suffix is -mt. Defining the -DBOOST_LOG_DYN_LINK option makes the linker to only miss the logger library symbols. I assume, because everything else is expected to be within the missing implementations....

../libsolver.a(solver_impl.cpp.o): In function `boost::log::v2_mt_posix::record boost::log::v2_mt_posix::sources::basic_composite_logger<char, boost::log::v2_mt_posix::sources::severity_channel_logger_mt<boost::log::v2_mt_posix::trivial::severity_level, std::string>, boost::log::v2_mt_posix::sources::multi_thread_model<boost::log::v2_mt_posix::aux::light_rw_mutex>, boost::log::v2_mt_posix::sources::features<boost::log::v2_mt_posix::sources::severity<boost::log::v2_mt_posix::trivial::severity_level>, boost::log::v2_mt_posix::sources::channel<std::string>, void, void, void, void, void, void, void, void> >::open_record<boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::log::v2_mt_posix::keywords::tag::channel, char const* const>, boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::log::v2_mt_posix::keywords::tag::severity, boost::log::v2_mt_posix::trivial::severity_level const>, boost::parameter::aux::empty_arg_list> > >(boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::log::v2_mt_posix::keywords::tag::channel, char const* const>, boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::log::v2_mt_posix::keywords::tag::severity, boost::log::v2_mt_posix::trivial::severity_level const>, boost::parameter::aux::empty_arg_list> > const&)':
/usr/local/include/boost/log/sources/basic_logger.hpp:457: undefined reference to `boost::log::v2_mt_posix::core::get_logging_enabled() const'
../libsolver.a(solver_impl.cpp.o): In function `~record_pump':
/usr/local/include/boost/log/sources/record_ostream.hpp:278: undefined reference to `boost::log::v2_mt_posix::aux::unhandled_exception_count()'
../libsolver.a(solver_impl.cpp.o): In function `~auto_release':
/usr/local/include/boost/log/sources/record_ostream.hpp:243: undefined reference to `boost::log::v2_mt_posix::aux::stream_provider<char>::release_compound(boost::log::v2_mt_posix::aux::stream_provider<char>::stream_compound*)'
../libsolver.a(solver_impl.cpp.o): In function `boost::log::v2_mt_posix::core::push_record(boost::rv<boost::log::v2_mt_posix::record>&)':
/usr/local/include/boost/log/core/core.hpp:308: undefined reference to `boost::log::v2_mt_posix::core::push_record_move(boost::log::v2_mt_posix::record&)'
../libsolver.a(solver_impl.cpp.o): In function `record_pump':
/usr/local/include/boost/log/sources/record_ostream.hpp:258: undefined reference to `boost::log::v2_mt_posix::aux::stream_provider<char>::allocate_compound(boost::log::v2_mt_posix::record&)'
/usr/local/include/boost/log/sources/record_ostream.hpp:259: undefined reference to `boost::log::v2_mt_posix::aux::unhandled_exception_count()'
../libsolver.a(solver_impl.cpp.o): In function `boost::log::v2_mt_posix::sources::aux::severity_level<boost::log::v2_mt_posix::trivial::severity_level>::set_value(boost::log::v2_mt_posix::trivial::severity_level)':
/usr/local/include/boost/log/sources/severity_feature.hpp:135: undefined reference to `boost::log::v2_mt_posix::sources::aux::get_severity_level()'
../libsolver.a(solver_impl.cpp.o): In function `boost::log::v2_mt_posix::record boost::log::v2_mt_posix::sources::basic_logger<char, boost::log::v2_mt_posix::sources::severity_channel_logger_mt<boost::log::v2_mt_posix::trivial::severity_level, std::string>, boost::log::v2_mt_posix::sources::multi_thread_model<boost::log::v2_mt_posix::aux::light_rw_mutex> >::open_record_unlocked<boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::log::v2_mt_posix::keywords::tag::channel, char const* const>, boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::log::v2_mt_posix::keywords::tag::severity, boost::log::v2_mt_posix::trivial::severity_level const>, boost::parameter::aux::empty_arg_list> > >(boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::log::v2_mt_posix::keywords::tag::channel, char const* const>, boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::log::v2_mt_posix::keywords::tag::severity, boost::log::v2_mt_posix::trivial::severity_level const>, boost::parameter::aux::empty_arg_list> > const&)':
/usr/local/include/boost/log/sources/basic_logger.hpp:260: undefined reference to `boost::log::v2_mt_posix::core::open_record(boost::log::v2_mt_posix::attribute_set const&)'
../libsolver.a(solver_impl.cpp.o): In function `boost::log::v2_mt_posix::attributes::mutable_constant<std::string, void, void, void>::impl::set(std::string const&)':
/usr/local/include/boost/log/attributes/mutable_constant.hpp:258: undefined reference to `boost::log::v2_mt_posix::attribute::impl::operator new(unsigned long)'
/usr/local/include/boost/log/attributes/mutable_constant.hpp:258: undefined reference to `boost::log::v2_mt_posix::attribute::impl::operator delete(void*, unsigned long)'
../libsolver.a(solver_impl.cpp.o): In function `~attribute_value_impl':
/usr/local/include/boost/log/attributes/attribute_value_impl.hpp:47: undefined reference to `boost::log::v2_mt_posix::attribute::impl::operator delete(void*, unsigned long)'
/usr/local/include/boost/log/attributes/attribute_value_impl.hpp:47: undefined reference to `boost::log::v2_mt_posix::attribute::impl::operator delete(void*, unsigned long)'
../libsolver.a(solver_impl.cpp.o): In function `~impl':
/usr/local/include/boost/log/attributes/attribute_value.hpp:74: undefined reference to `boost::log::v2_mt_posix::attribute::impl::operator delete(void*, unsigned long)'
/usr/local/include/boost/log/attributes/attribute_value.hpp:74: undefined reference to `boost::log::v2_mt_posix::attribute::impl::operator delete(void*, unsigned long)'
../libsolver.a(solver_impl.cpp.o):/usr/local/include/boost/log/attributes/attribute.hpp:69: more undefined references to `boost::log::v2_mt_posix::attribute::impl::operator delete(void*, unsigned long)' follow
../libsolver.a(solver_impl.cpp.o): In function `boost::log::v2_mt_posix::record::reset()':
/usr/local/include/boost/log/core/record.hpp:153: undefined reference to `boost::log::v2_mt_posix::record_view::public_data::destroy(boost::log::v2_mt_posix::record_view::public_data const*)'
../libsolver.a(solver_impl.cpp.o): In function `boost::log::v2_mt_posix::aux::lazy_singleton<boost::log::v2_mt_posix::sources::aux::logger_singleton<logger>, boost::shared_ptr<boost::log::v2_mt_posix::sources::aux::logger_holder<boost::log::v2_mt_posix::sources::severity_channel_logger_mt<boost::log::v2_mt_posix::trivial::severity_level, std::string> > > >::get()':
/usr/local/include/boost/log/detail/singleton.hpp:43: undefined reference to `boost::log::v2_mt_posix::aux::once_block_sentry::commit()'
../libsolver.a(solver_impl.cpp.o): In function `boost::log::v2_mt_posix::aux::once_block_sentry::executed() const':
/usr/local/include/boost/log/utility/once_block.hpp:90: undefined reference to `boost::log::v2_mt_posix::aux::once_block_sentry::enter_once_block() const'
../libsolver.a(solver_impl.cpp.o): In function `boost::log::v2_mt_posix::sources::aux::logger_singleton<logger>::init_instance()':
/usr/local/include/boost/log/sources/global_logger_storage.hpp:119: undefined reference to `boost::log::v2_mt_posix::sources::aux::global_storage::get_or_init(std::type_info const&, boost::shared_ptr<boost::log::v2_mt_posix::sources::aux::logger_holder_base> (*)())'
/usr/local/include/boost/log/sources/global_logger_storage.hpp:130: undefined reference to `boost::log::v2_mt_posix::sources::aux::throw_odr_violation(std::type_info const&, std::type_info const&, boost::log::v2_mt_posix::sources::aux::logger_holder_base const&)'
../libsolver.a(solver_impl.cpp.o): In function `~once_block_sentry':
/usr/local/include/boost/log/utility/once_block.hpp:85: undefined reference to `boost::log::v2_mt_posix::aux::once_block_sentry::rollback()'
../libsolver.a(solver_impl.cpp.o): In function `~basic_logger':
/usr/local/include/boost/log/sources/basic_logger.hpp:80: undefined reference to `boost::log::v2_mt_posix::attribute_set::~attribute_set()'
../libsolver.a(solver_impl.cpp.o): In function `boost::log::v2_mt_posix::sources::basic_severity_logger<boost::log::v2_mt_posix::sources::basic_channel_logger<boost::log::v2_mt_posix::sources::basic_logger<char, boost::log::v2_mt_posix::sources::severity_channel_logger_mt<boost::log::v2_mt_posix::trivial::severity_level, std::string>, boost::log::v2_mt_posix::sources::multi_thread_model<boost::log::v2_mt_posix::aux::light_rw_mutex> >, std::string>, boost::log::v2_mt_posix::trivial::severity_level>::basic_severity_logger<boost::parameter::aux::tagged_argument<boost::log::v2_mt_posix::keywords::tag::channel, char const [7]> >(boost::parameter::aux::tagged_argument<boost::log::v2_mt_posix::keywords::tag::channel, char const [7]> const&)':
/usr/local/include/boost/log/sources/severity_feature.hpp:232: undefined reference to `boost::log::v2_mt_posix::aux::default_attribute_names::severity()'
../libsolver.a(solver_impl.cpp.o): In function `boost::log::v2_mt_posix::sources::basic_channel_logger<boost::log::v2_mt_posix::sources::basic_logger<char, boost::log::v2_mt_posix::sources::severity_channel_logger_mt<boost::log::v2_mt_posix::trivial::severity_level, std::string>, boost::log::v2_mt_posix::sources::multi_thread_model<boost::log::v2_mt_posix::aux::light_rw_mutex> >, std::string>::basic_channel_logger<boost::parameter::aux::tagged_argument<boost::log::v2_mt_posix::keywords::tag::channel, char const [7]> >(boost::parameter::aux::tagged_argument<boost::log::v2_mt_posix::keywords::tag::channel, char const [7]> const&)':
/usr/local/include/boost/log/sources/channel_feature.hpp:134: undefined reference to `boost::log::v2_mt_posix::aux::default_attribute_names::channel()'
../libsolver.a(solver_impl.cpp.o): In function `boost::log::v2_mt_posix::sources::basic_logger<char, boost::log::v2_mt_posix::sources::severity_channel_logger_mt<boost::log::v2_mt_posix::trivial::severity_level, std::string>, boost::log::v2_mt_posix::sources::multi_thread_model<boost::log::v2_mt_posix::aux::light_rw_mutex> >::add_attribute_unlocked(boost::log::v2_mt_posix::attribute_name const&, boost::log::v2_mt_posix::attribute const&)':
/usr/local/include/boost/log/sources/basic_logger.hpp:228: undefined reference to `boost::log::v2_mt_posix::attribute_set::insert(boost::log::v2_mt_posix::attribute_name, boost::log::v2_mt_posix::attribute const&)'
../libsolver.a(solver_impl.cpp.o): In function `severity_level':
/usr/local/include/boost/log/sources/severity_feature.hpp:98: undefined reference to `boost::log::v2_mt_posix::attribute::impl::operator new(unsigned long)'
/usr/local/include/boost/log/sources/severity_feature.hpp:98: undefined reference to `boost::log::v2_mt_posix::attribute::impl::operator delete(void*, unsigned long)'
../libsolver.a(solver_impl.cpp.o): In function `~impl':
/usr/local/include/boost/log/sources/severity_feature.hpp:65: undefined reference to `boost::log::v2_mt_posix::attribute::impl::operator delete(void*, unsigned long)'
/usr/local/include/boost/log/sources/severity_feature.hpp:65: undefined reference to `boost::log::v2_mt_posix::attribute::impl::operator delete(void*, unsigned long)'
../libsolver.a(solver_impl.cpp.o): In function `boost::log::v2_mt_posix::sources::aux::severity_level<boost::log::v2_mt_posix::trivial::severity_level>::impl::dispatch(boost::log::v2_mt_posix::type_dispatcher&)':
/usr/local/include/boost/log/sources/severity_feature.hpp:75: undefined reference to `boost::log::v2_mt_posix::sources::aux::get_severity_level()'
../libsolver.a(solver_impl.cpp.o): In function `boost::log::v2_mt_posix::sources::aux::severity_level<boost::log::v2_mt_posix::trivial::severity_level>::impl::detach_from_thread()':
/usr/local/include/boost/log/sources/severity_feature.hpp:86: undefined reference to `boost::log::v2_mt_posix::attribute::impl::operator new(unsigned long)'
/usr/local/include/boost/log/sources/severity_feature.hpp:87: undefined reference to `boost::log::v2_mt_posix::sources::aux::get_severity_level()'
/usr/local/include/boost/log/sources/severity_feature.hpp:87: undefined reference to `boost::log::v2_mt_posix::attribute::impl::operator delete(void*, unsigned long)'
../libsolver.a(solver_impl.cpp.o): In function `~attribute_value_impl':
/usr/local/include/boost/log/attributes/attribute_value_impl.hpp:47: undefined reference to `boost::log::v2_mt_posix::attribute::impl::operator delete(void*, unsigned long)'
/usr/local/include/boost/log/attributes/attribute_value_impl.hpp:47: undefined reference to `boost::log::v2_mt_posix::attribute::impl::operator delete(void*, unsigned long)'
../libsolver.a(solver_impl.cpp.o): In function `boost::log::v2_mt_posix::sources::basic_logger<char, boost::log::v2_mt_posix::sources::severity_channel_logger_mt<boost::log::v2_mt_posix::trivial::severity_level, std::string>, boost::log::v2_mt_posix::sources::multi_thread_model<boost::log::v2_mt_posix::aux::light_rw_mutex> >::basic_logger<boost::parameter::aux::tagged_argument<boost::log::v2_mt_posix::keywords::tag::channel, char const [7]> >(boost::parameter::aux::tagged_argument<boost::log::v2_mt_posix::keywords::tag::channel, char const [7]> const&)':
/usr/local/include/boost/log/sources/basic_logger.hpp:172: undefined reference to `boost::log::v2_mt_posix::core::get()'
/usr/local/include/boost/log/sources/basic_logger.hpp:172: undefined reference to `boost::log::v2_mt_posix::attribute_set::attribute_set()'
../libsolver.a(solver_impl.cpp.o): In function `mutable_constant':
/usr/local/include/boost/log/attributes/mutable_constant.hpp:276: undefined reference to `boost::log::v2_mt_posix::attribute::impl::operator new(unsigned long)'
/usr/local/include/boost/log/attributes/mutable_constant.hpp:276: undefined reference to `boost::log::v2_mt_posix::attribute::impl::operator delete(void*, unsigned long)'
../libsolver.a(solver_impl.cpp.o): In function `impl':
/usr/local/include/boost/log/attributes/mutable_constant.hpp:242: undefined reference to `boost::log::v2_mt_posix::attribute::impl::operator new(unsigned long)'
/usr/local/include/boost/log/attributes/mutable_constant.hpp:242: undefined reference to `boost::log::v2_mt_posix::attribute::impl::operator delete(void*, unsigned long)'
../libsolver.a(solver_impl.cpp.o): In function `~impl':
/usr/local/include/boost/log/attributes/mutable_constant.hpp:226: undefined reference to `boost::log::v2_mt_posix::attribute::impl::operator delete(void*, unsigned long)'
/usr/local/include/boost/log/attributes/mutable_constant.hpp:226: undefined reference to `boost::log::v2_mt_posix::attribute::impl::operator delete(void*, unsigned long)'
../libsolver.a(solver_impl.cpp.o): In function `basic_severity_logger':
/usr/local/include/boost/log/sources/severity_feature.hpp:209: undefined reference to `boost::log::v2_mt_posix::aux::default_attribute_names::severity()'
../libsolver.a(solver_impl.cpp.o): In function `basic_channel_logger':
/usr/local/include/boost/log/sources/channel_feature.hpp:112: undefined reference to `boost::log::v2_mt_posix::aux::default_attribute_names::channel()'
../libsolver.a(solver_impl.cpp.o): In function `boost::log::v2_mt_posix::aux::attribute_set_reference_proxy::operator=(boost::log::v2_mt_posix::attribute const&) const':
/usr/local/include/boost/log/attributes/attribute_set.hpp:484: undefined reference to `boost::log::v2_mt_posix::attribute_set::insert(boost::log::v2_mt_posix::attribute_name, boost::log::v2_mt_posix::attribute const&)'
../libsolver.a(solver_impl.cpp.o): In function `basic_logger':
/usr/local/include/boost/log/sources/basic_logger.hpp:148: undefined reference to `boost::log::v2_mt_posix::core::get()'
/usr/local/include/boost/log/sources/basic_logger.hpp:148: undefined reference to `boost::log::v2_mt_posix::attribute_set::attribute_set(boost::log::v2_mt_posix::attribute_set const&)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)



On Wed, Nov 20, 2013 at 4:16 PM, Ovanes Markarian <om_boost@keywallet.com> wrote:
Lars,

thanks for your answer. I will try your proposal, we only have static libs which we assemble into an executable. So boost log should be fine here. I also link filesystem etc, but not dl. May be that is the error.


I will try it.

Thanks,
Ovanes


On Wed, Nov 20, 2013 at 3:30 PM, Lars Viklund <zao@acc.umu.se> wrote:
On Wed, Nov 20, 2013 at 03:16:54PM +0100, Ovanes Markarian wrote:
> Hi *,
>
> I am stuck with a problem to link on linux (ubuntu 12.04) with a boost log
> library (clang 3.0 & libstdc++).
>
> No matter what I do it fails. The problem is:
>
> I have a 3rd party library which is delivered as an .so-module and I need
> to link with it. My project is organized so that we develop static
> libraries and link them with test or application runner executables.
>
> I currently build boost as static libraries only, after I link my project
> with log library I get tons of errors like:
>
> /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libpthread.a(nptl-init.o):
> In function `__pthread_initialize_minimal_internal':
> /build/buildd/eglibc-2.15/nptl/nptl-init.c:296: undefined reference to
> `__libc_setup_tls'
> /build/buildd/eglibc-2.15/nptl/nptl-init.c:314: undefined reference to
> `_dl_cpuclock_offset'
> /build/buildd/eglibc-2.15/nptl/nptl-init.c:430: undefined reference to
> `_dl_pagesize'
> /build/buildd/eglibc-2.15/nptl/nptl-init.c:456: undefined reference to
> `_dl_init_static_tls'
> /build/buildd/eglibc-2.15/nptl/nptl-init.c:458: undefined reference to
> `_dl_wait_lookup_done'
> /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libpthread.a(nptl-init.o):
> In function `__pthread_get_minstack':
> /build/buildd/eglibc-2.15/nptl/nptl-init.c:479: undefined reference to
> `_dl_pagesize'
> /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libpthread.a(pthread_create.o):
> In function `allocate_stack':
> /build/buildd/eglibc-2.15/nptl/allocatestack.c:457: undefined reference to
> `_dl_stack_flags'
> /build/buildd/eglibc-2.15/nptl/allocatestack.c:596: undefined reference to
> `_dl_stack_flags'
> /usr/local/lib/libboost_log-mt-s.a(text_file_backend.o): In function
> `boost::log::v2s_mt_posix::sinks::anonymous::file_collector::file_collector(boost::shared_ptr<boost::log::v2s_mt_posix::sinks::anonymous::file_collector_repository>
> const&, boost::filesystem::path const&, unsigned long, unsigned long)':
> libs/log/src/text_file_backend.cpp:(.text+0x60b): undefined reference to
> `boost::filesystem::detail::current_path(boost::system::error_code*)'
> libs/log/src/text_file_backend.cpp:(.text+0x65c): undefined reference to
> `boost::filesystem::absolute(boost::filesystem::path const&,
> boost::filesystem::path const&)'
> libs/log/src/text_file_backend.cpp:(.text+0x6b1): undefined reference to
> `boost::filesystem::detail::create_directories(boost::filesystem::path
> const&, boost::system::error_code*)'
>
> And so on. Do you have any hints or suggestions?

No matter which platform you target, static libraries have the amusing
property that they're pretty much a lump of object files, and as such,
are not linked to any libraries at build time.

Thus, you need to link to any libraries that Boost.Log uses when you
link to a static Boost.Log. Judging by your errors, this would be
-lboost_filesystem, -ldl and possibly building with -pthread, depending
on your toolchain.

Also note that if you use Boost.Log in more than one module (DLL, shared
object), you need to use the shared Boost.Log library as indicated by
the documentation [1].

http://www.boost.org/doc/libs/1_55_0/libs/log/doc/html/log/installation/config.html

--
Lars Viklund | zao@acc.umu.se
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users