如何引导编译器使用某个库?

时间:2014-04-19 19:01:30

标签: linux compilation linker

我正在尝试根据本指南编译skeltrack http://tayyabnaseer.blogspot.com.tr/2012/05/installing-skeltrack-on-ubuntu.html

我成功编译并安装了前两个库。但是当谈到skeltrack时,我会遇到编译错误:

CCLD     test-skeleton
/usr/bin/ld: test-skeleton.o: undefined reference to symbol 'g_file_read'
/usr/lib/i386-linux-gnu/libgio-2.0.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

我在Ubuntu 13.10 32位平台上。我在网上搜索了错误,我得出的结论是我的glib 2.32不包含那些功能。我成功编译并安装了glib 2.38。但链接器正在寻找旧的glib 2.32库。这是我计算机中的libgio库:

 locate libgio-2.0.so.0
 /home/****/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
 /home/****/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.3200.3
 /home/****/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libgio-2.0.so.0
 /home/****/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libgio-2.0.so.0.3200.3
 /home/****/Downloads/ubuntu-core-13.04-core-i386/usr/lib/i386-linux-gnu/libgio-2.0.so.0
 /home/****/Downloads/ubuntu-core-13.04-core-i386/usr/lib/i386-linux-gnu/libgio-2.0.so.0.3600.0
 /home/****/install/lib/libgio-2.0.so.0
 /home/****/install/lib/libgio-2.0.so.0.3800.2
 /usr/lib/i386-linux-gnu/libgio-2.0.so.0
 /usr/lib/i386-linux-gnu/libgio-2.0.so.0.3800.1
 /usr/local/lib/libgio-2.0.so.0
 /usr/local/lib/libgio-2.0.so.0.3600.0
 /usr/local/lib/libgio-2.0.so.0.3800.2

如何告诉链接器使用正在寻找的正确的libgio?

1 个答案:

答案 0 :(得分:1)

我在查看以下网址后想出了如何链接特定的图书馆:

具体而言,将LDFLAGS设为,

LDFLAGS='-l:/usr/local/lib/libgio-2.0.so.0.3800.2 -l:/usr/local/lib/libgobject-2.0.so.0.3800.2 -l:/usr/local/lib/libglib-2.0.so.0.3800.2' ./configure

做了这个伎俩。