Skip to contentSkip to conversation

32-bit compilation & debug logs

DISCUSSION Thomas Monjalon 2 participants 2 messages Feb 13, 2018 – Feb 26, 2018

lore
Share & tools
lore
#0 lore raw

Hi all,

There is a very common pattern with build failures in DPDK. When compiling in 32-bit mode, there are some mismatches between printf format "%lu" / "%lx" and the size of the data being 64-bit. In 32-bit mode, a long is 32 bits long :)
That's why "%lx" must be replaced by "%" PRIx64.

	long     -> %lx
	uint64_t -> %PRIx64

Most of the times, using %l is wrong (except when printing a long). So next time you write %l, please think "I am probably wrong".

For the existing codebase, please grep "%l".
There are probably some remaining wrong "%l" which are not detected when compiling, because the code is in debug functions never enabled. Note that debug code should be tested but there can be some forgotten code paths.

Thanks

#1 lore raw
Quoted 14 lines · Thomas Monjalon

Hi all,

There is a very common pattern with build failures in DPDK. When compiling in 32-bit mode, there are some mismatches between printf format "%lu" / "%lx" and the size of the data being 64-bit. In 32-bit mode, a long is 32 bits long :)
That's why "%lx" must be replaced by "%" PRIx64.

	long     -> %lx
	uint64_t -> %PRIx64

Most of the times, using %l is wrong (except when printing a long). So next time you write %l, please think "I am probably wrong".

Quoted 8 lines

For the existing codebase, please grep "%l".
There are probably some remaining wrong "%l" which are not detected when compiling, because the code is in debug functions never enabled. Note that debug code should be tested but there can be some forgotten code paths.

Thanks

This sounds like something that should be part of build automation or check-build script.

Signature · 2 lines
Thanks,
Anatoly