Modify

Opened 22 months ago

Last modified 20 months ago

#22193 new defect

libglib fails to compile

Reported by: Mangix Owned by: developers
Priority: normal Milestone: Designated Driver (Trunk)
Component: packages Version: Trunk
Keywords: Cc:

Description

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

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

Attachments (0)

Change History (4)

comment:1 Changed 21 months ago by anonymous

I have the same issue:

/usr/bin/env bash ../libtool  --tag=CC   --mode=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/media/kofec/Linux/openwrt/kirkwoodTrunk/staging_dir/host/include -I/media/kofec/Linux/openwrt/kirkwoodTrunk/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/media/kofec/Linux/openwrt/kirkwoodTrunk/staging_dir/host/include -I/media/kofec/Linux/openwrt/kirkwoodTrunk/staging_dir/host/usr/include  -MT libglib_2_0_la-gdate.lo -MD -MP -MF .deps/libglib_2_0_la-gdate.Tpo -c -o libglib_2_0_la-gdate.lo `test -f 'gdate.c' || echo './'`gdate.c
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/media/kofec/Linux/openwrt/kirkwoodTrunk/staging_dir/host/include -I/media/kofec/Linux/openwrt/kirkwoodTrunk/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/media/kofec/Linux/openwrt/kirkwoodTrunk/staging_dir/host/include -I/media/kofec/Linux/openwrt/kirkwoodTrunk/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
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]: *** [libglib_2_0_la-gdate.lo] Error 1
make[10]: Leaving directory `/media/kofec/Linux/openwrt/kirkwoodTrunk/build_dir/host/pkg-config-0.29.1/glib/glib'
make[9]: *** [all-recursive] Error 1
make[9]: Leaving directory `/media/kofec/Linux/openwrt/kirkwoodTrunk/build_dir/host/pkg-config-0.29.1/glib/glib'
make[8]: *** [all] Error 2
make[8]: Leaving directory `/media/kofec/Linux/openwrt/kirkwoodTrunk/build_dir/host/pkg-config-0.29.1/glib/glib'
make[7]: *** [all-recursive] Error 1
make[7]: Leaving directory `/media/kofec/Linux/openwrt/kirkwoodTrunk/build_dir/host/pkg-config-0.29.1/glib'
make[6]: *** [all] Error 2
make[6]: Leaving directory `/media/kofec/Linux/openwrt/kirkwoodTrunk/build_dir/host/pkg-config-0.29.1/glib'
make[5]: *** [all-recursive] Error 1
make[5]: Leaving directory `/media/kofec/Linux/openwrt/kirkwoodTrunk/build_dir/host/pkg-config-0.29.1'
make[4]: *** [all] Error 2
make[4]: Leaving directory `/media/kofec/Linux/openwrt/kirkwoodTrunk/build_dir/host/pkg-config-0.29.1'
make[3]: *** [/media/kofec/Linux/openwrt/kirkwoodTrunk/build_dir/host/pkg-config-0.29.1/.built] Error 2
make[3]: Leaving directory `/media/kofec/Linux/openwrt/kirkwoodTrunk/tools/pkg-config'
make[2]: *** [tools/pkg-config/compile] Error 2
make[2]: Leaving directory `/media/kofec/Linux/openwrt/kirkwoodTrunk'
make[1]: *** [/media/kofec/Linux/openwrt/kirkwoodTrunk/staging_dir/target-arm_xscale_musl-1.1.14_eabi/stamp/.tools_install_yynyynynynyyyyyyynyyynyyyyyyyyynyyyyynnyynynnyyynnnyy] Error 2
make[1]: Leaving directory `/media/kofec/Linux/openwrt/kirkwoodTrunk'

comment:2 Changed 21 months ago by anonymous

I have applied below fix:

 >  +--- glib/gdate.c.orig	2014-12-19 21:49:48.000000000 +0000
 >  ++++ glib/gdate.c
 >  +@@ -2494,7 +2494,10 @@ g_date_strftime (gchar       *s, 
 >  +        * recognize whether strftime actually failed or just returned "".
 >  +        */
 >  +       tmpbuf[0] = '\1';
 >  ++      #pragma GCC diagnostic push
 >  ++      #pragma GCC diagnostic ignored "-Wformat-nonliteral"
 >  +       tmplen = strftime (tmpbuf, tmpbufsize, locale_format, &tm);
 >  ++      #pragma GCC diagnostic pop
 >  + 
 >  +       if (tmplen == 0 && tmpbuf[0] != '\0')
 >  +         {
 

from
https://mail-index.netbsd.org/pkgsrc-bugs/2016/02/23/msg058866.html

comment:3 Changed 21 months ago by kofec

Other fixes which have to be applied:
linux/compiler-gcc6.h: No such file or directory openwrt
compiler-gcc6.h uboot
https://patchwork.ozlabs.org/patch/577912/

and
cfns.gperf:101:1: error:
from https://drive.google.com/file/d/0BwWNLQDwiOxtYnJSRm1Dam9XTU0/view?usp=sharing

--- gcc/cp/cfns.h.orig	2015-02-13 08:27:46.000000000 +0200
+++ gcc/cp/cfns.h	2015-02-13 10:23:53.000000000 +0200
@@ -53,6 +53,9 @@
 static unsigned int hash (const char *, unsigned int);
 #ifdef __GNUC__
 __inline
+#ifdef __GNUC_STDC_INLINE__
+__attribute__ ((__gnu_inline__))
+#endif
 #endif
 const char * libc_name_p (const char *, unsigned int);
 /* maximum key range = 391, duplicates = 0 */
@@ -96,7 +99,7 @@
       400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
       400, 400, 400, 400, 400, 400, 400
     };
-  register int hval = len;
+  register int hval = (int)len;
 
   switch (hval)
     {

comment:4 Changed 20 months ago by jaime.terrats@…

Hi, when I'm applying the first patch, i got this message:

if [ -d patches/glib/openwrt ]; then for f in patches/glib/openwrt/*; do (cd openwrt && patch -p0 < ../$f); done; fi
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:


glib/gdate.c.orig2014-12-19 21:49:48.000000000 +0000

|+++ glib/gdate.c


File to patch:

what am I doing wrong?

thanks!

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.