[英]error: undefined reference to.. long list while compiling GTK-3.12.2
Getting 100+ errors like this: 得到100多个错误,如下所示:
./.libs/libgtk-3.so: undefined reference to `g_drive_can_start_degraded'
I've provided all the linker flags like -lglib-2.0 -lfreetype
etc. still I'm getting those errors any help? 我提供了所有链接器标志,例如
-lglib-2.0 -lfreetype
等。仍然对这些错误有帮助吗?
The first step is often Google. 第一步通常是Google。 Search for
g_drive_can_start_degraded
to find out in which library/project it might be. 搜索
g_drive_can_start_degraded
以找出它可能在哪个库/项目中。 The first link returns GDrive from GIO: https://developer.gnome.org/gio/stable/GDrive.html 第一个链接从GIO返回GDrive: https : //developer.gnome.org/gio/stable/GDrive.html
Further down, it says glib: gio/gdrive.c
再往下看,它说的是
glib: gio/gdrive.c
So it seems that this function is part of glib
. 因此,似乎该功能是
glib
一部分。 Let's find this library: 让我们找到这个库:
find /usr/lib* -name "libglib*.so*"
If that doesn't show up any hits, try also the usual places like /lib*
or /usr/local/lib*
. 如果未显示任何结果,请尝试使用
/lib*
或/usr/local/lib*
等常见位置。
For me, it gives this list: 对我来说,它给出了以下列表:
/usr/lib/cli/glib-sharp-2.0/libglibsharpglue-2.so
/usr/lib/vmware-installer/2.1.0/lib/lib/libglib-2.0.so.0
/usr/lib/vmware-installer/2.1.0/lib/lib/libglib-2.0.so.0/libglib-2.0.so.0
/usr/lib/vmware/lib/libglib-2.0.so.0
/usr/lib/vmware/lib/libglib-2.0.so.0/libglib-2.0.so.0
/usr/lib/vmware/lib/libglibmm-2.4.so.1
/usr/lib/vmware/lib/libglibmm-2.4.so.1/libglibmm-2.4.so.1
/usr/lib/vmware/lib/libglibmm_generate_extra_defs-2.4.so.1
/usr/lib/vmware/lib/libglibmm_generate_extra_defs-2.4.so.1/libglibmm_generate_extra_defs-2.4.so.1
/usr/lib/x86_64-linux-gnu/libglibmm-2.4.so.1.3.0
/usr/lib/x86_64-linux-gnu/libglibmm_generate_extra_defs-2.4.so.1.3.0
/usr/lib/x86_64-linux-gnu/libglib-2.0.so
/usr/lib/x86_64-linux-gnu/libglibmm-2.4.so.1
/usr/lib/x86_64-linux-gnu/libglibmm_generate_extra_defs-2.4.so.1
/usr/lib/x86_64-linux-gnu/libglib-2.0.so
looks like the most promising candidate. /usr/lib/x86_64-linux-gnu/libglib-2.0.so
看起来是最有前途的候选人。 Let's see what's inside: 让我们看看里面是什么:
objdump --dynamic-syms /usr/lib/x86_64-linux-gnu/libglib-2.0.so | grep g_drive_can_start_degraded
which returns nothing. 它什么也不会返回。 Maybe I have the wrong version of
glib
(2.x instead of 3.x)? 也许我的
glib
版本不正确(2.x而不是3.x)?
But further investigation shows that I also have /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
: 但是进一步的调查表明,我也有
/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
:
> objdump --dynamic-syms /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0 | grep g_drive_can_start_de
000000000003f080 g DF .text 0000000000000078 Base g_drive_can_start_degraded
Seems like you're missing -lgio-2.0
somewhere. 好像您在某处缺少
-lgio-2.0
。
If the library didn't define the symbol but would need it, the output would look like this: 如果库未定义符号,但需要符号,则输出将如下所示:
0000000000000000 DF *UND* 0000000000000000 g_setenv
Note the address is 0 and the segment is *UND*
instead of .text
. 请注意,地址为0,该段为
*UND*
而不是.text
。
Note: The order of libraries that you pass to the linker is important! 注意:传递给链接器的库的顺序很重要! The linker will search each library only once.
链接器将只搜索每个库一次。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.