从aarch64从x86_64交叉编译GLIBC缺少asm/prctl.h

问题描述 投票:0回答:2

我正在尝试在 aarch64 上从头开始为 amd64 编译 Linux,一切都很顺利,直到我为 GLIBC 运行

make -j1
时出现此错误第 5.5 章 我已经尝试了所有方法,但在网上找不到任何类似的错误。

In file included from ../sysdeps/x86_64/nptl/tls.h:23,
                 from ../include/link.h:51,
                 from <stdin>:1:
../sysdeps/unix/sysv/linux/x86/include/asm/prctl.h:5:15: fatal error: asm/prctl.h: No such file or directory
    5 | #include_next <asm/prctl.h>
      |               ^~~~~~~~~~~~~
compilation terminated.
Traceback (most recent call last):
  File "/mnt/lfs/sources/glibc-2.35/csu/../scripts/gen-as-const.py", line 120, in <module>
    main()
  File "/mnt/lfs/sources/glibc-2.35/csu/../scripts/gen-as-const.py", line 116, in main
    consts = glibcextract.compute_c_consts(sym_data, args.cc)
  File "/mnt/lfs/sources/glibc-2.35/scripts/glibcextract.py", line 62, in compute_c_consts
    subprocess.check_call(cmd, shell=True)
  File "/usr/lib64/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'x86_64-lfs-linux-gnu-gcc -std=gnu11 -fgnu89-inline  -g -O2 -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fno-stack-protector -fno-common -Wstrict-proto>
make[2]: *** [../Makerules:271: /mnt/lfs/sources/glibc-2.35/build/rtld-sizes.h] Error 1
make[1]: *** [Makefile:483: csu/subdir_lib] Error 2
make: *** [Makefile:9: all] Error 2
c cross-compiling glibc osdev linux-from-scratch
2个回答
0
投票

在您的构建文件夹中,尝试使用最小配置,然后使用带有 -j 标志的 make 命令(这将使用所有可用线程,并且您不需要指定数字),

../configure --prefix=/opt/glibc-2.35
make -j
sudo make install

尽管我建议采取极端预防措施,因为在更改 GLIBC 文件时很可能会弄乱你的内核


0
投票

我也尝试在 aarch64 机器上从头开始编译 linux。 这是我找到的解决方案:在上一步中,linux api header 安装,而不是“make headers”,而是“make ARCH=x86_64 headers” 最好

© www.soinside.com 2019 - 2024. All rights reserved.