0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示

编译OpenWRT出错m4如何解决呢?

嵌入式加油站 来源:嵌入式加油站 2023-07-14 10:35 次阅读

编译m4-1.4.17库时出现关于 freadahead.c中编译错误

现象

出错提示如下 :

freadahead.c: In function 'freadahead':
freadahead.c3: error: #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
91 |#error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
.........
make[1]: *** [tools/Makefile /home/fan/openwrt_CC_mt76xx_zhuotk_source/staging_dir/target-mipsel_mips32_uClibc-0.9.33.2/stamp/.tools_install_yynyynynynyyyyyyyyynyyyyyyyyynyyyyynnyyynnyynnnyy] Error 2
make[1]: Leaving directory '/home/fan/openwrt_CC_mt76xx_zhuotk_source'
make: *** [/home/fan/openwrt_CC_mt76xx_zhuotk_source/include/toplevel.mk world] Error 2

解决方法
进入文件夹
/buildroot/output/build/host-m4-1.4.17
cd build_dir/host/m4-1.4.17/
输入命令:
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
#error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib

编译findutils-4.4.2时 同样有freadahead.c文件错误

现象
出错提示如下:
freadahead.c: In function 'freadahead':
freadahead.c3: error: #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread on your system, then report this to bug-gnulib."
#error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread on your
^
make[8]: *** [Makefile freadahead.o] Error 1
make[8]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/findutils-4.4.2/gnulib/lib'
make[7]: *** [Makefile all] Error 2
make[7]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/findutils-4.4.2/gnulib/lib'
make[6]: *** [Makefile all-recursive] Error 1
make[6]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/findutils-4.4.2/gnulib'
make[5]: *** [Makefile all-recursive] Error 1
make[5]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/findutils-4.4.2'
make[4]: *** [Makefile all] Error 2
make[4]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/findutils-4.4.2'
make[3]: *** [Makefile /home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/findutils-4.4.2/.built] Error 2
make[3]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/tools/findutils'
make[2]: *** [tools/Makefile tools/findutils/compile] Error 2
make[2]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source'
make[1]: *** [tools/Makefile /home/fan/openwrt_CC_mt76xx_omj_source/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/stamp/.tools_install_yynyynynynyyyyyyyyynyyyyyyyyynyyyyynnyyynnyynnnyy] Error 2
make[1]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source'
make: *** [/home/fan/openwrt_CC_mt76xx_omj_source/include/toplevel.mk world] Error 2

解决方法
cd build_dir/host/findutils-4.4.2
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' gnulib/lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> gnulib/lib/stdio-impl.h
echo "#define _IO_ferror_unlocked" >> gnulib/lib/stdio-impl.h
sed -i '/unistd/a #include ' gnulib/lib/mountlist.c
问题依然
findutils-4.6.0替换findutils-4.4.2
切换到dl目录
cd dl
下载findutils-4.6.0
wgethttps://mirrors.aliyun.com/gnu/findutils/findutils-4.6.0.tar.gz
获取findutils-4.6.0.tar.gz的md5码
md5sum findutils-4.6.0.tar.gz
9936aa8009438ce185bea2694a997fc1findutils-4.6.0.tar.gz
修改Makefile
cd ../tools/findutils/
vim Makefile
#
# Copyright (C) 2006-2013 OpenWrt.org
...
# Vsersion
PKG_VERSION:=4.6.0

.....
# PKG_MD5
PKG_MD5SUM:=9936aa8009438ce185bea2694a997fc1
.....
删除patch
21-Fix-time_t-vs-long-int-mismatches.patch(此文件在4.4.x需要, 4.6.x已经修复了此bug所以不需要了)
rm -f patches/21-Fix-time_t-vs-long-int-mismatches.patch
切换目录
cd ../../build_dir/host/findutils-4.6.0
维修源码, 运行以下命令:
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' gl/lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> gl/lib/stdio-impl.h
sed -i '/unistd/a #include ' gl/lib/mountlist.c

重新编译,此问题消除




审核编辑:刘清

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
  • OpenWrt
    +关注

    关注

    10

    文章

    117

    浏览量

    38895

原文标题:【openwrt】编译OpenWRT 出错m4和findutils库 freadahead.c文件错误

文章出处:【微信号:嵌入式加油站,微信公众号:嵌入式加油站】欢迎添加关注!文章转载请注明出处。

收藏 人收藏

    评论

    相关推荐

    【NetRouter试用体验】四、openwrt学习——编译出错求助

    下一步准备在NetRouter安装openwrt系统,安装前当然要学者编译openwrt固件啦,可是固件编译遇到了问题,找了好久也没发现问题。请老司机指条明路。。。在ubuntu10.
    发表于 03-19 20:07

    浅析linux编程语言M4

    m4是一个通用的宏处理器,由布莱恩·柯林汉和丹尼斯·里奇设计。m4 是基于 Ritchie 早先为 AP-3 小型机开发的m3宏处理器扩展的。
    发表于 07-15 08:03

    M4推荐用哪一种编译器?

    对于M4来说TI推荐用哪一种编译器呀?我用IAR编译器6.5(破解的),总是发现很多控制外围设备和自己想的不用一样?
    发表于 04-08 09:36

    请问Nu Micro™Cortex-M0/M4系列如何解锁用户配置字上的锁位?

    Nu Micro™Cortex-M0/M4系列如何解锁用户配置字上的锁位
    发表于 11-25 07:41

    请问如何使用NuvotonM0/M23Keil许可证版本编译M4系列?

    如何使用NuvotonM0/M23Keil许可证版本编译M4系列?
    发表于 12-29 07:57

    M4的时钟树

    ,相对传统的51,32的时钟相对复杂很多,M3内核如此,M4内核更甚。下面贴出M4的时钟树:可以看到时钟树很复杂,我用的芯片是STM32F401系列的,官方给的数据是最高时钟能达到84M
    发表于 08-12 07:01

    请问如何解决IBM服务器X3650 M4不能开机的问题?

    请问如何解决IBM服务器X3650 M4不能开机的问题?
    发表于 11-01 07:18

    何解决esphome upload固件编译出错的问题

    编译esphome upload固件到nodemcu板子上发生崩溃是怎样回事?如何解决esphome upload固件编译出错的问题?
    发表于 02-15 06:08

    初学者是选择学习M3还是M4

    看着stm32挺火的,还是学习M4M3,M4区别很大吗?
    发表于 05-11 10:57

    请问M7内核运行时对M4有什么影响

    你好!我正在使用 stm32h745 双核 nucleo 开发板。目前,我正在尝试每 40 毫秒在属于 M4 内核的 GPIO 输出引脚上创建一个恒定脉冲。当我单独使用 m4 时,脉搏非常准确
    发表于 12-21 07:27

    IMXRT1176 M4核心慢的原因是什么?

    我们正在开发基于 IMXRT 1176 的定制板,并面临双核系统中 M4 核性能的问题。M7 配置为 800Mhz编译器选项 -O2内存地址 DTCM - 0x200000001000 字节
    发表于 03-14 08:25

    Cortex-M0/M4芯片是否支持代码保护用户的程序代码吗?

    NuMicro™ Cortex-M0/M4芯片是否支持代码保护用户的程序代码吗?如何解开LOCK位上的用户配置字?
    发表于 06-19 06:02

    M4的NUC470系列的函数库在哪下载

    如题,M4的NUC470系列的函数库在哪下载
    发表于 06-28 07:15

    请问新塘M0/M4用什么工具编程调试?

    请资深人士解释一下新塘M0/M4用什么工具编程调试? 牛桥只能编程吗? NuLink是SWD接口调试吗?NuLink-Me只能调试特定的M0/M4吗?有没有全功能的NuLink? 能
    发表于 08-24 07:08

    编译M4系列可以使用Nuvoton M0 / M23凯尔许可版本吗?

    M0/M23 Keil 许可证版本已经注册。 如果您打开 M4 工程并将其编译, 将会出现以下编译错误信息 。 Please open t
    发表于 08-28 08:19