ubuntu18.04编译Openwrt出现的问题解决

2023-11-12


出现的问题多数是因为使用了新的编译器去编译老旧版本的openwrt,而出现的不兼容现象。
首先安装:
$sudo apt-get install aptitude

问题1:Build dependency: Please install Git (git-core) >= 1.6.5

原因一
缺少git
解决方法
安装git

$ sudo apt-get install git

注:如果已经安装git但是仍然收到该错误提示,请参考原因二,如果没有请忽略原因二。
原因二
这是openwrt一个脚本的问题,用一个古老的命令来判断git的版本。
由于对git版本的检测方式有缺陷导致,OpenWRT已经在
2016-03-05 21:07提交(4c80909fa141fe2921c62bd17b2b04153031df18)中修复该问题
解决方法
请参考https://github.com/openwrt/openwrt/commit/4c80909fa141fe2921c62bd17b2b04153031df18
修改文件 include/prereq-build.mk 中git版本的判断命令。
我这里的判断命令依然是 git clone 2>&1 | grep – –recursive)),
将其修改为 git –exec-path | xargs -I % – grep -q – –recursive %/git-submodule))
补丁文件如下:

diff --git a/include/prereq-build.mk b/include/prereq-build.mk
index 211201a..9067404 100644
--- a/include/prereq-build.mk
+++ b/include/prereq-build.mk
@@ -145,7 +145,7 @@ $(eval $(call SetupHostCommand,svn,Please install the Subversion client, \
 	svn --version | grep Subversion))
 
 $(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.6.5, \
-	git clone 2>&1 | grep -- --recursive))
+	git --exec-path | xargs -I % -- grep -q -- --recursive %/git-submodule))
 
 $(eval $(call SetupHostCommand,file,Please install the 'file' package, \
 	file --version 2>&1 | grep file))

在这里插入图片描述

问题2:gdate.c:2497:7: error: format not a string literal, format string not checked [-Werror=format-nonliteral]

  tmplen = strftime (tmpbuf, tmpbufsize, locale_format, &tm);
  ^~~~~~

参考解决:https://github.com/widora/openwrt_widora/issues/12

diff --git a/glib/glib/gdate.c b/glib/glib/gdate.c
index 1978cf7..9be9b97 100644
--- a/glib/glib/gdate.c
+++ b/glib/glib/gdate.c
#第一处:2439行修改
@@ -2439,6 +2439,10 @@ win32_strftime_helper (const GDate     *d,
  *
  * Returns: number of characters written to the buffer, or 0 the buffer was too small
  */
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+
 gsize     
 g_date_strftime (gchar       *s, 
                  gsize        slen, 
#第二处:2549行修改
@@ -2549,3 +2553,5 @@ g_date_strftime (gchar       *s,
   return retval;
 #endif
 }
+
+#pragma GCC diagnostic pop

修改两处文件:
./build_dir/host/pkg-config-0.28/glib/glib/gdate.c
./build_dir/host/glib-2.41.1/glib/gdate.c
PS:我只搜索到一个,所以就修改一个
在这里插入图片描述
在这里插入图片描述

问题3:Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/${ <-- HERE ([^ \t=:+{}]+)}/ at ./bin/automake.tmp line 3938.

还有人报:Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/${ <-- HERE ([^ \t=:+{}]+)}/ at /home/li/OS/IBSS/IBSS-openwrt.git/staging_dir/host/bin/automake line 4160.

问题原因:
是staging_dir/host/bin/automake的4160行报错
因为新版的perl不再支持左大括号的使用
解决:
对于:automake.tmp line 3938报错
补丁如下:内容主要修改automake.in文件
其他文件报错直接修改其路径上的文件即可!
参考连接:https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=92c80f38cff3c20388f9ac13d5196f2745aeaf77;hp=079d57b0f290a79c9dbc013b6e9c83cebf8a2f99

+diff --git a/bin/automake.in b/bin/automake.in
+index a3a0aa318..2c8f31e14 100644
+--- a/bin/automake.in
++++ b/bin/automake.in
+@@ -3878,7 +3878,7 @@ sub substitute_ac_subst_variables_worker
+ sub substitute_ac_subst_variables
+ {
+   my ($text) = @_;
+-  $text =~ s/\${([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
++  $text =~ s/\$[{]([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
+   return $text;
+ }
+ 
+-- 
+2.13.1
+

在这里插入图片描述
在这里插入图片描述

问题4:[ERROR] cfns.gperf:101:1: error: ‘const char* libc_name_p(const char*, unsigned int)’ redeclared inline with ‘gnu_inline’ attribute

原因:
是一个inline内联的问题
解决方法:

//cfns.h 第55~56行中间插入
#ifdef __GNUC_STDC_INLINE__
__attribute__ ((__gnu_inline__))
#endif
//cfns.gperf 第24~25行中间插入
#ifdef __GNUC_STDC_INLINE__
__attribute__ ((__gnu_inline__))
#endif

此文件可在openwrt目录下直接搜索
cfns.h
在这里插入图片描述
最后贴上我找到此类问题参考解决方法的地址:
https://www.jianshu.com/p/976753126ca4
https://me.csdn.net/rainforest_c
http://blog.sina.com.cn/s/blog_bf7859030102x03k.html
https://bbs.archlinux.org/viewtopic.php?pid=1732548
https://blog.csdn.net/Javin_L/article/details/96015816

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ubuntu18.04编译Openwrt出现的问题解决 的相关文章

随机推荐

  • xp无法远程计算机共享,解决XP局域网共享不能访问的问题

    1 检查guest帐户是否开启 XP默认情况下是不开启guest帐户的 因些为了其他的人能浏览你的计算机 请启用guest帐户 为了安全请为guest设置密码或相应的权限 你也可以为每一台机器设置一个用户名和密码以便计算机之间的互相访问 2
  • 面向数据流的方法设计系统的软件结构(储蓄系统)

    RT 事务流
  • mongodb安装

    mongodb安装 提示 ubuntu 18 04 mongodb 4 0 28 文章目录 mongodb安装 前言 一 下载解压安装包 二 在 etc profile文件中添加如下内容 生效环境变量 三 创建数据库目录 前言 MongoD
  • 面试总结-2023届安全面试题总汇

    2023届安全面试题总汇 文章目录 2023届安全面试题总汇 前言 0x01 秋招目录 随时更新 0x02 各大安全厂商面试题 资料链接 一个2023届毕业生在毕业前持续更新 收集的安全岗面试题及面试经验分享 前言 最近发现一个宝贵的面试文
  • vector的find用法

    一 find函数存在于算法中 其头文件为 include
  • 驱动 - platform总线驱动

    include
  • 怎么求解100个正整数的最大公约数python

    答 你可以使用Python中的fractions模块来求解100个正整数的最大公约数 你需要先导入它 import fractions 然后你可以使用fractions gcd函数来求解 fractions gcd 100 200
  • Codeforces#808(Div.2)A-D题解

    目录 A Difference Operations B Difference of GCDs C Doremy s IQ D Difference Array A Difference Operations Problem A Codef
  • 2019年7款3D扫描仪APP(Android和iOS),让你手机秒变3D扫描仪!

    在我之前的一篇文章 教程 SolidWorks与3D扫描技术不得不说的故事 中 提到了SolidWorks和3D扫描技术之间的完美合作 今天就继续围绕3D扫描话题 为大家分享7款2019年3D扫描仪APP Android和iOS 喜欢就继续
  • Linux 解决sudo后接命令,仍旧权限不足的问题

    将本想执行的 sudo echo aa gt gt root text txt 改为 sudo sh c echo aa gt gt root text txt
  • Docker 1.9的新网络特性,以及Overlay详解

    本文转载自灵雀云技术博客 原文链接 http www alauda cn 2016 01 18 docker 1 9 network 作者简介 林帆 ThoughtWorks公司软件工程师及DevOps咨询师 具有丰富的持续交付和服务器运维
  • CCF 2104年3月第一题--相反数(java)

    代码如下 package com hsx ccf import java util Scanner public class Ccf20140301 public static void main String args SuppressW
  • Spring Cloud中的Hystrix的实现和使用

    Spring Cloud Hystrix 是 Spring Cloud 生态系统中的一个断路器组件 它可以帮助开发者优雅地处理分布式系统中的故障 提高系统的容错能力 下面介绍 Spring Cloud Hystrix 的实现和使用 引入依赖
  • QT获取lineEdit内容并写入文件中

    在ui中创建一个lineEdit 然后 QString sss ui gt lineEdit gt text 这样就获得了lineEdit的内容 并转为了QString格式 接下来参考 https editor csdn net md ar
  • 残差网络模型

    1 原始残差网络 最基本的残差块 中间的两层神经网络学习输入输出之间的残差 而旁边的链接就像一个高速公路 使得反向传播算法中的残差能通过这条路传到前边去 当网络变深时可以使得中间的输出为0 那么网络就能自适应的变成一个浅一点的网络 左边ba
  • Java 根据EXCEL下标获取EXCEL的列名

    通过根据EXCEL下标获取EXCEL的列名 用于给单元格设置公式用 num 是以0开头的下标 public static String getExcelColumn Integer num if num null return null S
  • 树的概念:层次、高度、深度、宽度

    目录 层次 宽度 深度 高度 其中只有层次是树原生的概念 其他都是从树中的结点来的 层次 从根节点开始算起 根节点算第一层 如图所示的树 第1层 A 第2层 B C 第3层 D E F 第4层 G H I 宽度 其实就是度 把结点的子树的棵
  • 大并发下请求合并(并发处理技巧)

    大并发下请求合并 一次请求消耗的资源 旧的方式 改造后 批量请求处理器 批量请求包装类 使用 性能测试 旧的 改造后的 一次请求消耗的资源 我们经常碰到查询请求的操作 例如根据用户id查询该用户的信息 接口仓储层查询用户正常的做法是通过id
  • adam算法介绍和总结

    19 adam算法 Adam 是一种可以替代传统随机梯度下降 SGD 过程的一阶优化算法 它能基于训练数据迭代地更新神经网络权重 Adam 最开始是由 OpenAI 的 Diederik Kingma 和多伦多大学的 Jimmy Ba 在提
  • ubuntu18.04编译Openwrt出现的问题解决

    ubuntu18 04编译Openwrt出现的问题解决 问题1 Build dependency Please install Git git core gt 1 6 5 问题2 gdate c 2497 7 error format no