sunsili 发表于 2023-7-7 17:29:01

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

【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: *** Error 2
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_zhuotk_source'
make: *** 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: *** Error 1
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/findutils-4.4.2/gnulib/lib'
make: *** Error 2
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/findutils-4.4.2/gnulib/lib'
make: *** Error 1
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/findutils-4.4.2/gnulib'
make: *** Error 1
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/findutils-4.4.2'
make: *** Error 2
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/findutils-4.4.2'
make: *** Error 2
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/tools/findutils'
make: *** Error 2
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source'
make: *** Error 2
make: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source'
make: *** 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
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 <sys/sysmacros.h>' gl/lib/mountlist.c

重新编译,此问题消除

页: [1]
查看完整版本: 【openwrt】编译OpenWRT 出错m4和findutils库 freadahead.c文件错误