As far as I see, it seems to be impossible to build asio with flags ASIO_NO_EXCEPTIONS and ASIO_SEPARATE_COMPILATION as disabling exceptions requires user to provide implementation of template function asio::detail::throw_exception:
It's definetely possible to use template specializations here, but that's not generic way, as it may require user to provide more specializations in case used subset of features changes.
This is my output from linker with both options enabled:
Output
```
mold: error: undefined symbol: void asio::detail::throw_exception(asio::service_already_exists const&)
>>> referenced by
>>> /tmp/cccF9tyC.ltrans2.ltrans.o:(_sub_I_65535_0.0)
mold: error: undefined symbol: void asio::detail::throw_exception(std::system_error const&)
>>> referenced by
>>> /tmp/cccF9tyC.ltrans1.ltrans.o:(asio::detail::do_throw_error(std::error_code const&, char const*))>>> referenced by
>>> /tmp/cccF9tyC.ltrans0.ltrans.o:(std::thread::_State_impl > >::_M_run())>>> referenced by
>>> /tmp/cccF9tyC.ltrans0.ltrans.o:(main)
mold: error: undefined symbol: void asio::detail::throw_exception(asio::invalid_service_owner const&)
>>> referenced by
>>> /tmp/cccF9tyC.ltrans2.ltrans.o:(_sub_I_65535_0.0)
collect2: error: ld returned 1 exit status
make[2]: *** [examples/base/CMakeFiles/examples.base.async.event_loop.dir/build.make:101: examples/base/examples.base.async.event_loop] Error 1
make[1]: *** [CMakeFiles/Makefile2:459: examples/base/CMakeFiles/examples.base.async.event_loop.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
mold: warning: symbol type mismatch: wait
>>> defined in /tmp/cckExRqF.ltrans0.ltrans.o as STT_OBJECT
>>> defined in /usr/lib/libc.so.6 as STT_FUNC
mold: error: undefined symbol: void asio::detail::throw_exception(asio::service_already_exists const&)
>>> referenced by
>>> /tmp/cckExRqF.ltrans3.ltrans.o:(_sub_I_65535_0.0)
mold: error: undefined symbol: void asio::detail::throw_exception(std::system_error const&)
>>> referenced by
>>> /tmp/cckExRqF.ltrans2.ltrans.o:(asio::detail::do_throw_error(std::error_code const&, char const*))>>> referenced by
>>> /tmp/cckExRqF.ltrans0.ltrans.o:(std::thread::_State_impl > >::_M_run())
mold: error: undefined symbol: void asio::detail::throw_exception(asio::invalid_service_owner const&)
>>> referenced by
>>> /tmp/cckExRqF.ltrans3.ltrans.o:(_sub_I_65535_0.0)
collect2: error: ld returned 1 exit status
make[2]: *** [examples/base/CMakeFiles/examples.base.async.coroutines.dir/build.make:101: examples/base/examples.base.async.coroutines] Error 1
make[1]: *** [CMakeFiles/Makefile2:430: examples/base/CMakeFiles/examples.base.async.coroutines.dir/all] Error 2
mold: error: undefined symbol: void asio::detail::throw_exception(std::system_error const&)
>>> referenced by
>>> /tmp/ccnYHmCV.ltrans2.ltrans.o:(asio::detail::do_throw_error(std::error_code const&, char const*))>>> referenced by
>>> /tmp/ccnYHmCV.ltrans1.ltrans.o:(std::thread::_State_impl > >::_M_run() [clone .lto_priv.0])
mold: error: undefined symbol: void asio::detail::throw_exception(asio::invalid_service_owner const&)
>>> referenced by
>>> /tmp/ccnYHmCV.ltrans3.ltrans.o:(_sub_I_65535_0.0)
mold: error: undefined symbol: void asio::detail::throw_exception(asio::service_already_exists const&)
>>> referenced by
>>> /tmp/ccnYHmCV.ltrans3.ltrans.o:(_sub_I_65535_0.0)
collect2: error: ld returned 1 exit status
make[2]: *** [examples/base/CMakeFiles/examples.base.async.timer.dir/build.make:101: examples/base/examples.base.async.timer] Error 1
make[1]: *** [CMakeFiles/Makefile2:517: examples/base/CMakeFiles/examples.base.async.timer.dir/all] Error 2
mold: error: undefined symbol: void asio::detail::throw_exception(asio::service_already_exists const&)
>>> referenced by
>>> /tmp/ccv399gK.ltrans3.ltrans.o:(_sub_I_65535_0.0)
mold: error: undefined symbol: void asio::detail::throw_exception(std::system_error const&)
>>> referenced by
>>> /tmp/ccv399gK.ltrans0.ltrans.o:(std::thread::_State_impl > >::_M_run())>>> referenced by
>>> /tmp/ccv399gK.ltrans2.ltrans.o:(asio::detail::do_throw_error(std::error_code const&, char const*))
mold: error: undefined symbol: void asio::detail::throw_exception(asio::invalid_service_owner const&)
>>> referenced by
>>> /tmp/ccv399gK.ltrans3.ltrans.o:(_sub_I_65535_0.0)
collect2: error: ld returned 1 exit status
```
As far as I see, it seems to be impossible to build asio with flags
ASIO_NO_EXCEPTIONS
andASIO_SEPARATE_COMPILATION
as disabling exceptions requires user to provide implementation of template functionasio::detail::throw_exception
:It's definetely possible to use template specializations here, but that's not generic way, as it may require user to provide more specializations in case used subset of features changes.
This is my output from linker with both options enabled:
Output
``` mold: error: undefined symbol: void asio::detail::throw_exceptionDisabling one of the options resolves any issues.