openwrt 编译常见错误集锦

一、conflicting types for ‘copy_file_range’

./…/misc/create_inode.c:395:18: error: conflicting types for ‘copy_file_range’
static errcode_t copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file,
^
In file included from ./…/misc/create_inode.c:19:0:
/usr/include/unistd.h:1110:9: note: previous declaration of ‘copy_file_range’ was here
ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
^

解决办法:
buildroot-2017.02.3/output/build/host-e2fsprogs-1.43.3/misc/create_inode.c
屏蔽掉 #include <unistd.h>

在这里插入图片描述

 二、openwrt 编译时报SOURCE_DATE_EPOCH must expand to a non-negative integer less than or equal to 25340230

log:

mkyaffs2image.c: In function 'main':
mkyaffs2image.c:470:6: error: environment variable SOURCE_DATE_EPOCH must expand to a non-negative integer less than or equal to 253402300799
fprintf(stderr,"mkyaffs2image: image building tool for YAFFS2 built "__DAT

solution:

原因是yaffs需要用这个日期信息来生成一个冗长的version信息,系统会从git信息中查找,但git没有安装,或者git环境变量错误。在openwrt目录下执行命令 date +%s > version.date可以解决。

三、解决openssl1.1.0导致ssl1.0.版本的代码出错问题

编译uboot时,错误打印信息:

lib/rsa/rsa-sign.c:279:21: error: dereferencing pointer to incomplete type 'RSA {aka struct rsa_st}'
  if (BN_num_bits(key->e) > 64)
                     ^~
scripts/Makefile.host:134: recipe for target 'tools/lib/rsa/rsa-sign.o' failed
 

通过降级openssl解决

sudo apt install libssl1.0-dev

四、遇到问题error: dereferencing pointer to incomplete type 'RSA {aka struct rsa_st}'

下载如下补丁
https://github.com/openwrt/openwrt/commit/70b104f98c0657323b28fce140b73a94bf3eb756#diff-ad001f3a51a1d957d5013650f14df0cb
保存为
tools/mkimage/patches/210-openssl-1.1.x-compat.patch

 五、模块 mkimage(u-boot-2014.10) 出错

1
2
u-boot-2014.10/lib/rsa/rsa-sign.c:279:21: error: dereferencing pointer to incomplete type 'RSA {aka struct rsa_st}'
  if (BN_num_bits(key->e) > 64)

原因

OpenSSL版本是1.1x,OpenSSL 1.1.x对一些API做了改动,因此出现错误信息。

1
2
➜  openssl version
OpenSSL 1.1.1  11 Sep 2018

解决方法

参考tools: mkimage: fix build with OpenSSL 1.1.x (FS#182) · openwrt/openwrt@70b104f · GitHub

在 tools/mkimage/patches/ 目录下wget 210-openssl-1.1.x-compat.patch

如下:

1
wget https://raw.githubusercontent.com/openwrt/openwrt/70b104f98c0657323b28fce140b73a94bf3eb756/tools/mkimage/patches/210-openssl-1.1.x-compat.patch
  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

拿破仑的海阔天空

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值