找回密码
 用户注册

QQ登录

只需一步,快速开始

查看: 5009|回复: 2

不同gcc版本下动态卸载的问题

[复制链接]
发表于 2012-3-28 14:03:12 | 显示全部楼层 |阅读模式
同一份源码,在ubuntu 10.04下gcc4.4.3下运行良好
在ubuntu 11.04下gcc4.5.2下,报这个错
Inconsistency detected by ld.so: dl-close.c: 719: _dl_close: Assertion `map->l_init_called' failed!
我查了下,使用ACE Service Configurator框架,动态卸载xxx.so库时报这个错,而其他三方库完全是一样的
难道是编译器不同会导致这个问题?
发表于 2012-3-28 16:37:51 | 显示全部楼层
在两个机器上重新编译过ACE和你自己的代码没有?还是copy过来的?
 楼主| 发表于 2012-3-28 18:13:44 | 显示全部楼层
copy和重编译都试过,一样的现象
不过我调试了下,可以大概确认是ACE_Unmanaged_Singleton类模板导出编译导致的问题,代码中注释
ACE_Unmanaged_Singleton<xxx,xxx>::instance()->xxx()后就没这个问题,如果不注释程序运行也良好,只是卸载so库时一定会报那个错。估计是加载so库时就没找到export出来的函数,未完全初始成功。但不知道怎么解决。。。
查了下config-g++-common.h中有这样一段,没搞明白
#  if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))
// Sadly, G++ 4.x silently ignores visibility attributes on
// template instantiations, which breaks singletons.
// As a workaround, we use the GCC visibility pragmas.
// And to make them fit in a macro, we use C99's _Pragma()
// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17470
// This has been fixed in GCC 4.1.1 with FC6 but not with SuSE 10.2
// that gets shipped with GCC 4.1.2 so we assume that with GCC 4.2
// this will be fixed on the head. With FC6 just set this define yourself
#   ifndef ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS
#     define ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS 1
#   endif
#  endif
您需要登录后才可以回帖 登录 | 用户注册

本版积分规则

Archiver|手机版|小黑屋|ACE Developer ( 京ICP备06055248号 )

GMT+8, 2024-5-18 21:06 , Processed in 0.022431 second(s), 6 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表