gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 17:17:41 28 4
gpt4 key购买 nike

我正在尝试使用最新的 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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com