Skip to content

Conversation

@seb128
Copy link

@seb128 seb128 commented Jun 12, 2025

bashreadline.c: In function ‘handle_lost_events’:
bashreadline.c:90:14: error: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘__u64’ {aka ‘long unsigned int’} [-Werror=format=]
90 | warn("lost %llu events on CPU #%d\n", lost_cnt, cpu);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~
| |
| __u64 {aka long unsigned int}

@seb128
Copy link
Author

seb128 commented Jun 12, 2025

in fact the fix is incomplete since the other sources have the same issue, I will work on changing also those

bashreadline.c: In function ‘handle_lost_events’:
bashreadline.c:90:14: error: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘__u64’ {aka ‘long unsigned int’} [-Werror=format=]
   90 |         warn("lost %llu events on CPU #%d\n", lost_cnt, cpu);
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~
      |                                               |
      |                                               __u64 {aka long unsigned int}
@seb128 seb128 force-pushed the fix-ppc64el-build branch from 696993f to 59ed32d Compare June 12, 2025 13:17
@seb128
Copy link
Author

seb128 commented Jun 12, 2025

I've edited the other files and force pushed now, but then I'm hitting the same error for other variables

biopattern.c: In function ‘print_map’:
biopattern.c:140:49: error: format ‘%lld’ expects argument of type ‘long long int’, but argument 6 has type ‘__u64’ {aka ‘long unsigned int’} [-Werror=format=]
  140 |                 printf("%-7s %5ld %5ld %8d %10lld\n",
      |                                            ~~~~~^
      |                                                 |
      |                                                 long long int
      |                                            %10ld
......
  144 |                         counter.bytes / 1024);
      |                         ~~~~~~~~~~~~~~~~~~~~     
      |                                       |
      |                                       __u64 {aka long unsigned int}
cc1: all warnings being treated as errors
make[2]: *** [Makefile:190: /<<PKGBUILDDIR>>/libbpf-tools/.output/biopattern.o] Error 1
make[2]: Leaving directory '/<<PKGBUILDDIR>>/libbpf-tools'

Unsure if my current approach is the right way to try to fix it, I would welcome input on it...

@yonghong-song
Copy link
Collaborator

Probably you can find out how __u64 is defined in your ppc64el platform?

In my x64 system, the __u64 is defined in /usr/include/asm-generic/int-ll64.h:

#ifdef __GNUC__
__extension__ typedef __signed__ long long __s64;
__extension__ typedef unsigned long long __u64;
#else
typedef __signed__ long long __s64;
typedef unsigned long long __u64;
#endif

@jeromemarchand
Copy link
Contributor

On ppc64, __u64 is defined as an unsigned long in /usr/include/asm-generic/int-l64.h. I'm not sure what the compiler warning is about since, AFAICT, on ppc64 long and long long integer are both 64 bits. There must be some subtlety I'm missing.
No doubt this issue has been brought to light by commit aeed9e2 ("libbpf-tools: Add flag -Werror=undef").

@seb128
Copy link
Author

seb128 commented Jul 16, 2025

The definition on the ppc64el machine is similar to the one shared before

#ifdef __GNUC__
__extension__ typedef __signed__ long long __s64;
__extension__ typedef unsigned long long __u64;
#else
typedef __signed__ long long __s64;
typedef unsigned long long __u64;
#endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants