我正在使用带有交叉编译器的远程主机电脑来构建 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。首先从 https://launchpad.net/ubuntu/raring/armhf/libc6/2.17-0ubuntu5 下载 libc6_2.17-0ubuntu5_armhf.deb (用于使用硬 float 编译)或 libc6-armel_2.17-0ubuntu5.1_armhf.deb (用于使用软 float 编译)或https://launchpad.net/ubuntu/raring/armhf/libc6-armel/2.17-0ubuntu5.1分别。
接下来,使用 scp 将文件复制到 BBB。
scp libc6_2.17-0ubuntu5_armhf.deb <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f98b96968db99b9c989e959c9b96979cd795969a9895" rel="noreferrer noopener nofollow">[email protected]</a>:/root
scp libc6-armel_2.17-0ubuntu5.1_armhf.deb <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2d5f4242596d4f484c4a41484f4243480341424e4c41" rel="noreferrer noopener nofollow">[email protected]</a>:/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
来摆脱旧版本。
希望对你有帮助!
关于c++ - 与特定 GLIBC 版本的链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31143024/