Boost logo

Boost :

Subject: Re: [boost] [visibility][test][osx] visibility warnings with 1.70beta
From: Peter Dimov (lists_at_[hidden])
Date: 2019-03-27 19:35:59


Raffi Enficiaud wrote:
> Hi,
>
> I have a side project that requires boost.test and I thought it is the
> right time to use the beta build of 1.70. At link time for my project (in
> this case a simple boost.test module), I have tons of warnings like the
> following:
>
> ld: warning: direct access in function
> 'boost::unit_test::decorator::depends_on::apply(boost::unit_test::test_unit&)'
> from file
> '/Users/raffi/from-big-laptop/code/software_workshop/sw_thirdparties/osx/boost_1_70_0_b1/lib/libboost_unit_test_framework-xgcc42-mt-x64-1_70.a(decorator.o)'
> to global weak symbol 'boost::unit_test::basic_cstring<char
> const>::null_str()::null'
> from file
> '/Users/raffi/code/mpi/mpi_kmeans/build/MPI-Kmeans.build/Debug/test_mpi_kmeans.build/Objects-normal/x86_64/test_cls_and_func_impl.o'
> means the weak symbol cannot be overridden at runtime. This was likely
> caused by different translation units being compiled with different
> visibility settings.

Looking at

https://github.com/boostorg/test/blob/develop/include/boost/test/utils/basic_cstring/basic_cstring.hpp#L170-L176

template<typename CharT>
inline typename basic_cstring<CharT>::pointer
basic_cstring<CharT>::null_str()
{
    static CharT null = 0;
    return &null;
}

there's no BOOST_SYMBOL_VISIBLE there, so `null` is indeed different in the
library (with hidden visibility) and in the application (with default
visibility). Perhaps that's what the linker complains about.

I'm not sure what the right fix here is though.


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