I have application.so on Aix 5.3 and gcc 4.2.4. Application.so uses boost:asio. There is example.c which does dlopen and dlclose for application.so. However, when example.c exits - I get a core dump. Pl note that all operations are performed successfully.
If I comment out boost related code in application.so and still link boost_system.so while building application.so, I still get core dump on exit of example.c . However, if I do not link boost_system.so while building application.so, I do not get any core dump on exit of example.c.
This is what I use for building boost:-
./bjam --with-system --build-dir=/opt/boost_1_42_0/tmp link=shared runtime-link=shared address-model=32 stage
I can see following warnings while building application.so with boost_system.so:-
ld: 0711-224 WARNING: Duplicate symbol: .non-virtual thunk to boost::exception_detail::error_info_injector<boost::system::system_error>::~error_info_injector
ld: 0711-224 WARNING: Duplicate symbol: .non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >::~clone_impl()
ld: 0711-224 WARNING: Duplicate symbol: .non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >::~clone_impl()
ld: 0711-224 WARNING: Duplicate symbol: .non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >::clone() const
ld: 0711-224 WARNING: Duplicate symbol: .non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >::rethrow() const
ld: 0711-224 WARNING: Duplicate symbol: .non-virtual thunk to boost::exception_detail::error_info_injector<boost::system::system_error>::~error_info_injector::system_error> >::~clone_impl()
ld: 0711-224 WARNING: Duplicate symbol: .non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system:
ld: 0711-224 WARNING: Duplicate symbol: .non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >::~clone_impl()
ld: 0711-224 WARNING: Duplicate symbol: .global destructors keyed to ras_arg_t
ld: 0711-224 WARNING: Duplicate symbol: .global constructors keyed to ras_arg_t
I am assuming that these duplicate destructors are not getting invoked during dlclose, but during exit - by which time library is unloaded.
I have tried boost_1_40, boost_1_42 , boost_1_45 and gcc 4.2.0. Has anyone seen this issue before. If yes, any help would be very much appreciated.
example.c:-
{
hLib = dlopen(libPath, RTLD_LAZY | RTLD_GLOBAL);
fprintf(stderr, "Before dlclose");
dlclose(hLib);
}
Above segment is where the problem occurs. As soon as, example.c exits, I get core dump.
Thanks & Regards,
jns.