为什么编译glibc时Make挂起?

vuktfyat  于 2023-10-16  发布在  其他
关注(0)|答案(1)|浏览(304)

我正在尝试构建一个aarch 64交叉编译器来为我的Raspberry Pi 3B构建东西。我一直在使用一个有用的脚本来为我构建gcc(原始脚本,mine filled in-注意这包含了我正在使用的库的版本)。在构建glibc时,它可以:

...
make  subdir=setjmp -C setjmp ..=../ subdir_lib
make  subdir=signal -C signal ..=../ subdir_lib
make  subdir=stdlib -C stdlib ..=../ subdir_lib
make  subdir=stdio-common -C stdio-common ..=../ subdir_lib

……然后无限期地被绞死。我把这件事搁了一夜,但还是没有完成。make似乎只是占用了一整个核心,偶尔会把内存还给操作系统,然后再占用一些。没有gcc进程或任何东西正在运行。
因为似乎libc.so最终还是被构建了,我尝试在GCC构建文件夹(build-gcc)中手动运行make all,但我得到了:

checking dynamic linker characteristics... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.

不确定这是否相关。
这是怎么回事?如果你能帮忙的话,我将不胜感激。谢谢.

  • 主机操作系统:阿蒂克斯Linux x64
  • 主机gcc:13.1.1
  • make:GNU make 4.4.1
ttcibm8c

ttcibm8c1#

TL;DR这是旧版glibc Makefiles和Make v4.4+的一个问题,其中构建图会受到干扰,并且stdio-common会不断重新评估和重建。因此,要么降级make,要么升级glibc版本到一个更新得多的版本。

我在Buildroot和crosstools-NG中也遇到了这种情况。
修改glibc的Makefile,以便跟踪stdio-common的make:

# The action for each of those is to cd into the directory and make the
# target there.
$(all-subdirs-targets):
        @if [ "$@" = "stdio-common/subdir_lib" ]; then \
                echo "Running debug command for $@"; \
                $(MAKE) -d $(PARALLELMFLAGS) $(subdir-target-args) $(@F); \
        else \
                echo "Running default command for $@"; \
                $(MAKE) $(PARALLELMFLAGS) $(subdir-target-args) $(@F); \
        fi

我可以在输出中看到以下内容,表明相同的构建被一遍又一遍地重新执行:

Considering target file '/home/boran/git/buildroot-2020.02.3/output/build/glibc-2.30-67-g4748829f86a458b76642f3e98b1d80f7b868e427/build/bits/stdio_lim.d'.
 File '/home/boran/git/buildroot-2020.02.3/output/build/glibc-2.30-67-g4748829f86a458b76642f3e98b1d80f7b868e427/build/bits/stdio_lim.d' was considered already.
Re-executing[48]: make -d subdir=stdio-common -C stdio-common ..=../ subdir_lib

这是发生在subdir_lib,others和subdir_install规则访问stdio-common的时候,这就是为什么你会得到一个libc.so,因为这都是后期构建。
使用一个不那么冗长的输出,我们可以看到(对于stdio-common/others目标,一些文件被重新标记并强制重建):我有一些更多的信息,从stdio-common/others。看起来确实是为每个调用创建了.stmp和.st文件。

Re-executing[30]: /usr/bin/make --debug=Makefile subdir=stdio-common -C stdio-common ..=../ others
GNU Make 4.4.1
Built for x86_64-redhat-linux-gnu
Copyright (C) 1988-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating makefiles....
  Prerequisite '/home/boran/git/buildroot-2020.02.3/output/build/glibc-2.30-67-g4748829f86a458b76642f3e98b1d80f7b868e427/build/versions.stmp' is newer than target '/home/boran/git/buildroot-2020.02.3/output/build/glibc-2.30-67-g4748829f86a458b76642f3e98b1d80f7b868e427/build/sysd-versions'.
     Prerequisite '/home/boran/git/buildroot-2020.02.3/output/build/glibc-2.30-67-g4748829f86a458b76642f3e98b1d80f7b868e427/build/libc-modules.stmp' is newer than target '/home/boran/git/buildroot-2020.02.3/output/build/glibc-2.30-67-g4748829f86a458b76642f3e98b1d80f7b868e427/build/libc-modules.h'.
    Must remake target '/home/boran/git/buildroot-2020.02.3/output/build/glibc-2.30-67-g4748829f86a458b76642f3e98b1d80f7b868e427/build/libc-modules.h'.
    Successfully remade target file '/home/boran/git/buildroot-2020.02.3/output/build/glibc-2.30-67-g4748829f86a458b76642f3e98b1d80f7b868e427/build/libc-modules.h'.
     Prerequisite '/home/boran/git/buildroot-2020.02.3/output/build/glibc-2.30-67-g4748829f86a458b76642f3e98b1d80f7b868e427/build/dl-tunable-list.stmp' is newer than target '/home/boran/git/buildroot-2020.02.3/output/build/glibc-2.30-67-g4748829f86a458b76642f3e98b1d80f7b868e427/build/dl-tunable-list.h'.
    Must remake target '/home/boran/git/buildroot-2020.02.3/output/build/glibc-2.30-67-g4748829f86a458b76642f3e98b1d80f7b868e427/build/dl-tunable-list.h'.
    Successfully remade target file '/home/boran/git/buildroot-2020.02.3/output/build/glibc-2.30-67-g4748829f86a458b76642f3e98b1d80f7b868e427/build/dl-tunable-list.h'.
     Prerequisite '/home/boran/git/buildroot-2020.02.3/output/build/glibc-2.30-67-g4748829f86a458b76642f3e98b1d80f7b868e427/build/bits/stdio_lim.st' is newer than target '/home/boran/git/buildroot-2020.02.3/output/build/glibc-2.30-67-g4748829f86a458b76642f3e98b1d80f7b868e427/build/bits/stdio_lim.h'.
    Must remake target '/home/boran/git/buildroot-2020.02.3/output/build/glibc-2.30-67-g4748829f86a458b76642f3e98b1d80f7b868e427/build/bits/stdio_lim.h'.
    Successfully remade target file '/home/boran/git/buildroot-2020.02.3/output/build/glibc-2.30-67-g4748829f86a458b76642f3e98b1d80f7b868e427/build/bits/stdio_lim.h'.
Re-executing[31]: /usr/bin/make --debug=Makefile subdir=stdio-common
-C stdio-common ..=../ others

我在想为什么...
作为解决方案,这里有一个修改后的规则,它可以成功地构建所有内容,但是你必须让每个步骤先挂起一次(显然,步骤在重新运行时挂起):

# The action for each of those is to cd into the directory and make the
# target there.
$(all-subdirs-targets):
        @if [ "$@" = "stdio-common/subdir_lib" ]; then \
                echo "Skipping make command for $@"; \
        elif [ "$@" = "stdio-common/others" ]; then \
                echo "Skipping make command for $@"; \
        elif [ "$@" = "stdio-common/subdir_install" ]; then \
                touch stdio-common/stubs \
                echo "Skipping make command for $@"; \
        else \
                $(MAKE) $(PARALLELMFLAGS) $(subdir-target-args) $(@F); \
        fi

相关问题