idealvin / coost

A tiny boost library in C++11.
Other
3.97k stars 561 forks source link

动态库链接libco.a后无法被动态加载(Linux下) #361

Open AKanTam opened 5 months ago

AKanTam commented 5 months ago

环境一: windows10 22H2 环境二: arm32 ubuntu 20.04 环境三: amd64 ubuntu 16.04

动态库链接libco.a后在linux系统环境下无法被动态加载,而在windows平台中使用正常

以下是Linux中gdb的报错信息:

coost/src/co/hook.cc:1248: void co::init_hook(): Assertion `__sys_api(close)' failed.

__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 50 ../sysdeps/unix/sysv/linux/raise.c: 没有那个文件或目录. (gdb) bt

0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50

1 0x00007ffff7bbb859 in __GI_abort () at abort.c:79

2 0x00007ffff7bbb729 in __assert_fail_base (

fmt=0x7ffff7d51588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
assertion=0x7fff65268ece "__sys_api(close)", 
file=0x7fff65269068 "/home/alientek/dev_assist/coost/src/co/hook.cc", 
line=1248, function=<optimized out>) at assert.c:92

3 0x00007ffff7bccfd6 in __GI___assert_fail (

assertion=assertion@entry=0x7fff65268ece "__sys_api(close)", 
file=file@entry=0x7fff65269068 "/home/alientek/dev_assist/coost/src/co/hook.cc", line=line@entry=1248, 
function=function@entry=0x7fff65268eb9 "void co::init_hook()")
at assert.c:101

4 0x00007fff65227748 in co::init_hook ()

at /home/alientek/dev_assist/coost/src/co/hook.cc:1256

5 0x00007fff65227905 in HookInitializer::HookInitializer (

this=<optimized out>)
at /home/alientek/dev_assist/coost/src/co/hook.cc:1274

6 HookInitializer::HookInitializer (this=)

at /home/alientek/dev_assist/coost/src/co/hook.cc:1271

7 0x00007fff651deb22 in __static_initialization_and_destruction_0 (

__initialize_p=1, __priority=65535)
at /home/alientek/dev_assist/coost/src/co/co.cc:1087

--Type for more, q to quit, c to continue without paging--

8 _GLOBAL__sub_I_co.cc(void) () at /home/alientek/dev_assist/coost/src/co/co.cc:1087

9 0x00007ffff7fe0b9a in call_init (l=, argc=argc@entry=1, argv=argv@entry=0x7fffffffe058, env=env@entry=0x7fffffffe068) at dl-init.c:72

10 0x00007ffff7fe0ca1 in call_init (env=0x7fffffffe068, argv=0x7fffffffe058, argc=1, l=) at dl-init.c:30

11 _dl_init (main_map=0x55555585a860, argc=1, argv=0x7fffffffe058, env=0x7fffffffe068) at dl-init.c:119

12 0x00007ffff7cf9ba5 in GIdl_catch_exception (exception=, operate=, args=) at dl-error-skeleton.c:182

13 0x00007ffff7fe50cf in dl_open_worker (a=a@entry=0x7fffffffd8d0) at dl-open.c:758

14 0x00007ffff7cf9b48 in GIdl_catch_exception (exception=, operate=, args=) at dl-error-skeleton.c:208

15 0x00007ffff7fe460a in _dl_open (file=0x555555827d80 "/home/alientek/smu/bin/libprotocol_ibdn.so", mode=-2147483647, caller_dlopen=, nsid=-2, argc=1, argv=0x7fffffffe058, env=0x7fffffffe068) at dl-open.c:837

16 0x00007ffff7fac34c in dlopen_doit (a=a@entry=0x7fffffffdaf0) at dlopen.c:66

17 0x00007ffff7cf9b48 in GIdl_catch_exception (exception=exception@entry=0x7fffffffda90, operate=, args=) at dl-error-skeleton.c:208

18 0x00007ffff7cf9c13 in GIdl_catch_error (objname=0x5555558002a0, errstring=0x5555558002a8, mallocedp=0x555555800298, operate=, args=) at dl-error-skeleton.c:227

19 0x00007ffff7facb59 in _dlerror_run (operate=operate@entry=0x7ffff7fac2f0 , args=args@entry=0x7fffffffdaf0) at dlerror.c:170

20 0x00007ffff7fac3da in __dlopen (file=, mode=) at dlopen.c:87

image

ihtycm commented 1 month ago

有解决方案吗,这是什么问题?