probonopd / linuxdeployqt

Makes Linux applications self-contained by copying in the libraries and plugins that the application uses, and optionally generates an AppImage. Can be used for Qt and other applications
Other
2.22k stars 414 forks source link

Program received signal SIGBUS, Bus error. #593

Open L-Super opened 1 year ago

L-Super commented 1 year ago

I compiled it from source code and it executed successfully. However, when I remove the Qt environment variable, the program fails to start.

GDB result:

$ gdb ./changxie 
GNU gdb (Uos 8.1.50.1-1.lnd.vec.6) 8.1.50.20190122-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "loongarch64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./changxie...done.
(gdb) r
Starting program: /home/geit/Desktop/build-cxclient-Qt_5_15_2_5_15_2-Debug/output/changxie 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/loongarch64-linux-gnu/libthread_db.so.1".

Program received signal SIGBUS, Bus error.
0x000000ffed434f50 in ?? ()
   from /home/geit/Desktop/build-cxclient-Qt_5_15_2_5_15_2-Debug/output/lib/libQt5Core.so.5
(gdb) bt
#0  0x000000ffed434f50 in ?? ()
   from /home/geit/Desktop/build-cxclient-Qt_5_15_2_5_15_2-Debug/output/lib/libQt5Core.so.5
#1  0x000000ffed43abe8 in QThreadStorageData::QThreadStorageData(void (*)(void*)) ()
   from /home/geit/Desktop/build-cxclient-Qt_5_15_2_5_15_2-Debug/output/lib/libQt5Core.so.5
#2  0x000000ffeda8d6fc in ?? ()
   from /home/geit/Desktop/build-cxclient-Qt_5_15_2_5_15_2-Debug/output/lib/libQt5Network.so.5
#3  0x000000fff7fe6cb0 in call_init (l=<optimized out>, argc=<optimized out>, argv=0xffffff5b18, 
    env=0xffffff5b28) at dl-init.c:72
#4  0x000000fff7fe6dd8 in call_init (env=0xffffff5b28, argv=0xffffff5b18, argc=1, l=<optimized out>)
    at dl-init.c:30
#5  _dl_init (main_map=0xfff7ffd1a0, argc=<optimized out>, argv=0xffffff5b18, env=0xffffff5b28)
    at dl-init.c:119
#6  0x000000fff7fd9460 in _start () from /lib64/ld.so.1
L-Super commented 1 year ago

I have made some new discoveries. The libQt5Core.so copied by linuxdeployqt is not the same size as the libQt5Core.so from Qt. I don't have any libQt5Core.so on my system that matches the size of the one copied by linuxdeployqt. When I replaced the libQt5Core.so, the program was able to run normally. Since I haven't read the source code, I'm not sure where the problem occurred.

Qt:

$ ll libQt5Core.so.5 
-rwxr-xr-x 1 geit geit 7127656 11月 15 10:51 libQt5Core.so.5

$ readelf -d libQt5Core.so.5 

Dynamic section at offset 0x6c3d70 contains 36 entries:
  标记        类型                         名称/值
 0x0000000000000001 (NEEDED)             共享库:[libpthread.so.0]
 0x0000000000000001 (NEEDED)             共享库:[libz.so.1]
 0x0000000000000001 (NEEDED)             共享库:[libdouble-conversion.so.1]
 0x0000000000000001 (NEEDED)             共享库:[libdl.so.2]
 0x0000000000000001 (NEEDED)             共享库:[libgthread-2.0.so.0]
 0x0000000000000001 (NEEDED)             共享库:[libglib-2.0.so.0]
 0x0000000000000001 (NEEDED)             共享库:[libstdc++.so.6]
 0x0000000000000001 (NEEDED)             共享库:[libm.so.6]
 0x0000000000000001 (NEEDED)             共享库:[libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             共享库:[libc.so.6]
 0x0000000000000001 (NEEDED)             共享库:[ld.so.1]
 0x000000000000000e (SONAME)             Library soname: [libQt5Core.so.5]
 0x0000000000000019 (INIT_ARRAY)         0x6baf58
 0x000000000000001b (INIT_ARRAYSZ)       24 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x6baf70
 0x000000000000001c (FINI_ARRAYSZ)       16 (bytes)
 0x0000000000000004 (HASH)               0x2d0
 0x000000006ffffef5 (GNU_HASH)           0x8b98
 0x0000000000000005 (STRTAB)             0x3a440
 0x0000000000000006 (SYMTAB)             0x12f78
 0x000000000000000a (STRSZ)              249654 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000003 (PLTGOT)             0x6c87b0
 0x0000000000000002 (PLTRELSZ)           76944 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0xe3a10
 0x0000000000000007 (RELA)               0x7ac38
 0x0000000000000008 (RELASZ)             506472 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffc (VERDEF)             0x7a7e0
 0x000000006ffffffd (VERDEFNUM)          19
 0x000000006ffffffe (VERNEED)            0x7aa78
 0x000000006fffffff (VERNEEDNUM)         7
 0x000000006ffffff0 (VERSYM)             0x77376
 0x000000006ffffff9 (RELACOUNT)          1943
 0x0000000000000000 (NULL)               0x0

linuxdeployqt:

$ ll libQt5Core.so.5 
-rwxr-xr-x 1 geit geit 7428816 11月 14 10:18 libQt5Core.so.5

$ readelf -d libQt5Core.so.5 

Dynamic section at offset 0x6d0000 contains 37 entries:
  标记        类型                         名称/值
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN]
 0x0000000000000001 (NEEDED)             共享库:[libpthread.so.0]
 0x0000000000000001 (NEEDED)             共享库:[libz.so.1]
 0x0000000000000001 (NEEDED)             共享库:[libdouble-conversion.so.1]
 0x0000000000000001 (NEEDED)             共享库:[libdl.so.2]
 0x0000000000000001 (NEEDED)             共享库:[libgthread-2.0.so.0]
 0x0000000000000001 (NEEDED)             共享库:[libglib-2.0.so.0]
 0x0000000000000001 (NEEDED)             共享库:[libstdc++.so.6]
 0x0000000000000001 (NEEDED)             共享库:[libm.so.6]
 0x0000000000000001 (NEEDED)             共享库:[libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             共享库:[libc.so.6]
 0x0000000000000001 (NEEDED)             共享库:[ld.so.1]
 0x000000000000000e (SONAME)             Library soname: [libQt5Core.so.5]
 0x0000000000000019 (INIT_ARRAY)         0x6baf58
 0x000000000000001b (INIT_ARRAYSZ)       24 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x6baf70
 0x000000000000001c (FINI_ARRAYSZ)       16 (bytes)
 0x0000000000000004 (HASH)               0x70d1e0
 0x000000006ffffef5 (GNU_HASH)           0x8b98
 0x0000000000000005 (STRTAB)             0x6d02a0
 0x0000000000000006 (SYMTAB)             0x12f78
 0x000000000000000a (STRSZ)              249662 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000003 (PLTGOT)             0x6c87b0
 0x0000000000000002 (PLTRELSZ)           76944 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0xe3a10
 0x0000000000000007 (RELA)               0x7ac38
 0x0000000000000008 (RELASZ)             506472 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffc (VERDEF)             0x7a7e0
 0x000000006ffffffd (VERDEFNUM)          19
 0x000000006ffffffe (VERNEED)            0x7aa78
 0x000000006fffffff (VERNEEDNUM)         7
 0x000000006ffffff0 (VERSYM)             0x77376
 0x000000006ffffff9 (RELACOUNT)          1943
 0x0000000000000000 (NULL)               0x0