[RFC PATCH] samples: mei: Fix building on musl libc

Brahmajit Das posted 1 patch 3 months, 1 week ago
There is a newer version of this series
samples/mei/mei-amt-version.c | 2 ++
1 file changed, 2 insertions(+)
[RFC PATCH] samples: mei: Fix building on musl libc
Posted by Brahmajit Das 3 months, 1 week ago
The header bits/wordsize.h is glibc specific and on building on musl
with allyesconfig results in

samples/mei/mei-amt-version.c:77:10: fatal error: bits/wordsize.h: No such file or directory
   77 | #include <bits/wordsize.h>
      |          ^~~~~~~~~~~~~~~~~

mei-amt-version.c build file without bits/wordsize.h on musl. I'm not
sure we can remove the header completely or how it's used under glibc.

Signed-off-by: Brahmajit Das <listout@listout.xyz>
---
 samples/mei/mei-amt-version.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/samples/mei/mei-amt-version.c b/samples/mei/mei-amt-version.c
index 867debd3b912..c6850f7b883a 100644
--- a/samples/mei/mei-amt-version.c
+++ b/samples/mei/mei-amt-version.c
@@ -73,7 +73,9 @@
 #include <errno.h>
 #include <stdint.h>
 #include <stdbool.h>
+#if defined(__GLIBC__)
 #include <bits/wordsize.h>
+#endif
 #include <linux/mei.h>
 
 /*****************************************************************************
-- 
2.50.0
Re: [RFC PATCH] samples: mei: Fix building on musl libc
Posted by Greg KH 3 months, 1 week ago
On Tue, Jul 01, 2025 at 02:14:30AM +0530, Brahmajit Das wrote:
> The header bits/wordsize.h is glibc specific and on building on musl
> with allyesconfig results in
> 
> samples/mei/mei-amt-version.c:77:10: fatal error: bits/wordsize.h: No such file or directory
>    77 | #include <bits/wordsize.h>
>       |          ^~~~~~~~~~~~~~~~~
> 
> mei-amt-version.c build file without bits/wordsize.h on musl. I'm not
> sure we can remove the header completely or how it's used under glibc.

Can you look into that instead of just adding a #ifdef that might not
actually be needed?

thanks,

greg k-h
Re: [RFC PATCH] samples: mei: Fix building on musl libc
Posted by Brahmajit Das 3 months, 1 week ago
On 01.07.2025 07:13, Greg KH wrote:
> On Tue, Jul 01, 2025 at 02:14:30AM +0530, Brahmajit Das wrote:
> > The header bits/wordsize.h is glibc specific and on building on musl
> > with allyesconfig results in
> > 
> > samples/mei/mei-amt-version.c:77:10: fatal error: bits/wordsize.h: No such file or directory
> >    77 | #include <bits/wordsize.h>
> >       |          ^~~~~~~~~~~~~~~~~
> > 
> > mei-amt-version.c build file without bits/wordsize.h on musl. I'm not
> > sure we can remove the header completely or how it's used under glibc.
> 
> Can you look into that instead of just adding a #ifdef that might not
> actually be needed?
> 
> thanks,
> 
> greg k-h

Did some testing and it seems like we can remove the bits/wordsize.h. It
does not affect build on either glibc or musl.
I'll send a patch.

-- 
Regards,
listout