[Chilli] cross compile error

Thierry MUSEUX - www.fwt.fr - tm at fwt.fr
Mon May 31 10:43:01 UTC 2010


Hi David
I have a custom package for coova on openwrt.
With the current trunk, r339, I have an error :
cc1: warnings being treated as errors
redir.c: In function 'redir_main':
redir.c:2796: error: format '%ld' expects type 'long int', but argument 3
has type 'uint64_t' sprintf(buffer, "%ld", conn.s_state.input_octets);

redir.c:2798: error: format '%ld' expects type 'long int', but argument 3
has type 'uint64_t' sprintf(buffer, "%ld", conn.s_state.output_octets);

redir.c:2800: error: format '%ld' expects type 'long int', but argument 3
has type 'uint64_t' sprintf(buffer, "%ld", conn.s_params.sessiontimeout);


after investigation the compilation works fine until r318, r319 fails. (but
with another error)
the exact same error (error: format '%ld' expects type 'long int') appears
with r321

i have made this bottom patch which solve the compile error.
Could you include the patch in the trunk.
With r339 there is no error if I compile natively on x86_32 and x86_64.
The error appears when I compile in cross compile tools.

Regards.


Index: src/redir.c
===================================================================
--- src/redir.c (révision 339)
+++ src/redir.c (copie de travail)
@@ -2793,11 +2793,11 @@
          setenv("CHI_SESSION_ID", conn.s_state.sessionid, 1);
          setenv("CHI_USERNAME", conn.s_state.redir.username, 1);
          setenv("CHI_USERURL", conn.s_state.redir.userurl, 1);
-         sprintf(buffer, "%ld", conn.s_state.input_octets);
+         sprintf(buffer, "%lld", conn.s_state.input_octets);
          setenv("CHI_INPUT_BYTES", buffer, 1);
-         sprintf(buffer, "%ld", conn.s_state.output_octets);
+         sprintf(buffer, "%lld", conn.s_state.output_octets);
          setenv("CHI_OUTPUT_BYTES", buffer, 1);
-         sprintf(buffer, "%ld", conn.s_params.sessiontimeout);
+         sprintf(buffer, "%lld", conn.s_params.sessiontimeout);
          setenv("CHI_SESSION_TIMEOUT", buffer, 1);

          redir_chartohex(conn.s_state.redir.uamchal, buffer, REDIR_MD5LEN);



Thierry Museux
France Wireless Technologies
www.fwt.fr



More information about the Chilli mailing list