Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[package] boost/1.74.0: ios fvisibility set #3747

Closed
qwertzui11 opened this issue Dec 1, 2020 · 3 comments · Fixed by #4453
Closed

[package] boost/1.74.0: ios fvisibility set #3747

qwertzui11 opened this issue Dec 1, 2020 · 3 comments · Fixed by #4453
Labels
bug Something isn't working

Comments

@qwertzui11
Copy link

Package and Environment Details (include every applicable attribute)

  • Package Name/Version: boost/1.74.0
  • Operating System+version: Mac Mojave
  • Compiler+version: Apple clang version 12.0.0
  • Conan version: 1.31.0

Conan profiles

host profile

[settings]
os=iOS
os.version=12.0
arch=armv8
compiler=apple-clang
compiler.version=12.0
compiler.libcxx=libc++
build_type=Release
[options]
[build_requires]
[env]

build profile

[settings]
os=Macos
os_build=Macos
arch=x86_64
arch_build=x86_64
compiler=apple-clang
compiler.version=12.0
compiler.libcxx=libc++
build_type=Release
[options]
[build_requires]
[env]

Steps to reproduce

I got a conanfile wich demand boost/1.74.0, nothing unusual happens, it compiles and I can use it and link it.
However I get A LOT of linker warnings which look like

ld: warning: direct access in function 'boost::log::v2s_mt_posix::core::implementation::implementation()' from file '/Users/acof/.conan/data/boost/1.73.0/_/_/package/2bcd523eb799e86beac7172dddb46e02c19f269a/lib/libboost_log.a(core.o)' to global weak symbol 'boost::log::v2s_mt_posix::aux::light_function<bool (boost::log::v2s_mt_posix::attribute_value_set const&)>::impl<boost::log::v2s_mt_posix::filter::default_filter>::invoke_impl(void*, boost::log::v2s_mt_posix::attribute_value_set const&)' from file 'utils/libutils.a(logging_initialser.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'boost::log::v2s_mt_posix::core::implementation::implementation()' from file '/Users/acof/.conan/data/boost/1.73.0/_/_/package/2bcd523eb799e86beac7172dddb46e02c19f269a/lib/libboost_log.a(core.o)' to global weak symbol 'boost::log::v2s_mt_posix::aux::light_function<bool (boost::log::v2s_mt_posix::attribute_value_set const&)>::impl<boost::log::v2s_mt_posix::filter::default_filter>::invoke_impl(void*, boost::log::v2s_mt_posix::attribute_value_set const&)' from file 'utils/libutils.a(logging_initialser.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'boost::log::v2s_mt_posix::core::implementation::thread_data::thread_data()' from file '/Users/acof/.conan/data/boost/1.73.0/_/_/package/2bcd523eb799e86beac7172dddb46e02c19f269a/lib/libboost_log.a(core.o)' to global weak symbol 'boost::date_time::c_time::gmtime(long const*, tm*)' from file 'asio/libasio.a(asio_impl.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'boost::log::v2s_mt_posix::core::implementation::thread_data::thread_data()' from file '/Users/acof/.conan/data/boost/1.73.0/_/_/package/2bcd523eb799e86beac7172dddb46e02c19f269a/lib/libboost_log.a(core.o)' to global weak symbol 'boost::date_time::c_time::gmtime(long const*, tm*)' from file 'asio/libasio.a(asio_impl.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'boost::log::v2s_mt_posix::visitation_result boost::log::v2s_mt_posix::value_visitor_invoker<boost::mpl::vector2<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > >, boost::log::v2s_mt_posix::fallback_to_none>::operator()<boost::log::v2s_mt_posix::sinks::aux::anonymous::message_printer>(boost::log::v2s_mt_posix::attribute_name const&, boost::log::v2s_mt_posix::attribute_value_set const&, boost::log::v2s_mt_posix::sinks::aux::anonymous::message_printer) const' from file '/Users/acof/.conan/data/boost/1.73.0/_/_/package/2bcd523eb799e86beac7172dddb46e02c19f269a/lib/libboost_log.a(default_sink.o)' to global weak symbol 'boost::log::v2s_mt_posix::aux::type_sequence_dispatcher_base::get_callback(boost::log::v2s_mt_posix::type_dispatcher*, boost::typeindex::stl_type_index)' from file 'utils/libutils.a(logging_initialser.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.

To summarize boost compiles with a different visibility: This was likely caused by different translation units being compiled with different visibility settings.. Sooo I checked the recipes/boost/all/conanfile.py and yes there's actually a different hard-coded fvisibilty ONLY for iOS https://github.com/conan-io/conan-center-index/blame/cbef8be887845520b131e87faa441519d7144806/recipes/boost/all/conanfile.py#L643

My question is, is that necessary? All other libraries got no such visibility set. When I change the visibility of MY project to -fvisibility=hidden -fvisibility-inlines-hidden, these warnings disappear.

Wouldn't it make more sense to set -fvisibility=hidden -fvisibility-inlines-hidden in the profile, so all dependencies got the same visibility?

Thx for your time!

@qwertzui11 qwertzui11 added the bug Something isn't working label Dec 1, 2020
@SSE4
Copy link
Contributor

SSE4 commented Dec 1, 2020

as far as I remember, -fvisibility=hidden is strictly necessary, and only for iOS.

source:
https://github.com/danoli3/ofxiOSBoost/blob/master/scripts/build-libc%2B%2B#L70
https://github.com/mz2/boostoniphone/blob/master/boost.sh#L141

@qwertzui11
Copy link
Author

that's what I first thought too... however I can't find any information about -fvisibility=hidden being mandatory for iOS... it seems however recommended.

@SSE4
Copy link
Contributor

SSE4 commented Dec 1, 2020

more information is here: boostorg/boost#190
seems like boost builds with -fvisibility=hidden by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants