解决编译报错:error: #error “Please port gnulib freadahead.c to your platform!

今天在编译以前的项目代码,出现如下报错,在网上搜索解决后,现记录下。

1.

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.”
进入如下路径,执行命令:

zzh@dev229:~/project/build_dir/host/m4-1.4.17$ sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
zzh@dev229:~/project/build_dir/host/m4-1.4.17$ echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h

可以解决问题继续编译。

2.

出现如下报错:

checking for long long... /usr/bin/ld: ../lib/libblkid.a(devname.o): in function `probe_all':
devname.c:(.text+0x86a): undefined reference to `makedev'
/usr/bin/ld: devname.c:(.text+0xbcc): undefined reference to `makedev'
/usr/bin/ld: devname.c:(.text+0xcc0): undefined reference to `makedev'
collect2: error: ld returned 1 exit status
Makefile:390: recipe for target 'e2fsck' failed
make[6]: *** [e2fsck] Error 1

解决方案:

zzh@dev229:vim build_dir/host/e2fsprogs-1.42.8/lib/blkid/devname.c

添加 #include <sys/sysmacros.h>头文件。

3.

在构建QEMU时出现报错“undefined reference to ‘stime’”:

| /poky/build/tmp-glibc/hosttools/ld.bfd: linux-user/syscall.o: in function `do_syscall':
| /poky/build/tmp-glibc/work/x86_64-linux/qemu-native/3.0.0-r0/qemu-3.0.0/linux-user/syscall.c:8526: undefined reference to `stime'
| collect2: error: ld returned 1 exit status
| Makefile:199: recipe for target 'qemu-arm' failed
| make[1]: *** [qemu-arm] Error 1
| Makefile:481: recipe for target 'subdir-arm-linux-user' failed
| make: *** [subdir-arm-linux-user] Error 2

可以在syscall.c文件添加如下代码:

#include <time.h>
int stime(const time_t *t)
{
 struct timespec ts = {};
 ts.tv_sec = *t;
 return clock_settime(CLOCK_REALTIME, &ts);
}
freadahead.c: In function 'freadahead': freadahead.c:92: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." 92 | #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[7]: *** [Makefile:1910: freadahead.o] Error 1 make[7]: Leaving directory '/home/wk/lede_AR9331_zhuotk_source_64bit/build_dir/host/m4-1.4.18/lib' make[6]: *** [Makefile:1674: all] Error 2 make[6]: Leaving directory '/home/wk/lede_AR9331_zhuotk_source_64bit/build_dir/host/m4-1.4.18/lib' make[5]: *** [Makefile:1572: all-recursive] Error 1 make[5]: Leaving directory '/home/wk/lede_AR9331_zhuotk_source_64bit/build_dir/host/m4-1.4.18' make[4]: *** [Makefile:1528: all] Error 2 make[4]: Leaving directory '/home/wk/lede_AR9331_zhuotk_source_64bit/build_dir/host/m4-1.4.18' make[3]: *** [Makefile:29: /home/wk/lede_AR9331_zhuotk_source_64bit/build_dir/host/m4-1.4.18/.built] Error 2 make[3]: Leaving directory '/home/wk/lede_AR9331_zhuotk_source_64bit/tools/m4' make[2]: *** [tools/Makefile:150: tools/m4/compile] Error 2 make[2]: Leaving directory '/home/wk/lede_AR9331_zhuotk_source_64bit' make[1]: *** [tools/Makefile:146: /home/wk/lede_AR9331_zhuotk_source_64bit/staging_dir/target-mips_24kc_musl/stamp/.tools_compile_yynyyyyynyyyyynyynnyyyyyyyyyyyyyyyyyyyynyynynyyyynny] Error 2 make[1]: Leaving directory '/home/wk/lede_AR9331_zhuotk_source_64bit' make: *** [/home/wk/lede_AR9331_zhuotk_source_64bit/include/toplevel.mk:209:world] 错误 2
04-04
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值