恩山无线论坛

标题: Gcc6.1编译Openwrt出错,找到解决办法,但是不会打补丁,求详细操作步骤 [打印本页]

作者: 百草郎君    时间: 2016-8-17 22:06
标题: Gcc6.1编译Openwrt出错,找到解决办法,但是不会打补丁,求详细操作步骤
报错Log文件如下:
  1. libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I../glib -I../glib -I.. -DG_LOG_DOMAIN="GLib" -DG_DISABLE_CAST_CHECKS -DGLIB_COMPILATION -DPCRE_STATIC -I/home/fire/openwrt/staging_dir/host/include -I/home/fire/openwrt/staging_dir/host/usr/include -pthread -Wall -Wstrict-prototypes -Werror=declaration-after-statement -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=pointer-arith -Werror=init-self -Werror=format=2 -fvisibility=hidden -O2 -I/home/fire/openwrt/staging_dir/host/include -I/home/fire/openwrt/staging_dir/host/usr/include -MT libglib_2_0_la-gdate.lo -MD -MP -MF .deps/libglib_2_0_la-gdate.Tpo -c gdate.c -o libglib_2_0_la-gdate.o
  2. gdate.c: In function 'g_date_strftime':
  3. gdate.c:2497:7: error: format not a string literal, format string not checked [-Werror=format-nonliteral]
  4.        tmplen = strftime (tmpbuf, tmpbufsize, locale_format, &tm);
  5.        ^~~~~~
  6. cc1: some warnings being treated as errors
  7. make[10]: *** [Makefile:1386: libglib_2_0_la-gdate.lo] Error 1
  8. make[10]: Leaving directory '/home/fire/openwrt/build_dir/host/pkg-config-0.29/glib/glib'
  9. make[9]: *** [Makefile:1933: all-recursive] Error 1
  10. make[9]: Leaving directory '/home/fire/openwrt/build_dir/host/pkg-config-0.29/glib/glib'
  11. make[8]: *** [Makefile:952: all] Error 2
  12. make[8]: Leaving directory '/home/fire/openwrt/build_dir/host/pkg-config-0.29/glib/glib'
  13. make[7]: *** [Makefile:1045: all-recursive] Error 1
  14. make[7]: Leaving directory '/home/fire/openwrt/build_dir/host/pkg-config-0.29/glib'
  15. make[6]: *** [Makefile:769: all] Error 2
  16. make[6]: Leaving directory '/home/fire/openwrt/build_dir/host/pkg-config-0.29/glib'
  17. make[5]: *** [Makefile:697: all-recursive] Error 1
  18. make[5]: Leaving directory '/home/fire/openwrt/build_dir/host/pkg-config-0.29'
  19. make[4]: *** [Makefile:456: all] Error 2
  20. make[4]: Leaving directory '/home/fire/openwrt/build_dir/host/pkg-config-0.29'
  21. make[3]: *** [Makefile:40: /home/fire/openwrt/build_dir/host/pkg-config-0.29/.built] Error 2
  22. make[3]: Leaving directory '/home/fire/openwrt/tools/pkg-config'
  23. make[2]: *** [tools/Makefile:123: tools/pkg-config/compile] Error 2
  24. make[2]: Leaving directory '/home/fire/openwrt'
  25. make[1]: *** [tools/Makefile:121: /home/fire/openwrt/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/stamp/.tools_install_yynyynynynyyyyyyyyynyyyyyyyyynyyyyynnyyynnyynnnyy] Error 2
  26. make[1]: Leaving directory '/home/fire/openwrt'
  27. make: *** [/home/fire/openwrt/include/toplevel.mk:183: world] Error 2
  28. Arch%

  29. Arch% gcc -v
  30. Using built-in specs.
  31. COLLECT_GCC=gcc
  32. COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-linux-gnu/6.1.1/lto-wrapper
  33. Target: i686-pc-linux-gnu
  34. Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release
  35. Thread model: posix
  36. gcc version 6.1.1 20160802 (GCC)
  37. Arch%
复制代码
在此博客http://blog.sxx1314.com/openwrt/416.html
找到解决办法,但是要应用补丁,然而我并不会,请万能的论坛大神指点操作步骤。



作者: 名探偵コナン    时间: 2016-8-17 22:06
  1. 01
  2. >  +--- glib/gdate.c.orig 2014-12-19 21:49:48.000000000 +0000
  3. 02
  4. >  ++++ glib/gdate.c
  5. 03
  6. >  +@@ -2494,7 +2494,10 @@ g_date_strftime (gchar       *s,
  7. 04
  8. >  +        * recognize whether strftime actually failed or just returned "".
  9. 05
  10. >  +        */
  11. 06
  12. >  +       tmpbuf[0] = '\1';
  13. 07
  14. >  ++      #pragma GCC diagnostic push
  15. 08
  16. >  ++      #pragma GCC diagnostic ignored "-Wformat-nonliteral"
  17. 09
  18. >  +       tmplen = strftime (tmpbuf, tmpbufsize, locale_format, &tm);
  19. 10
  20. >  ++      #pragma GCC diagnostic pop
  21. 11
  22. >  +
  23. 12
  24. >  +       if (tmplen == 0 && tmpbuf[0] != '\0')
  25. 13
  26. >  +         {
复制代码

楼主试试打开gdate.c   在相应位置把上面几句代码加进去试试
作者: 血洗刀锋    时间: 2016-8-18 18:03
官方GCC不行吗?这个补丁复制为xx.patch。丢到gcc的补丁文件夹就行了
作者: 百草郎君    时间: 2016-8-18 20:56
血洗刀锋 发表于 2016-8-18 18:03
官方GCC不行吗?这个补丁复制为xx.patch。丢到gcc的补丁文件夹就行了

我用的是archlinux 现更新到了gcc6.1.1,编译会出这个错误。
作者: 百草郎君    时间: 2016-8-18 21:44
名探偵コナン 发表于 2016-8-18 21:19
楼主试试打开gdate.c   在相应位置把上面几句代码加进去试试

这是个笨方法,当然也是有效的,我试过但我更想明白怎么使用补丁功能,毕竟不能没次遇到要打补丁都逐行手动添加吧。
作者: 名探偵コナン    时间: 2016-8-18 22:19
百草郎君 发表于 2016-8-18 21:44
这是个笨方法,当然也是有效的,我试过但我更想明白怎么使用补丁功能,毕竟不能没次遇到要打补丁都逐行 ...

一楼不是说了吗?把上面的内容保存成.patch 放到相应的文件夹里
作者: axlrose    时间: 2016-8-19 11:49
archlinux升级像火箭,所以现在我编译openwrt, buildroot这些,使用的在arch下做个debian jessie rootfs, 在后通过schroot方式运行,其实就是个chroot,只是运行schroot更方便,进到里面以后再挂载指定目录(通知配置目录), mount -o bind方式
以后就不用担心arch软件升级太快的问题
作者: 百草郎君    时间: 2016-8-19 12:10
axlrose 发表于 2016-8-19 11:49
archlinux升级像火箭,所以现在我编译openwrt, buildroot这些,使用的在arch下做个debian jessie rootfs,  ...

类似debootrap功能吗,求指点
作者: arfaWong    时间: 2016-8-20 09:17
楼主解决了吗?我也遇到同样的问题,不知道这个补丁要打在哪里。
作者: 百草郎君    时间: 2016-8-20 11:58
arfaWong 发表于 2016-8-20 09:17
楼主解决了吗?我也遇到同样的问题,不知道这个补丁要打在哪里。

官方wiki我个门外汉看不到,就是不会用。。
作者: axlrose    时间: 2016-8-21 20:07
百草郎君 发表于 2016-8-19 12:10
类似debootrap功能吗,求指点

就是通过debootstrap安装到本地的目录,你就可以chroot来用了
作者: yelxl    时间: 2017-4-26 12:32
提示: 作者被禁止或删除 内容自动屏蔽
作者: 百草郎君    时间: 2017-4-28 22:31
yelxl 发表于 2017-4-26 12:32
https://dev.openwrt.org/browser/trunk/tools/pkg-config/patches/001-glib-gdate-suppress-string-format ...

已经解决,很感谢回复指导,
作者: cuimh    时间: 2018-6-19 10:17
您好,我也遇到这个问题了,要怎样打补丁呢
作者: 百草郎君    时间: 2018-6-24 19:05
cuimh 发表于 2018-6-19 10:17
您好,我也遇到这个问题了,要怎样打补丁呢

笨方法,打开gdate.c 在相应位置把上面几句代码加进去。再执行编译
作者: wadadp    时间: 2020-5-26 15:33
变动:https://gitlab.gnome.org/GNOME/g ... 7abe46ee18a0b134486
亲测有效。




欢迎光临 恩山无线论坛 (https://www.right.com.cn/forum/) Powered by Discuz! X3.5