Boost logo

Boost Users :

Subject: Re: [Boost-users] linking with boost log 1.54
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2013-11-20 10:16:05


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_at_[hidden]> 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_at_[hidden]
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net