Boost logo

Boost :

Subject: Re: [boost] questions regarding GCC visibility
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2015-04-01 08:56:06


On 31 Mar 2015 at 18:48, Robert Ramey wrote:

> I made a few changes to simplify code in the serialization library. This
> entailed eliminating support for borland compilers, workarounds for
> compilers which fail to support partial specialization of template function
> and some general clean up. In the course of this effort, I had occasion to
> simplify the code which supports Auto linking - and by extension visibility.
> Things seemed to go pretty well. Feeling frisky, I added the switch
> -fvisibility=hidden to the gcc compile of library. Now applications won't
> link for lack of certain symbols. Well, they link and run fin on my machine
> here at home- but fail in the test matrix.

Firstly purge all intermediate build files. Just a single hidden
visibility in any linked objects taints visibility for all linked
objects.

Secondly, yours looks to be a base class visibility problem. Either
make sure base classes are defined rather than declared in all TUs,
or mark base classes with export visibility. Remember just one
failure to correctly mark a symbol as default visibility in any
linked object ruins the show.

I assume you're using the usual trick of defining
BOOST_SERIALIZATION_SOURCE when compiling the source code such that
the right import/export is configured i.e. the opposite to a header
include by third party libs? Note you must be careful in this,
because incorrect mixing BOOST_SERIALIZATION_SOURCE compilands with
any without BOOST_SERIALIZATION_SOURCE ruins the show. In other
words, everything going into an ELF shared object must *always* have
the same export visibility, and everything outside that ELF shared
object must *always* have the opposite visibility setting. For some
given ABI, of course.

Again, blame ELF and the limited world view of those who provide its
tooling for this mess.

Niall

-- 
ned Productions Limited Consulting
http://www.nedproductions.biz/ 
http://ie.linkedin.com/in/nialldouglas/



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