谷动谷力

 找回密码
 立即注册
查看: 782|回复: 0
打印 上一主题 下一主题
收起左侧

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

[复制链接]
跳转到指定楼层
楼主
发表于 2023-7-7 17:29:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
【openwrt】编译OpenWRT 15.05(Chaos Calmer CC)出错m4-1.4.17 和findutils-4.4.2库 freadahead.c文件错误解决方法

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

现象
出错提示如下 :
freadahead.c: In function 'freadahead':
freadahead.c:91:3: 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:121: /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:183: 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.c:64:3: 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:890: 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:696: 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:606: 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:643: 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:582: all] Error 2
make[4]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/findutils-4.4.2'
make[3]: *** [Makefile:21: /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:123: tools/findutils/compile] Error 2
make[2]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source'
make[1]: *** [tools/Makefile:121: /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:183: 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 <sys/sysmacros.h>' 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 <sys/sysmacros.h>' gl/lib/mountlist.c

重新编译,此问题消除

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|深圳市光明谷科技有限公司|光明谷商城|Sunshine Silicon Corpporation ( 粤ICP备14060730号|Sitemap

GMT+8, 2024-4-27 22:57 , Processed in 0.102309 second(s), 38 queries .

Powered by Discuz! X3.2 Licensed

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表