OpenWrt编译遇到的错误

本文详细记录了在编译OpenWrt过程中遇到的git、gdate.c、automake、gcc版本、mkimage模块和coccinelle编译错误的解决方案,包括打patch、调整perl和ocaml版本、多版本gcc切换等方法。
摘要由CSDN通过智能技术生成

1. 初检git出错

依赖提示 Please install Git (git-core) >= 1.6.5

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
➜  openwrt git:(master) ✗ make menuconfig
Checking 'working-make'... ok.
         .
         .
         .
Checking 'svn'... ok.
Checking 'git'... failed.
Checking 'file'... ok.
Checking 'openssl'... ok.
Checking 'ldconfig-stub'... ok.

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

/home/ubuntu/buildbot/compex/chaos_calmer/openwrt/include/prereq.mk:12: recipe for target 'prereq' failed
Prerequisite check failed. Use FORCE=1 to override.
/home/ubuntu/buildbot/compex/chaos_calmer/openwrt/include/toplevel.mk:140: recipe for target 'staging_dir/host/.prereq-build' failed
make: *** [staging_dir/host/.prereq-build] Error 1

明明已经安装了git,却提示我们安装git,只是openwrt里面prereq-build.mk的一个bug,可以通过打patch的方法来修复它。

解决方案

进到xxx/chaos_calmer/include目录,就是toplevel.mk所在的目录。

1
2
wget https://gitlab.labs.nic.cz/turris/openwrt/uploads/0673001b14ab1d1769604ff0ce7d8781/git-version-check-fix.patch
patch < git-version-check-fix.patch

回到openwrt根目录,再次检查依赖,发现没,没有问题了。

2. gdate.c错误

1
2
3
gdate.c: In function 'g_date_strftime':
       tmplen = strftime (tmpbuf, tmpbufsize, locale_format, &tm);
       ^~~~~~

解决方案

单独改源码方式不好,下次重新编译有可能又要重新改, 所以新建个patch一劳永逸.

在tools/pkg-config/目录下创建目录patches并在patches目录中新建文件 001-glib-gdate-suppress-string-format-literal-warning.patch

内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
--- a/glib/glib/gdate.c
+++ b/glib/glib/gdate.c
@@ -2439,6 +2439,9 @@ 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,3 +2552,5 @@ g_date_strftime (gchar       *s,
   return retval;
 #endif
 }
+
+#pragma GCC diagnostic pop

3. automake错误,与perl版本有关

1
2
3
4
5
6
7
8
9
10
11
Makefile:50: recipe for target '/home/ubuntu/buildbot/compex/chaos_calmer/openwrt/build_dir/host/automake-1.15/.configured' failed
make[3]: *** [/home/ubun
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值