You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Cygwin下用crossingtool-ng编译glibc遇rtld-Rules Makefile错误

解决Cygwin下crosstool-ng编译glibc的rtld-Rules错误

错误信息

[ALL  ]      rtld-Rules:40: *** This makefile is a subroutine of elf/Makefile not to be used directly.  Stop.
[ALL  ]      make[4]: Leaving directory '/build/src/glibc-2.38/elf'
[ERROR]      make[3]: *** [Makefile:1315: /build/x86_64-pc-linux-gnu/build/build-libc/multilib/elf/rtld-libc.a] Error 2
[ERROR]      make[3]: *** Waiting for unfinished jobs....
[ALL  ]      make[3]: Leaving directory '/build/src/glibc-2.38/elf'
[ERROR]      make[2]: *** [Makefile:484: elf/subdir_lib] Error 2
[ALL  ]      make[2]: Leaving directory '/build/src/glibc-2.38'
[ERROR]      make[1]: *** [Makefile:9: all] Error 2
[ALL  ]      make[1]: Leaving directory '/build/x86_64-pc-linux-gnu/build/build-libc/multilib'

配置命令

/build/x86_64-pc-linux-gnu/src/glibc/configure --prefix=/usr --build=x86_64-build_pc-cygwin --host=x86_64-pc-linux-gnu --cache-file=/build/x86_64-pc-linux-gnu/build/build-libc/multilib/config.cache --without-cvs --disable-profile --without-gd --with-headers=/x-tools/}x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sysroot/usr/include --disable-debug --disable-sanity-checks --enable-kernel=6.5.5 --with-__thread --with-tls --enable-shared --enable-add-ons=no

解决方案

  • 修复路径笔误:配置命令中--with-headers参数的路径里多了一个多余的}字符,正确路径应为:

    --with-headers=/x-tools/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sysroot/usr/include
    

    这个错误会导致头文件路径解析异常,进而触发后续makefile调用逻辑错误。

  • 禁用multilib编译:从错误栈看,问题出在multilib构建流程中。Cygwin环境下交叉编译glibc时,multilib模式容易出现兼容性问题,建议在configure参数中添加--disable-multilib,或者在crosstool-ng的图形配置界面中关闭multilib选项。

  • 清理构建环境重新编译:之前的错误可能导致构建目录残留了错误生成的文件,执行以下操作清理后重新配置编译:

    make clean
    rm -rf /build/x86_64-pc-linux-gnu/build/build-libc/multilib
    
  • 检查Cygwin依赖完整性:确保已安装Cygwin下所有必要的编译工具包,包括:

    • make、gcc-core、gcc-g++
    • binutils、flex、bison
    • gettext-devel、libncurses-devel
      缺少依赖可能导致构建流程出现非预期的makefile调用错误。

内容的提问来源于stack exchange,提问作者7dog123

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 13:00:23