Bug 14797 - Failed to compile in Docker Alpine Linux 3.13 on ARM platform
Summary: Failed to compile in Docker Alpine Linux 3.13 on ARM platform
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Build (show other bugs)
Version: 4.13.8
Hardware: Other Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-15 13:06 UTC by Guillaume Boudreau
Modified: 2021-08-15 13:06 UTC (History)
0 users

See Also:


Attachments
Suggested patch for cmocka conflicting types for 'uintptr_t' (1.20 KB, patch)
2021-08-15 13:06 UTC, Guillaume Boudreau
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Guillaume Boudreau 2021-08-15 13:06:42 UTC
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.

Error:

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,
                 from /usr/include/inttypes.h:9,
                 from ../../third_party/cmocka/cmocka.c:27:
/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.