在调试模式下加载libglib时,“错误:符号查找错误:未定义符号:”有什么意义?

时间:2016-06-01 23:36:27

标签: linux ld glib

以下命令成功且没有错误:python3 -c 'from gi.repository import GLib'

但是,在调试一些与glib相关的分段错误时,我使用LD_DEBUG=files(在多个版本的Debian和Ubuntu上)运行相同的命令,并获得一堆与libglib和libgobject相关的错误。

这些是直接来自存储库的未修改库(有关详细信息,请参阅下面的“环境”)。

问题:这些错误的意义是什么?他们可以安全地被忽视,如果是这样,为什么?或者他们可以在以后的程序中导致错误,如果有,是否有解决方法来解决这个问题,或者是否只是破坏了包并且必须通过修改源来解决?

错误示例:

 16306: opening file=/lib/x86_64-linux-gnu/libglib-2.0.so.0 [0]; direct_opencount=1
 16306:
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_module_check_init (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_module_unload (fatal)

环境

  • 在5台不同的计算机上测试了4种不同的发行版:Ubuntu 14.04,Ubuntu 15.10,Debian 8.4和某人的自定义发行版
  • 相关软件包版本(仅适用于15.10 Ubuntu发行版):
    • python3 3.4.3-4ubuntu1(另外:python3-all python3-all-dev python3-dbg python3-dev)
    • python3-gi 3.16.2-1build1(又作:python3-gi-cairo python3-gi-dbg)
    • gir1.2-glib-2.0:amd64 1.44.0-1
    • libgirepository-1.0-1:amd64 1.44.0-1
    • libglib2.0-0:amd64 2.46.2-1ubuntu2

完整命令输出:

$ LD_DEBUG=files python3 -c 'from gi.repository import GLib'
 16306: 
 16306: file=libpthread.so.0 [0];  needed by python3 [0]
 16306: file=libpthread.so.0 [0];  generating link map
 16306:   dynamic: 0x00007f74ce030d50  base: 0x00007f74cde19000   size: 0x000000000021c490
 16306:     entry: 0x00007f74cde1ff10  phdr: 0x00007f74cde19040  phnum:                  9
 16306: 
 16306: 
 16306: file=libdl.so.2 [0];  needed by python3 [0]
 16306: file=libdl.so.2 [0];  generating link map
 16306:   dynamic: 0x00007f74cde17d88  base: 0x00007f74cdc15000   size: 0x0000000000203110
 16306:     entry: 0x00007f74cdc15ed0  phdr: 0x00007f74cdc15040  phnum:                  9
 16306: 
 16306: 
 16306: file=libutil.so.1 [0];  needed by python3 [0]
 16306: file=libutil.so.1 [0];  generating link map
 16306:   dynamic: 0x00007f74cdc13dc0  base: 0x00007f74cda12000   size: 0x0000000000202118
 16306:     entry: 0x00007f74cda12f10  phdr: 0x00007f74cda12040  phnum:                  9
 16306: 
 16306: 
 16306: file=librt.so.1 [0];  needed by python3 [0]
 16306: file=librt.so.1 [0];  generating link map
 16306:   dynamic: 0x00007f74cda10d70  base: 0x00007f74cd80a000   size: 0x0000000000207c18
 16306:     entry: 0x00007f74cd80c350  phdr: 0x00007f74cd80a040  phnum:                  9
 16306: 
 16306: 
 16306: file=libexpat.so.1 [0];  needed by python3 [0]
 16306: file=libexpat.so.1 [0];  generating link map
 16306:   dynamic: 0x00007f74cd808dc0  base: 0x00007f74cd5e1000   size: 0x0000000000228088
 16306:     entry: 0x00007f74cd5e4b90  phdr: 0x00007f74cd5e1040  phnum:                  7
 16306: 
 16306: 
 16306: file=libz.so.1 [0];  needed by python3 [0]
 16306: file=libz.so.1 [0];  generating link map
 16306:   dynamic: 0x00007f74cd5dfdd0  base: 0x00007f74cd3c6000   size: 0x000000000021a228
 16306:     entry: 0x00007f74cd3c8220  phdr: 0x00007f74cd3c6040  phnum:                  7
 16306: 
 16306: 
 16306: file=libm.so.6 [0];  needed by python3 [0]
 16306: file=libm.so.6 [0];  generating link map
 16306:   dynamic: 0x00007f74cd3c4da8  base: 0x00007f74cd0c5000   size: 0x0000000000300158
 16306:     entry: 0x00007f74cd0ca580  phdr: 0x00007f74cd0c5040  phnum:                  9
 16306: 
 16306: 
 16306: file=libc.so.6 [0];  needed by python3 [0]
 16306: file=libc.so.6 [0];  generating link map
 16306:   dynamic: 0x00007f74cd0beba0  base: 0x00007f74ccd1a000   size: 0x00000000003aaa20
 16306:     entry: 0x00007f74ccd3bc50  phdr: 0x00007f74ccd1a040  phnum:                 10
 16306: 
 16306: 
 16306: calling init: /lib/x86_64-linux-gnu/libpthread.so.0
 16306: 
 16306: 
 16306: calling init: /lib/x86_64-linux-gnu/libc.so.6
 16306: 
 16306: 
 16306: calling init: /lib/x86_64-linux-gnu/libm.so.6
 16306: 
 16306: 
 16306: calling init: /lib/x86_64-linux-gnu/libz.so.1
 16306: 
 16306: 
 16306: calling init: /lib/x86_64-linux-gnu/libexpat.so.1
 16306: 
 16306: 
 16306: calling init: /lib/x86_64-linux-gnu/librt.so.1
 16306: 
 16306: 
 16306: calling init: /lib/x86_64-linux-gnu/libutil.so.1
 16306: 
 16306: 
 16306: calling init: /lib/x86_64-linux-gnu/libdl.so.2
 16306: 
 16306: 
 16306: initialize program: python3
 16306: 
 16306: 
 16306: transferring control: python3
 16306: 
 16306: 
 16306: file=/usr/lib/python3/dist-packages/gi/_gi.cpython-34m-x86_64-linux-gnu.so [0];  dynamically loaded by python3 [0]
 16306: file=/usr/lib/python3/dist-packages/gi/_gi.cpython-34m-x86_64-linux-gnu.so [0];  generating link map
 16306:   dynamic: 0x00007f74ccb1f9e8  base: 0x00007f74cc8da000   size: 0x000000000024e648
 16306:     entry: 0x00007f74cc8ea4f0  phdr: 0x00007f74cc8da040  phnum:                  7
 16306: 
 16306: 
 16306: file=libgthread-2.0.so.0 [0];  needed by /usr/lib/python3/dist-packages/gi/_gi.cpython-34m-x86_64-linux-gnu.so [0]
 16306: file=libgthread-2.0.so.0 [0];  generating link map
 16306:   dynamic: 0x00007f74cc8d8de8  base: 0x00007f74cc6d8000   size: 0x0000000000201048
 16306:     entry: 0x00007f74cc6d86d0  phdr: 0x00007f74cc6d8040  phnum:                  7
 16306: 
 16306: 
 16306: file=libgirepository-1.0.so.1 [0];  needed by /usr/lib/python3/dist-packages/gi/_gi.cpython-34m-x86_64-linux-gnu.so [0]
 16306: file=libgirepository-1.0.so.1 [0];  generating link map
 16306:   dynamic: 0x00007f74cc6d6ce0  base: 0x00007f74cc4a5000   size: 0x0000000000232688
 16306:     entry: 0x00007f74cc4ac380  phdr: 0x00007f74cc4a5040  phnum:                  7
 16306: 
 16306: 
 16306: file=libgobject-2.0.so.0 [0];  needed by /usr/lib/python3/dist-packages/gi/_gi.cpython-34m-x86_64-linux-gnu.so [0]
 16306: file=libgobject-2.0.so.0 [0];  generating link map
 16306:   dynamic: 0x00007f74cc4a3b80  base: 0x00007f74cc252000   size: 0x0000000000252fc8
 16306:     entry: 0x00007f74cc25d330  phdr: 0x00007f74cc252040  phnum:                  7
 16306: 
 16306: 
 16306: file=libglib-2.0.so.0 [0];  needed by /usr/lib/python3/dist-packages/gi/_gi.cpython-34m-x86_64-linux-gnu.so [0]
 16306: file=libglib-2.0.so.0 [0];  generating link map
 16306:   dynamic: 0x00007f74cc24fd40  base: 0x00007f74cbf43000   size: 0x000000000030e6a8
 16306:     entry: 0x00007f74cbf5d580  phdr: 0x00007f74cbf43040  phnum:                  7
 16306: 
 16306: 
 16306: file=libffi.so.6 [0];  needed by /usr/lib/python3/dist-packages/gi/_gi.cpython-34m-x86_64-linux-gnu.so [0]
 16306: file=libffi.so.6 [0];  generating link map
 16306:   dynamic: 0x00007f74cbf41de8  base: 0x00007f74cbd3b000   size: 0x0000000000207668
 16306:     entry: 0x00007f74cbd3c870  phdr: 0x00007f74cbd3b040  phnum:                  7
 16306: 
 16306: 
 16306: file=libgmodule-2.0.so.0 [0];  needed by /usr/lib/x86_64-linux-gnu/libgirepository-1.0.so.1 [0]
 16306: file=libgmodule-2.0.so.0 [0];  generating link map
 16306:   dynamic: 0x00007f74cbd39de8  base: 0x00007f74cbb37000   size: 0x00000000002031b8
 16306:     entry: 0x00007f74cbb381b0  phdr: 0x00007f74cbb37040  phnum:                  7
 16306: 
 16306: 
 16306: file=libgio-2.0.so.0 [0];  needed by /usr/lib/x86_64-linux-gnu/libgirepository-1.0.so.1 [0]
 16306: file=libgio-2.0.so.0 [0];  generating link map
 16306:   dynamic: 0x00007f74cbb32c68  base: 0x00007f74cb7bd000   size: 0x0000000000379ac8
 16306:     entry: 0x00007f74cb7f0c50  phdr: 0x00007f74cb7bd040  phnum:                  7
 16306: 
 16306: 
 16306: file=libpcre.so.3 [0];  needed by /lib/x86_64-linux-gnu/libglib-2.0.so.0 [0]
 16306: file=libpcre.so.3 [0];  generating link map
 16306:   dynamic: 0x00007f74cb7bbc90  base: 0x00007f74cb54f000   size: 0x000000000026d168
 16306:     entry: 0x00007f74cb550710  phdr: 0x00007f74cb54f040  phnum:                  7
 16306: 
 16306: 
 16306: file=libselinux.so.1 [0];  needed by /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0 [0]
 16306: file=libselinux.so.1 [0];  generating link map
 16306:   dynamic: 0x00007f74cb54bd68  base: 0x00007f74cb32a000   size: 0x00000000002248f0
 16306:     entry: 0x00007f74cb330310  phdr: 0x00007f74cb32a040  phnum:                  8
 16306: 
 16306: 
 16306: file=libresolv.so.2 [0];  needed by /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0 [0]
 16306: file=libresolv.so.2 [0];  generating link map
 16306:   dynamic: 0x00007f74cb326d88  base: 0x00007f74cb113000   size: 0x0000000000216a68
 16306:     entry: 0x00007f74cb116a90  phdr: 0x00007f74cb113040  phnum:                  9
 16306: 
 16306: 
 16306: calling init: /lib/x86_64-linux-gnu/libresolv.so.2
 16306: 
 16306: 
 16306: calling init: /lib/x86_64-linux-gnu/libpcre.so.3
 16306: 
 16306: 
 16306: calling init: /lib/x86_64-linux-gnu/libselinux.so.1
 16306: 
 16306: 
 16306: calling init: /lib/x86_64-linux-gnu/libglib-2.0.so.0
 16306: 
 16306: 
 16306: calling init: /usr/lib/x86_64-linux-gnu/libffi.so.6
 16306: 
 16306: 
 16306: calling init: /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
 16306: 
 16306: 
 16306: calling init: /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0
 16306: 
 16306: 
 16306: calling init: /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
 16306: 
 16306: 
 16306: calling init: /usr/lib/x86_64-linux-gnu/libgirepository-1.0.so.1
 16306: 
 16306: 
 16306: calling init: /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0
 16306: 
 16306: 
 16306: calling init: /usr/lib/python3/dist-packages/gi/_gi.cpython-34m-x86_64-linux-gnu.so
 16306: 
 16306: opening file=/usr/lib/python3/dist-packages/gi/_gi.cpython-34m-x86_64-linux-gnu.so [0]; direct_opencount=1
 16306: 
 16306: 
 16306: file=/usr/lib/python3.4/lib-dynload/_opcode.cpython-34m-x86_64-linux-gnu.so [0];  dynamically loaded by python3 [0]
 16306: file=/usr/lib/python3.4/lib-dynload/_opcode.cpython-34m-x86_64-linux-gnu.so [0];  generating link map
 16306:   dynamic: 0x00007f74caff0df8  base: 0x00007f74cadf0000   size: 0x00000000002011f0
 16306:     entry: 0x00007f74cadf0990  phdr: 0x00007f74cadf0040  phnum:                  7
 16306: 
 16306: 
 16306: calling init: /usr/lib/python3.4/lib-dynload/_opcode.cpython-34m-x86_64-linux-gnu.so
 16306: 
 16306: opening file=/usr/lib/python3.4/lib-dynload/_opcode.cpython-34m-x86_64-linux-gnu.so [0]; direct_opencount=1
 16306: 
 16306: opening file=/lib/x86_64-linux-gnu/libglib-2.0.so.0 [0]; direct_opencount=1
 16306: 
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_module_check_init (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_module_unload (fatal)
 16306: opening file=/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 [0]; direct_opencount=1
 16306: 
 16306: /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0: error: symbol lookup error: undefined symbol: g_module_check_init (fatal)
 16306: /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0: error: symbol lookup error: undefined symbol: g_module_unload (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_io_condition_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_main_loop_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_main_loop_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_main_loop_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_main_loop_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_main_context_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_main_context_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_main_context_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_main_context_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_source_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_source_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_source_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_source_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_source_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_source_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_io_channel_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_io_channel_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_io_channel_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_io_channel_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_pollfd_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_pollfd_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_pollfd_get_type (fatal)
 16306: /lib/x86_64-linux-gnu/libglib-2.0.so.0: error: symbol lookup error: undefined symbol: g_pollfd_get_type (fatal)
 16306: 
 16306: calling fini: python3 [0]
 16306: 
 16306: 
 16306: calling fini: /lib/x86_64-linux-gnu/libutil.so.1 [0]
 16306: 
 16306: 
 16306: calling fini: /lib/x86_64-linux-gnu/librt.so.1 [0]
 16306: 
 16306: 
 16306: calling fini: /lib/x86_64-linux-gnu/libexpat.so.1 [0]
 16306: 
 16306: 
 16306: calling fini: /usr/lib/python3/dist-packages/gi/_gi.cpython-34m-x86_64-linux-gnu.so [0]
 16306: 
 16306: 
 16306: calling fini: /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 [0]
 16306: 
 16306: 
 16306: calling fini: /usr/lib/x86_64-linux-gnu/libgirepository-1.0.so.1 [0]
 16306: 
 16306: 
 16306: calling fini: /lib/x86_64-linux-gnu/libm.so.6 [0]
 16306: 
 16306: 
 16306: calling fini: /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0 [0]
 16306: 
 16306: 
 16306: calling fini: /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0 [0]
 16306: 
 16306: 
 16306: calling fini: /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 [0]
 16306: 
 16306: 
 16306: calling fini: /usr/lib/x86_64-linux-gnu/libffi.so.6 [0]
 16306: 
 16306: 
 16306: calling fini: /lib/x86_64-linux-gnu/libglib-2.0.so.0 [0]
 16306: 
 16306: 
 16306: calling fini: /lib/x86_64-linux-gnu/libz.so.1 [0]
 16306: 
 16306: 
 16306: calling fini: /lib/x86_64-linux-gnu/libselinux.so.1 [0]
 16306: 
 16306: 
 16306: calling fini: /lib/x86_64-linux-gnu/libpcre.so.3 [0]
 16306: 
 16306: 
 16306: calling fini: /lib/x86_64-linux-gnu/libdl.so.2 [0]
 16306: 
 16306: 
 16306: calling fini: /lib/x86_64-linux-gnu/libresolv.so.2 [0]
 16306: 
 16306: 
 16306: calling fini: /usr/lib/python3.4/lib-dynload/_opcode.cpython-34m-x86_64-linux-gnu.so [0]
 16306: 
 16306: 
 16306: calling fini: /lib/x86_64-linux-gnu/libpthread.so.0 [0]
 16306: 

1 个答案:

答案 0 :(得分:1)

我看到使用GLib和GStreamer的python应用程序也是如此。我用LD_FILES = true运行它并输出输出:

$ ./testlib.sh lib/hls.py 2>&1 | grep fatal |awk '{ print $(NF-1) }' | sort -u
__driDriverGetExtensions_swrast
g_io_channel_get_type
g_io_condition_get_type
g_main_context_get_type
g_main_loop_get_type
g_module_check_init
g_module_unload
g_pollfd_get_type
g_source_get_type

__ driDriverGetExtensions_swrast()似乎有点特别,但所有其他内容都可以在Gnome Developer Boxed Types页面或Dyanmic Loading of Modules中找到。

我仍然不确定这是否是我每次运行时我的应用程序段错误的原因。 GModuleCheckInit()的部分说:

  

如果模块包含名为g_module_check_init()的函数,则为   加载模块时自动调用。

因此,找不到g_module_check_init()是正常的,并且相关的错误消息是无害的。我想知道这是否是模块加载继续的原因,而不是立即退出一些错误代码。

对于我而言,我自己正在构建和安装所有GStreamer库和命令行工具以获得最新的稳定版本(GStreamer 1.10.4)。但是当它开始segfaulting时,我擦掉了我在/ usr下找到的每个gstreamer lib并安装了我的Ubuntu发行版GStreamer 1.2附带的版本。它仍然是分段错误,所以可能还有一些东西丢失了。

我知道这只是一个部分答案,但评论时间太长了。也许有人可以添加一些东西。