在编译Terminology时,出现了“/usr/bin/ld: cannot find -lecore_input”错误,但libecore_input.so存在。

5

我正在尝试编译Terminology终端仿真器(顺便说一下,它可以实现一些非常酷的功能,值得一试)。然而,构建失败并显示以下错误:

/usr/bin/ld: cannot find -lecore_input

在使用make -n打印正在运行的命令(或将要运行的命令)时,我尝试了一些操作后发现以下一行是失败的:

gcc -g -O2   -o terminology terminology-about.o terminology-col.o terminology-config.o terminology-controls.o terminology-ipc.o terminology-keyin.o terminology-main.o terminology-media.o terminology-options.o terminology-options_font.o terminology-options_theme.o terminology-options_themepv.o terminology-options_wallpaper.o terminology-options_colors.o terminology-options_behavior.o terminology-options_keys.o terminology-options_helpers.o terminology-options_video.o terminology-sel.o terminology-termio.o terminology-termcmd.o terminology-termiolink.o terminology-termpty.o terminology-termptydbl.o terminology-termptyesc.o terminology-termptyops.o terminology-termptygfx.o terminology-termptyext.o terminology-termptysave.o lz4/terminology-lz4.o terminology-utf8.o terminology-win.o terminology-utils.o terminology-dbus.o terminology-extns.o terminology-app_server.o terminology-app_server_eet.o -lelementary -lm -lefreet_mime -lefreet_trash -ledbus -ldbus-1 -lecore_con -leina -lpthread -leet -levas -lecore -lecore_evas -lecore_file -ledje -lemotion -lecore_input -lecore_imf -lecore_imf_evas -lecore_ipc -lefreet -lethumb_client   -leldbus 

在正确的目录下运行此命令并添加-v选项,我得到以下输出:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.8.2-16' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.2 (Debian 4.8.2-16) 
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-g' '-O2' '-o' 'terminology' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/4.8/collect2 --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o terminology /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/4.8 -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../.. terminology-about.o terminology-col.o terminology-config.o terminology-controls.o terminology-ipc.o terminology-keyin.o terminology-main.o terminology-media.o terminology-options.o terminology-options_font.o terminology-options_theme.o terminology-options_themepv.o terminology-options_wallpaper.o terminology-options_colors.o terminology-options_behavior.o terminology-options_keys.o terminology-options_helpers.o terminology-options_video.o terminology-sel.o terminology-termio.o terminology-termcmd.o terminology-termiolink.o terminology-termpty.o terminology-termptydbl.o terminology-termptyesc.o terminology-termptyops.o terminology-termptygfx.o terminology-termptyext.o terminology-termptysave.o lz4/terminology-lz4.o terminology-utf8.o terminology-win.o terminology-utils.o terminology-dbus.o terminology-extns.o terminology-app_server.o terminology-app_server_eet.o -lelementary -lm -lefreet_mime -lefreet_trash -ledbus -ldbus-1 -lecore_con -leina -lpthread -leet -levas -lecore -lecore_evas -lecore_file -ledje -lemotion -lecore_input -lecore_imf -lecore_imf_evas -lecore_ipc -lefreet -lethumb_client -leldbus -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/4.8/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crtn.o
/usr/bin/ld: cannot find -lecore_input
collect2: error: ld returned 1 exit status

当然,libecore_input已经安装:
$ sudo updatedb
$ locate ecore_input.so
/usr/lib/x86_64-linux-gnu/libecore_input.so
/usr/lib/x86_64-linux-gnu/libecore_input.so.1
/usr/lib/x86_64-linux-gnu/libecore_input.so.1.7.7

同时,/usr/lib/x86_64-linux-gnu/ 出现在 gcc 输出的 LIBRARY_PATH 中,并且作为 collect2 命令的 -L 选项出现时,我也尝试使用 gcc-4.7 时遇到了同样的错误。这里出了什么问题?我该如何构建程序?

更新

由于原因实际上是打包问题,我应该补充说明我正在使用混合的 testing/unstable 存储库的 Debian Jessie。

2个回答

0

这是由于Debian打包问题和使用混合的testing/unstable仓库导致的,/usr/lib/x86_64-linux-gnu/libecore_input.so成为了一个死链接。

/usr/lib/x86_64-linux-gnu/libecore_input.so链接是libecore-dev软件包的一部分,而库本身是libecore-input1的一部分。安装的libecore-dev版本是1.8.6-1,而libecore-input1的版本是1.7.7。因此,libecore_input.so链接的目标是libecore_input.so.1.8.6,但该文件并不存在。虽然libecore-dev对其他库有版本依赖关系,但libecore-input1是一个间接依赖项,没有正确地进行版本控制。这可能是一个错误,因为如果一个软件包包含对共享库的链接,那么它的依赖关系应该确保安装了正确的库版本。

解决方案就是升级libecore-input软件包。

-1

实际上,我有这样的印象,即包含文件夹/usr/lib/x86_64-linux-gnu/并没有像你在关闭问题时所声称的那样被包含在“collect2命令”中。仔细看一下:它确实在LD_LIBRARY_PATH中提到(在链接时不重要),但它没有作为-L标志出现在COLLECT_GCC_OPTIONS输出中。那里只有一个文件夹/usr/lib/gcc/x86_64-linux-gnu/4.8/collect2

我建议您更改它并重新尝试链接。


不,它很明显是作为“-L”选项存在的。虽然没有尾随的“/”,但如果您在浏览器上使用查找功能,就会看到它。此外,它不是“LD_LIBRARY_PATH”,而是“LIBRARY_PATH”,这对于“gcc”很有兴趣,因为其命令行上没有“-L”选项。 - Graeme
有趣的是,这正是我昨天所做的,这就是我写这篇文章的原因。今天我确实看到了正确的“-L”标志。奇怪... - arkascha
可能是添加了尾部斜杠。无论如何,这个问题已经解决了,它是一个Debian打包问题。/usr/lib/x86_64-linux-gnu/libecore_input.so实际上是一个死链接。我会发布一个答案来解决这个问题。 - Graeme
啊,确实,“存在”这个描述有误导性。显然每个人都期望这是一个实际的文件,但我可以理解为什么会出现这种情况。奇怪的问题,尤其是在 Debian 包中,因为 Debian 被认为比其他 GNU/Linux 发行版更经过测试... - arkascha
是的,最终只需要运行一个简单的 ls -l 命令就能揭示问题所在。归根结底,这是由于错误的软件包依赖关系导致的,尽管运行混合测试/不稳定的 Debian 系统也没有帮助解决问题。 - Graeme

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接