Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4460346
  • 博文数量: 356
  • 博客积分: 10458
  • 博客等级: 上将
  • 技术积分: 4734
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-24 14:59
文章分类

全部博文(356)

文章存档

2020年(17)

2019年(9)

2018年(26)

2017年(5)

2016年(11)

2015年(20)

2014年(2)

2013年(17)

2012年(15)

2011年(4)

2010年(7)

2009年(14)

2008年(209)

分类: LINUX

2018-08-14 12:17:40

编译类openwrt sdk时,出现个gdate.c的错误,与编译器版本有关,打个patch就好

问题:

gdate.c: In function 'g_date_strftime':
gdate.c:2497:7: error: format not a string literal, format string not checked [-Werror=format-nonliteral]
      tmplen = strftime (tmpbuf, tmpbufsize, locale_format, &tm);
      ^~~~~~
cc1: some warnings being treated as errors
make[10]: *** [Makefile:1386: libglib_2_0_la-gdate.lo] Error 1
make[10]: Leaving directory '/opt/water/tina-sdk/out/mandolin-perf1/compile_dir/host/pkg-config-0.29/glib/glib'

解决:

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

tools/pkg-config/patches/001-glib-gdate-suppress-string-format-literal-warning.patch

内容如下:

点击(此处)折叠或打开

  1. --- a/glib/glib/gdate.c
  2. +++ b/glib/glib/gdate.c
  3. @@ -2439,6 +2439,9 @@ win32_strftime_helper (const GDate *d,
  4. *
  5. * Returns: number of characters written to the buffer, or 0 the buffer was too small
  6. */
  7. +#pragma GCC diagnostic push
  8. +#pragma GCC diagnostic ignored "-Wformat-nonliteral"
  9. +
  10. gsize
  11. g_date_strftime (gchar *s,
  12. gsize slen,
  13. @@ -2549,3 +2552,5 @@ g_date_strftime (gchar *s,
  14. return retval;
  15. #endif
  16. }
  17. +
  18. +#pragma GCC diagnostic pop

阅读(6958) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~