c++ - 与特定 GLIBC 版本的链接

标签 c++ linux cross-compiling glibc beagleboneblack

我正在使用带有交叉编译器的远程主机电脑来构建 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/

相关文章:

linux - 每 30 分钟运行一次脚本 bash

linux - 通过 Jenkins 远程执行脚本的最佳方法是什么

cross-compiling - rpath-link在交叉编译中如何使用?

c++ - 被释放的指针未分配给指针赋值

c++ - visual studio 2005 C++ 包含路径

c++进程不会停止

c++ - 从 Mac 为 WIndows、Linux 交叉编译 C++/QT

c++ - 图像到 ASCII 艺术转换

linux - sudo apachectl restart httpd.service 作业失败。详细信息请参见 'systemctl status httpd.service' 和 'journalctl -xn'

即使库链接,DLL 也会被忽略