chriskohlhoff / asio

Asio C++ Library
http://think-async.com/Asio
4.96k stars 1.22k forks source link

BOOST_ASIO_DYN_LINK: only defined for windows ? #820

Open jcelerier opened 3 years ago

jcelerier commented 3 years ago

https://github.com/chriskohlhoff/asio/blob/57577c6db46a4e2de5351af2b185bf52696699a9/asio/include/asio/detail/config.hpp#L45-L71

Here ASIO_DYN_LINK is only useful for windows.

This means that on linux, e.g.

libfoo.so : defines ASIO_DYN_LINK, includes asio/src.hpp in a file
bar : links against libfoo.so, also uses asio (and expects to find asio symbols somewhere)

then libbar.so gets link errors - the following, to be precise:

/usr/bin/ld: asio.cpp.o: in function `boost::asio::detail::deadline_timer_service<boost::asio::detail::chrono_time_traits<std::chrono::_V2::system_clock, boost::asio::wait_traits<std::chrono::_V2::system_clock> > >::deadline_timer_service(boost::asio::execution_context&)':

boost_1_76_0/boost/asio/detail/deadline_timer_service.hpp:72: undefined reference to `boost::asio::detail::epoll_reactor::init_task()'

/usr/bin/ld: asio.cpp.o: in function `void boost::asio::detail::epoll_reactor::schedule_timer<boost::asio::detail::chrono_time_traits<std::chrono::_V2::system_clock, boost::asio::wait_traits<std::chrono::_V2::system_clock> > >(boost::asio::detail::timer_queue<boost::asio::detail::chrono_time_traits<std::chrono::_V2::system_clock, boost::asio::wait_traits<std::chrono::_V2::system_clock> > >&, boost::asio::detail::chrono_time_traits<std::chrono::_V2::system_clock, boost::asio::wait_traits<std::chrono::_V2::system_clock> >::time_type const&, boost::asio::detail::timer_queue<boost::asio::detail::chrono_time_traits<std::chrono::_V2::system_clock, boost::asio::wait_traits<std::chrono::_V2::system_clock> > >::per_timer_data&, boost::asio::detail::wait_op*)':

boost_1_76_0/boost/asio/detail/impl/epoll_reactor.hpp:54: undefined reference to `boost::asio::detail::epoll_reactor::update_timeout()'

/usr/bin/ld: asio.cpp.o: in function `void boost::asio::detail::epoll_reactor::add_timer_queue<boost::asio::detail::chrono_time_traits<std::chrono::_V2::system_clock, boost::asio::wait_traits<std::chrono::_V2::system_clock> > >(boost::asio::detail::timer_queue<boost::asio::detail::chrono_time_traits<std::chrono::_V2::system_clock, boost::asio::wait_traits<std::chrono::_V2::system_clock> > >&)':

boost_1_76_0/boost/asio/detail/impl/epoll_reactor.hpp:29: undefined reference to `boost::asio::detail::epoll_reactor::do_add_timer_queue(boost::asio::detail::timer_queue_base&)'

/usr/bin/ld: asio.cpp.o: in function `boost::asio::execution_context::service* boost::asio::detail::service_registry::create<boost::asio::detail::epoll_reactor, boost::asio::execution_context>(void*)':

boost_1_76_0/boost/asio/detail/impl/service_registry.hpp:87: undefined reference to `boost::asio::detail::epoll_reactor::epoll_reactor(boost::asio::execution_context&)'

/usr/bin/ld: asio.cpp.o: in function `void boost::asio::detail::epoll_reactor::remove_timer_queue<boost::asio::detail::chrono_time_traits<std::chrono::_V2::system_clock, boost::asio::wait_traits<std::chrono::_V2::system_clock> > >(boost::asio::detail::timer_queue<boost::asio::detail::chrono_time_traits<std::chrono::_V2::system_clock, boost::asio::wait_traits<std::chrono::_V2::system_clock> > >&)':

boost_1_76_0/boost/asio/detail/impl/epoll_reactor.hpp:35: undefined reference to `boost::asio::detail::epoll_reactor::do_remove_timer_queue(boost::asio::detail::timer_queue_base&)'
jcelerier commented 1 month ago

still a problem in 2024