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

描述

编译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
wget https://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
9936aa8009438ce185bea2694a997fc1  findutils-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

重新编译,此问题消除




审核编辑:刘清

打开APP阅读更多精彩内容
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
评论(0)
发评论
于平1 2023-09-12
0 回复 举报
收起回复
  • 相关推荐
  • O

全部0条评论

快来发表一下你的评论吧 !

×
20
完善资料,
赚取积分