Created attachment 16737 [details]
Suggested patch for cmocka conflicting types for 'uintptr_t'
Trying to compile Samba (I tried 4.13.8) in a Alpine Linux 3.13 Docker build.
In file included from ../../third_party/cmocka/cmocka.c:61:
../../third_party/cmocka/cmocka.h:127:28: error: conflicting types for 'uintptr_t'
127 | typedef unsigned int uintptr_t;
In file included from /usr/include/stdint.h:20,
/usr/include/bits/alltypes.h:63:24: note: previous declaration of 'uintptr_t' was here
63 | typedef unsigned _Addr uintptr_t;
This issue is documented in cmocka: https://gitlab.com/cmocka/cmocka/-/issues/38
and has been fixed in October 2020.
But since the cmocka third_party files have not been updated since quite a while in the Samba codebase, this bug still exists in Samba.
To workaround this issue, I'm running this command before compiling:
sed -i -e 's/\!defined._UINTPTR_T_DEFINED./\!defined(_UINTPTR_T_DEFINED) \&\& \!defined(__DEFINED_uintptr_t)/' third_party/cmocka/cmocka.h
(resulting diff attached)
Not sure if this is a good idea, versus just updating cmocka to the latest available version instead.