链接到特定的GLIBC版本

Link with specific GLIBC version

本文关键字:GLIBC 版本 链接      更新时间:2023-10-16

我正在使用一台带有交叉编译程序的远程主机,以便构建和部署cpp代码到BeagleBone Black。我的问题是,由于我试图用<time.h>函数运行我的代码,我得到了一条消息:

/lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.17' not found (required by /home/debian/app)

所以我用ldd --version检查了我在BBB上得到的版本,得到了:

ldd (Debian EGLIBC 2.13-38+deb7u8) 2.13
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

有没有办法告诉我的交叉编译程序在链接时使用GLIBC 2.13版本而不是2.17?很少有研究向我提供信息,在BBB上更新GLIBC不是一个简单的解决方案,所以我想知道这种方法。我会感谢所有的帮助。

经过大量实验,我发现了这个解决方案。可以在Beaglebone Black上将libc版本更新到2.17。首先从以下位置下载libc6_2.17-ubuntu5_armhf.deb(用于使用硬浮点进行编译)或libc6-armel_2.17-uubuntu5.1_armhf.debhttps://launchpad.net/ubuntu/raring/armhf/libc6/2.17-0ubuntu5或https://launchpad.net/ubuntu/raring/armhf/libc6-armel/2.17-0ubuntu5.1分别地

接下来,使用scp将文件复制到BBB。

scp libc6_2.17-0ubuntu5_armhf.deb root@beaglebone.local:/root
scp libc6-armel_2.17-0ubuntu5.1_armhf.deb root@beaglebone.local:/root

最后,安装软件包。

sudo dpkg --install libc6_2.17-0ubuntu5_armhf.deb
sudo dpkg --install libc6-armel_2.17-0ubuntu5.1_armhf.deb

它适用于我的设备上需要新版本的功能,尽管ldd --version仍显示为2.13。您还可以考虑使用sudo apt-get -f install来摆脱旧版本。

希望它能有所帮助!