raspberry-pi2 - Raspberry Pi - fatal error : sys/cdefs. h:没有这样的文件或目录

标签 raspberry-pi2 libgcc gcc5

我正在尝试使用最新的 Raspbian 系统镜像在我的 Raspberry Pi 上编译 gcc5.3.0。

$ ./configure --enbale-checking=release --enable-languages=c,c++,fortran --host=arm-cortexa7_neon-linux-gnueabihf --build=arm-cortexa7_neon-linux-gnueabihf --target=arm-cortexa7_neon-linux-gnueabihf
$ make

但是,原来的编译器(gcc4.9)在编译 libgcc 时提示没有创建 sys/cdefs.h。

我检查了我有 libc6-devbuild-essential安装。

所以我用了grep -R 'cdefs' /usr/include/搜索它,我在/usr/include/bsd/找到它。我创建了 sys 目录并在/usr/include/bsd/sys 下创建了指向这些头文件的硬链接(hard link)。

这次它给了我一个更奇怪的错误,
/usr/include/stdio.h:312:8:错误:未知类型名称"file"。

我在stackoverflow上搜索了这个,有一个类似的问题,https://stackoverflow.com/a/21047237/5691005 .但是当我删除/usr/include/sys和/usr/include/bsd,然后重新安装libc6-dev时,在/usr/include下找不到sys/cdefs.h,编译器仍然报错。

我现在完全迷路了。任何建议将不胜感激。

最佳答案

我在编译 gcc-8.2 时遇到了类似的问题。我试着按照 here 的描述做重新安装:

sudo apt-get --reinstall install libc6 libc6-dev

之后,我找到了所有丢失的标题:
find / -name cdefs.h 

并将它们复制到/usr/include:
这些步骤只允许继续前进,但我仍然没有设法完全构建 gcc。

我找到的最佳解决方案是从以下位置下载 gcc-8.1 的编译版本:
https://solarianprogrammer.com/2017/12/07/raspberry-pi-raspbian-compiling-gcc/

关于raspberry-pi2 - Raspberry Pi - fatal error : sys/cdefs. h:没有这样的文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35822377/

相关文章:

linux - boost::thread::try_join_for() 函数出错

python - 我可以在 Raspberry Pi 2 Model B 上将 picamera 与此版本的 Ubuntu 一起使用吗?

c - 树莓派无法通过串口通信向PC发送数据

gcc - 裸机 mod (%) 在带有 libgcc 的 ARMv6 上挂起

python - anaconda2找不到GOMP_4.0

linux - GCC 在构建 libgcc 时依赖于 GNU 汇编器?

c++ - 在使用 C++ 的虚拟继承期间调用构造函数

java - 客户端 Linux : how to start the daemon from code?

linux - 树莓派上的 Ubuntu Mate 卡在颜色测试屏幕上 : first boot

arm - 在 gcc 版本 5.0.1 上启用对 aarch64 (armv8-a) 的 fpu 支持