[LITMUS^RT] Compilation problem with liblitmus
Björn Brandenburg
bbb at mpi-sws.org
Fri Oct 4 10:03:35 CEST 2013
On Sep 26, 2013, at 7:53 AM, kurian s <s.kurian at ymail.com> wrote:
> I'm getting following compilation errors while building liblitmus. This is after compiling kernel with litmus patch.
>
> bin/uncache.c: In function ‘do_data’:
> bin/uncache.c:213:6: error: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘int64_t’ [-Werror=format]
> bin/uncache.c: In function ‘do_max_alloc’:
> bin/uncache.c:308:3: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ [-Werror=format]
> cc1: all warnings being treated as errors
> make: *** [uncache.o] Error 1
>
> I've no clue why this error is coming.
Hi Kurian,
the problem is probably due to a combination of missing casts in uncache.c and an overly picky compiler. I've pushed the below patch to the staging branch of liblitmus. Can you please check if that solves your problem?
Thanks,
Björn
commit 1786cac8600789cef13968a73195d79745f18a68
Author: Bjoern Brandenburg <bbb at mpi-sws.org>
Date: Fri Oct 4 09:57:38 2013 +0200
Add explicit casts to uncache.c
Kurian S. reported the following errors:
>bin/uncache.c: In function 'do_data':
>bin/uncache.c:213:6: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'int64_t' [-Werror=format]
>bin/uncache.c: In function 'do_max_alloc':
>bin/uncache.c:308:3: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'uint64_t' [-Werror=format]
>cc1: all warnings being treated as errors
>make: *** [uncache.o] Error 1
This patch adds explicit casts to supress the warnings.
diff --git a/bin/uncache.c b/bin/uncache.c
index b6f6913..eb62583 100644
--- a/bin/uncache.c
+++ b/bin/uncache.c
@@ -210,7 +210,7 @@ int do_data(int do_uncache, int64_t* time)
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &end);
elapsed = timespec_to_us(timespec_sub(end, start));
printf("%s Time: %ldus\n", (do_uncache) ?
- "Uncache" : "Cache", elapsed);
+ "Uncache" : "Cache", (long) elapsed);
munmap((char*)data, size);
@@ -305,7 +305,7 @@ int do_max_alloc(void)
close(fd);
printf("Maxed out allocs with %d mmaps of %lu pages in size.\n",
- count, mmap_size/PAGE_SIZE);
+ count, (unsigned long) mmap_size/PAGE_SIZE);
return 0;
}
More information about the litmus-dev
mailing list