>Number:         178862
>Category:       bin
>Synopsis:       patch tha fix cross-compilation (amd64/i386) of 
>netrate/netreceive
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 23 14:40:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Olivier Cochard-Labbe
>Release:        -current
>Organization:
>Environment:
FreeBSD labtop.orange.bsdrp.net 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r250926M: 
Thu May 23 14:29:46 CEST 2013     
[email protected]:/usr/obj/usr/src/sys/LAPTOP  amd64

>Description:
Trying to compile src/tools/tools/netrate/netrceive on amd64 -current works 
great for compiling amd64 version. But when I tried to compile with 
target_arch=i386, I've got "netreceive.c:166:42: error: format specifies type 
'long' but the argument has type 'time_t' (aka 'int') [-Werror,-Wformat]" here:

fprintf(stderr, "start at %ld.%09ld\n", then.tv_sec, then.tv_nsec);

With the help of cognet@, here is a patch.


>How-To-Repeat:
>From a -current amd64, start this compilation:

env TARGET=i386 TARGET_ARCH=i386 MACHINE=i386 OSVERSION=901000 
UNAME_r=9.1-RELEASE-p1 UNAME_v=9.1-RELEASE-p1 UNAME_p=i386 UNAME_m=i386 make -C 
/usr/src/tools/tools/netrate/netreceive

>Fix:
Applying the patch

Patch attached with submission follows:

--- tools/tools/netrate/netreceive/netreceive.c.orig    2013-05-23 
12:00:42.735844141 +0200
+++ tools/tools/netrate/netreceive/netreceive.c 2013-05-23 15:16:31.582033409 
+0200
@@ -163,7 +163,7 @@
        /* now the parent collects and prints results */
        c0 = c1 = bc0 = bc1 = 0;
        clock_gettime(CLOCK_REALTIME, &then);
-       fprintf(stderr, "start at %ld.%09ld\n", then.tv_sec, then.tv_nsec);
+       fprintf(stderr, "start at %jd.%09ld\n", (__intmax_t)then.tv_sec, 
then.tv_nsec);
        while (1) {
                int i, nt = nsock * nthreads;
                int64_t dn;
@@ -185,8 +185,8 @@
                pps = (pps * 1000000000) / (delta.tv_sec*1000000000 + 
delta.tv_nsec + 1);
                bps = ((bc0 - bc1) * 8000000000) / (delta.tv_sec*1000000000 + 
delta.tv_nsec + 1);
                fprintf(stderr, " %9ld pps %8.3f Mbps", (long)pps, .000001*bps);
-               fprintf(stderr, " - %d pkts in %ld.%09ld ns\n",
-                       (int)dn, delta.tv_sec, delta.tv_nsec);
+               fprintf(stderr, " - %d pkts in %jd.%09ld ns\n",
+                       (int)dn, (__intmax_t)delta.tv_sec, delta.tv_nsec);
                c1 = c0;
                bc1 = bc0;
        }


>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to