【问题标题】:How to fix GLIBC version mismatch between target and build machine?如何修复目标和构建机器之间的 GLIBC 版本不匹配?
【发布时间】:2021-11-01 01:39:45
【问题描述】:

我正在为嵌入式设备 (Moxa UC-8100) 交叉编译应用程序,并且遇到了 GLIBC 版本问题。

我安装了 Debian 9(按照嵌入式设备供应商的指示)并使用 arm-linux-gnueabihf 工具链。在设备上运行我的构建时,它说

moxa@Moxa:~$ ./fabs-uc8100 -h
./fabs-uc8100: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.17' not found (required by ./fabs-uc8100)
./fabs-uc8100: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.16' not found (required by ./fabs-uc8100)

当我在设备上运行ldd --version 时,我可以看到它的版本为 2.13:

moxa@Moxa:~$ ldd --version
ldd (Debian EGLIBC 2.13-38+deb7u8) 2.13

所以,问题很明确(我的程序是用 2.16 构建的,但我有 2.13 可用),但我该如何解决这个问题?

更新我在 Debian 9 64 位 VM 上使用 standard Debian packages, including some Moxa packages 安装了交叉编译工具链:

deb http://debian.moxa.com/debian stretch main contrib non-free 添加到/etc/apt/sources.list.d/moxa.sources.list,然后:

user@Linux:~$ apt-get install moxa-archive-keyring
user@Linux:~$ dpkg --add-architecture armhf
user@Linux:~$ apt-get install crossbuild-essential-armhf
user@Linux:~$ apt-get install libssl-dev:armhf

【问题讨论】:

    标签: arm embedded cross-compiling glibc eglibc


    【解决方案1】:

    根据 Linaro 邮件列表中的 thread,您可能有机会获得 gcc-linaro-arm-linux-gnueabi-2012.03-20120326_linux.tar.bz2 可用的 here

    wget http://releases.linaro.org/archive/12.03/components/toolchain/binaries/gcc-linaro-arm-linux-gnueabi-2012.03-20120326_linux.tar.bz2
    tar jxf gcc-linaro-arm-linux-gnueabi-2012.03-20120326_linux.tar.bz2
    
    gcc-linaro-arm-linux-gnueabi-2012.03-20120326_linux/bin/arm-linux-gnueabi-gcc --version
    arm-linux-gnueabi-gcc (crosstool-NG linaro-1.13.1-2012.03-20120326 - Linaro GCC 2012.03) 4.6.3
    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.
    
    strings gcc-linaro-arm-linux-gnueabi-2012.03-20120326_linux/arm-linux-gnueabi/libc/lib/arm-linux-gnueabi/libc.so.6 | grep 2.13
    GLIBC_2.13
    GNU C Library (Ubuntu EGLIBC 2.13-20ubuntu5) stable release version 2.13, by Roland McGrath et al.
    2.13
    NPTL 2.13
    glibc 2.13
    libc-2.13.so
    

    如果您使用的是 Linux x86_64 系统,您可能需要添加执行 x86 二进制文件所需的包,以防它们尚未安装 - 我使用的是 Ubuntu 20.04.3 LTS。

    【讨论】:

    • 我试了一下,但二进制文件无法在我的系统上运行
    【解决方案2】:

    我该如何解决这个问题?

    您需要在构建主机上安装 EGLIBC-2.13 并配置您的交叉编译器以使用它(显然它当前正在使用 GLIBC-2.17 或更高版本)。

    由于您没有提供有关交叉编译器来源或构建设置的详细信息,因此您不能指望有人能够准确地告诉您当前设置有什么问题。

    【讨论】:

    • 我更新了我如何安装工具链的问题。
    • 我设法让 Ubuntu DEB 降级我的工具链。有用。谢谢!
    猜你喜欢
    • 1970-01-01
    • 2011-01-27
    • 1970-01-01
    • 2018-12-19
    • 1970-01-01
    • 1970-01-01
    • 2017-01-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多