【发布时间】:2019-05-20 17:21:02
【问题描述】:
我目前正在尝试为aarch64-linux-gnu 目标编译我自己的 gcc 9.1.0 交叉编译器。我用过这个教程:https://wiki.osdev.org/GCC_Cross-Compiler
gcc 和 g++ 编译器的编译进度似乎没有错误地完成,但是当我尝试使用命令 libgcc 编译 make all-target-libgcc 时总是遇到此错误:
In file included from ../../../gcc-9.1.0/libgcc/gthr.h:148,
from ../../../gcc-9.1.0/libgcc/libgcov-interface.c:27:
./gthr-default.h:35:10: fatal error: pthread.h: No such file or directory
35 | #include <pthread.h>
| ^~~~~~~~~~~
compilation terminated.
g++ --version 在我的构建机器上打印:
g++ (GCC) 9.1.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
我对@987654328@ 的配置命令是:
../gcc-9.1.0/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --without-headers
与:
export TARGET=aarch64-linux-gnu
export PREFIX=/opt/aarch64-linux-gnu
我忘记了什么?
【问题讨论】:
-
pthread.h是一个 glibc 头文件,由包 glibc-devel / libc6-dev ...提供。包名取决于你使用的操作系统。 -
为什么没有找到 pthread?
pthread.h是否应该在 gcc 构建树中?我的意思是我可以通过find找到它。 -
编译器应该使用构建的
pthread.h还是主机的pthread.h?