Boost logo

Boost Users :

Subject: Re: [Boost-users] 'Multiply defined' errors in Boost 1.38.
From: Dyer, Nigel (N.P.Dyer_at_[hidden])
Date: 2009-02-22 11:31:56


Hi Volodya

The two boost libraries that cause problems are boost/test and
boost/lambda, and if I remove them all is fine in this example.

The problem only appears with <link>static. If there is no <link>static
requirement then I get an error message saying that the bio-pch.h.gch is
not used because BOOST_SYSTEM_DYN_LINK us defined. I assume that this
means that precompiled headers are incompatible with dynamic link
builds, although this does not appear to be mentioned.

If I define the exe as below in a static build the precompiled header
builds with no problems and the code links with no errors. I suspect
that by not having the pch as a source this means it is not working as a
pch however

exe nigel
        :
                Lexer/BiobaseLexer.cpp
                Lexer/ArrayLexer.cpp
                #/boost/filesystem//boost_filesystem
                main_nigel.cpp
        :
                <variant>static:<source>bio-pch
                <library>/boost/system//boost_system
        ;

And apologies about the misleading header on my first posting.

Nigel Dyer
PhD student
MOAC Doctoral Training Centre
University of Warwick
Coventry
CV4 7AL
 

-----Original Message-----
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Vladimir Prus
Sent: 22 February 2009 09:36
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] 'Multiply defined' errors in Boost 1.38.

Dyer, Nigel wrote:

> Hi
>
> There is a problem with the 1.38 release of Boost that is preventing
me
> from compiling using gcc on a mac some code that compiled correctly in
> previous releases. I now get lots of 'multiply defined' error
messages
> when certain boost header files are included in specific ways, e.g.
>
> /usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: multiple definitions of
> symbol boost::test_tools::(anonymous namespace)::check_is_close
>
bin/darwin-4.0.1/release/link-static/threading-multi/Lexer/BiobaseLexer.
> o definition of boost::test_tools::(anonymous
namespace)::check_is_close
> in section (__DATA,__common)
>
bin/darwin-4.0.1/release/link-static/threading-multi/Lexer/ArrayLexer.o
> definition of boost::test_tools::(anonymous namespace)::check_is_close
> in section (__DATA,__common)
>
>
> I have attached minimal example which seems to reproduce the problem.
>
> It seems to be associated with the change that was introduced in svn
> release r49800.
>
(https://svn.boost.org/trac/boost/changeset?new=49800%40trunk&old=49793%
> 40trunk)
>
> I have run bjam -n -a with and without r49800 and also bjam with and
> without the r49800 change, which appears to show that the problem
arises
> after the change has been introduced:

Hi Nigel,

thanks for a comprehensive bug report. On the first look, it appears
that
Boost.Build change is actually right -- it fixes a previously introduced
bug that made PCHs non-functional. And, then, it appears that including
boost.test in PCH somehow upsets the compiler. Do things improve if you
take all boost.test headers out of bio-pch.h?

Thanks,
Volodya

P.S. Please don't ask new questions by replying to unrelated email,
I've nearly missed this one.

_______________________________________________
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