0

我们要使用 crosstool-NG ct-ng 编译定义的 linux x86 32Bit 工具链:

glibc 2.9
gcc 4.8.4

我正在使用 ubuntu 14.04 32Bit:
Linux ubuntu 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 17:45:15 UTC 2015 i686 i686 i686 GNU/Linux。

crosstool-NG 失败并显示:
Build failed in step 'Installing C library headers & start files'

在编译时

/home/user/crosstool-x86-linux-32/.build/i386-unknown-linux-gnu/build/build-libc-startfiles/csu/crtn.o

它失败了几个汇编程序消息:

[ALL ] /tmp/ccCj5ny0.s: Assembler messages: [ALL ] /tmp/ccCj5ny0.s:92: Error: can't resolve .LFE8' {*UND* section} -.LFB8' {UND section} (和类似的错误......)
在那个特定问题之前,我们遇到了一个类似的问题

../sysdeps/generic/initfini.c: Assembler messages: ../sysdeps/generic/initfini.c:123: Error: open CFI at the end of file; missing .cfi_endproc directive ../sysdeps/generic/initfini.c:123: Error: open CFI at the end of file; missing .cfi_endproc directive

我们在这篇文章http://www.openwall.com/lists/owl-dev/2011/10/中找到的 target/host/build cflags 中使用“-fno-dwarf2-cfi-asm”暂时“修复”了错误18/4

这把我们带到了这里……

我很想知道这个错误的根源是什么,除了 glibc 太旧(它可能是......)。

ct-ng 的 .config 和 build.log 见附件。 http://s000.tinyupload.com/download.php?file_id=60582934753963239188&t=6058293475396323918817262

4

1 回答 1

1

我已经做了很长一段时间了,我通过修补 ./.build/src/glibc-2.9/sysdeps/i386/Makefile 解决了这个特殊问题:

ifeq ($(subdir),csu)
CFLAGS-initfini.s += -fno-unwind-tables -fno-asynchronous-unwind-tables
endif

ifeq ($(subdir),nptl)
CFLAGS-pt-initfini.s += -fno-unwind-tables -fno-asynchronous-unwind-tables
endif

修复后我遇到了问题

[ALL  ]    make[3]: *** No rule to make target `.build/i386-unknown-linux-gnu/build/build-libc-final/nptl/pthread_spin_trylock.o', needed by `lib-noranlib'.  Stop.

根据这篇文章: https://sourceware.org/ml/crossgcc/2012-06/msg00023.html 通过将 CT_ARCH_CPU 和 CT_ARCH_TUNE 设置为 i686 来解决。

我的 crosstool-NG 版本 (crosstool-ng-1.21.0-41-gc45cfb5) 显示

Target-options->Tune for CPU

只有当

Target-options->Emit assembly for CPU

是空的。我假设使用mcpu为 CPU发射程序集可能会给我相同的结果。

为了避免这个问题集(如上面的链接所示)

Target-options->Emit assembly for CPU

到i686。

于 2015-07-17T09:06:03.837 回答