【问题标题】:Building glibc for cross compiler fails on Cygwin在 Cygwin 上为交叉编译器构建 glibc 失败
【发布时间】:2015-08-09 13:16:28
【问题描述】:

我正在尝试在 Windows 上的 Cygwin 下构建一个交叉编译器工具链,以便我(或者更确切地说是我正在帮助的人 - 我会使用 Linux,但 Windows 对许多人来说更容易)可以编译针对MIPS 架构。

我有一个脚本,它使用以下代码在 Linux 上的 x86_64 下成功构建了 MIPS 的交叉编译器工具链:

https://github.com/UoMCS/mips-cross-compile/tree/glibc

但是,当我在 Cygwin 下运行脚本时,它在 glibc install-headers 阶段失败并出现以下错误:

gcc   -D_RPC_THREAD_SAFE_ -D_GNU_SOURCE -DIS_IN_build -include /home/Cygwin/xc/mips-linux/tmp/build-glibc/config.h rpc_main.c \
        -o /home/Cygwin/xc/mips-linux/tmp/build-glibc/sunrpc/cross-rpc_main.o -MMD -MP -MF /home/Cygwin/xc/mips-linux/tmp/build-glibc/sunrpc/cross-rpc_main.o.dt -MT /home/Cygwin/xc/mips-linux/tmp/build-glibc/sunrpc/cross-rpc_main.o -c
rpc_main.c: In function ‘find_cpp’:
rpc_main.c:329:17: error: storage size of ‘buf’ isn’t known
   struct stat64 buf;
                 ^
rpc_main.c: In function ‘checkfiles’:
rpc_main.c:1117:17: error: storage size of ‘buf’ isn’t known
   struct stat64 buf;
                 ^
Makefile:163: recipe for target '/home/Cygwin/xc/mips-linux/tmp/build-glibc/sunrpc/cross-rpc_main.o' failed
make[2]: *** [/home/Cygwin/xc/mips-linux/tmp/build-glibc/sunrpc/cross-rpc_main.o] Error 1
make[2]: Leaving directory '/home/Cygwin/xc/mips-linux/tmp/glibc-2.21/sunrpc'
Makefile:213: recipe for target 'sunrpc/install-headers' failed
make[1]: *** [sunrpc/install-headers] Error 2
make[1]: Leaving directory '/home/Cygwin/xc/mips-linux/tmp/glibc-2.21'
Makefile:9: recipe for target 'install-headers' failed
make: *** [install-headers] Error 2

鉴于 binutils、GCC、glibc 和内核的源文件是相同的(全部由构建脚本自动下载),我不确定为什么在 Cygwin 而不是 Linux 下会出现此错误。通过搜索相同的错误消息,我找不到任何有用的提示。谁能提出可能是什么问题?

我在宿主环境中使用以下软件:

  • Windows 7 64 位
  • Cygwin 2.0.0(64 位)
  • GCC 4.9.2

【问题讨论】:

    标签: windows gcc cygwin cross-compiling glibc


    【解决方案1】:

    如 Cygwin 的 FAQ 中所述。 Cygwin 不使用 stat64。 可以尝试手动或通过定义将stat64 替换为stat

    【讨论】:

    • 谢谢。看起来 glibc 根本无法工作 - 我真的不想为了让它构建它而不得不破解源代码,以防破坏很多其他东西(我会快速尝试一下基本的搜索/替换)。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-03
    • 1970-01-01
    • 2018-08-05
    • 2013-10-09
    • 2017-06-06
    • 1970-01-01
    相关资源
    最近更新 更多