boost:asio and dlclose() - core dump (illegal instruction)
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.
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.
{
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.
EDIT
When building application.so with boost-system, I am getting following warnings:-
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:开发者_StackOverflow中文版 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 am not using boost, but am using AIX 5.3-5, and gcc 4.2.0, and experienced a core dump and the
"ld: 0711-224 WARNING: Duplicate symbol: .global constructors keyed to ras_arg_t"
linkage warning.
The answer to my problem was to add the word typedef
before the ras_arg
struct definition in /usr/include/sys/ras.h
This is similar to the thread_credentials
case described here:
http://www.ibm.com/developerworks/forums/thread.jspa?threadID=119546
精彩评论