【问题标题】:Cross-compiling GLibC 2.24 fails with Error 1交叉编译 GLibC 2.24 失败并出现错误 1
【发布时间】:2017-06-06 08:08:48
【问题描述】:

我正在尝试使用 gcc-arm-linux-androideabi 编译器交叉编译 GLibC 2.24 for ARM (Android)。这是我使用的 ./configure 语法:

../glibc-2.24/configure --prefix=/usr --host=arm-linux-androideabi --with-headers=/usr/include

但是,当我运行 make 时,它​​会失败并出现以下错误:

In file included from
../sysdeps/arm/libc-tls.c:19:0:
../csu/libc-tls.c: In function '__libc_setup_tls':
../csu/libc-tls.c:191:1: error: '__ARM_NR_set_tls' undeclared (first use in this function)
../csu/libc-tls.c:191:1: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [/home/red/glibc-build/csu/libc-tls.o] Error 1
make[2]: Leaving directory `/home/red/glibc-2.24/csu'
make[1]: *** [csu/subdir_lib] Error 2
make[1]: Leaving directory `/home/red/glibc-2.24'
make: *** [all] Error 2

我在网上浏览了它发生的原因,但没有找到任何东西。此错误的原因可能是什么?

我正在运行 Ubuntu 14.04.5 LTS 64 位。

【问题讨论】:

    标签: android linux makefile cross-compiling glibc


    【解决方案1】:

    我正在运行 Ubuntu 14.04.5 LTS 64 位。

    这是一个毫无意义的陈述。 64位什么的?是sparc64aarch64x86_64,还是别的什么?

    您很可能正在使用x86_64。在这种情况下,您使用 configure 都错了。 --host=arm-linux-androideabi 告诉 configure 你正在构建一个 ARM linux 机器,这与事实相去甚远。

    您可能的意思是您想为arm-linux-androideabi 构建目标,在这种情况下正确的configure 命令类似于:

    configure --target=arm-linux-androideabi --prefix=/usr ...
    

    您的--with-headers 设置也很可能不正确:您几乎肯定不想使用来自x86_64 主机的/usr/include 来构建arm 目标。

    【讨论】:

    • 谢谢,用--target替换--host就可以了。
    • 错了! “--host”是生成的二进制文件将在其上运行的机器,而不是您正在构建的机器! “--build”是你正在编译的机器。
    猜你喜欢
    • 2017-02-11
    • 1970-01-01
    • 2021-07-08
    • 2015-08-09
    • 1970-01-01
    • 1970-01-01
    • 2011-05-20
    • 2014-07-03
    • 2014-07-02
    相关资源
    最近更新 更多