[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, 1 insertion(+), 1 deletion(-)
[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 and glibc.

However on musl we get the follwing error without sys/time.h

samples/mei/mei-amt-version.c: In function 'mei_recv_msg':
samples/mei/mei-amt-version.c:159:24: error: storage size of 'tv' isn't known
  159 |         struct timeval tv;
      |                        ^~
samples/mei/mei-amt-version.c:160:9: error: unknown type name 'fd_set'
  160 |         fd_set set;
      |         ^~~~~~
samples/mei/mei-amt-version.c:168:9: error: implicit declaration of function 'FD_ZERO' [-Wimplicit-function-declaration]
  168 |         FD_ZERO(&set);
      |         ^~~~~~~
samples/mei/mei-amt-version.c:169:9: error: implicit declaration of function 'FD_SET'; did you mean 'L_SET'? [-Wimplicit-function-declaration]
  169 |         FD_SET(me->fd, &set);
      |         ^~~~~~
      |         L_SET
samples/mei/mei-amt-version.c:170:14: error: implicit declaration of function 'select' [-Wimplicit-function-declaration]
  170 |         rc = select(me->fd + 1, &set, NULL, NULL, &tv);
      |              ^~~~~~
samples/mei/mei-amt-version.c:171:23: error: implicit declaration of function 'FD_ISSET' [-Wimplicit-function-declaration]
  171 |         if (rc > 0 && FD_ISSET(me->fd, &set)) {
      |                       ^~~~~~~~
samples/mei/mei-amt-version.c:159:24: warning: unused variable 'tv' [-Wunused-variable]
  159 |         struct timeval tv;
      |                        ^~

Hence the the file has been included.

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

diff --git a/samples/mei/mei-amt-version.c b/samples/mei/mei-amt-version.c
index 867debd3b912..1d7254bcb44c 100644
--- a/samples/mei/mei-amt-version.c
+++ b/samples/mei/mei-amt-version.c
@@ -69,11 +69,11 @@
 #include <string.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
+#include <sys/time.h>
 #include <unistd.h>
 #include <errno.h>
 #include <stdint.h>
 #include <stdbool.h>
-#include <bits/wordsize.h>
 #include <linux/mei.h>
 
 /*****************************************************************************
-- 
2.50.0
Re: [PATCH] samples: mei: Fix building on musl libc
Posted by Greg KH 3 months, 1 week ago
On Tue, Jul 01, 2025 at 09:37:26PM +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 and glibc.
> 
> However on musl we get the follwing error without sys/time.h
> 
> samples/mei/mei-amt-version.c: In function 'mei_recv_msg':
> samples/mei/mei-amt-version.c:159:24: error: storage size of 'tv' isn't known
>   159 |         struct timeval tv;
>       |                        ^~
> samples/mei/mei-amt-version.c:160:9: error: unknown type name 'fd_set'
>   160 |         fd_set set;
>       |         ^~~~~~
> samples/mei/mei-amt-version.c:168:9: error: implicit declaration of function 'FD_ZERO' [-Wimplicit-function-declaration]
>   168 |         FD_ZERO(&set);
>       |         ^~~~~~~
> samples/mei/mei-amt-version.c:169:9: error: implicit declaration of function 'FD_SET'; did you mean 'L_SET'? [-Wimplicit-function-declaration]
>   169 |         FD_SET(me->fd, &set);
>       |         ^~~~~~
>       |         L_SET
> samples/mei/mei-amt-version.c:170:14: error: implicit declaration of function 'select' [-Wimplicit-function-declaration]
>   170 |         rc = select(me->fd + 1, &set, NULL, NULL, &tv);
>       |              ^~~~~~
> samples/mei/mei-amt-version.c:171:23: error: implicit declaration of function 'FD_ISSET' [-Wimplicit-function-declaration]
>   171 |         if (rc > 0 && FD_ISSET(me->fd, &set)) {
>       |                       ^~~~~~~~
> samples/mei/mei-amt-version.c:159:24: warning: unused variable 'tv' [-Wunused-variable]
>   159 |         struct timeval tv;
>       |                        ^~
> 
> Hence the the file has been included.
> 
> Signed-off-by: Brahmajit Das <listout@listout.xyz>
> ---
>  samples/mei/mei-amt-version.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

What commit id does this fix?

thanks,

greg k-h
Re: [PATCH] samples: mei: Fix building on musl libc
Posted by Brahmajit Das 3 months, 1 week ago
On 02.07.2025 07:45, Greg KH wrote:
> On Tue, Jul 01, 2025 at 09:37:26PM +0530, Brahmajit Das wrote:
... snip ...
> > 
> > Signed-off-by: Brahmajit Das <listout@listout.xyz>
> > ---
> >  samples/mei/mei-amt-version.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> What commit id does this fix?
> 
> thanks,
> 
> greg k-h

The (both) changes were introduced by commit c52827cc4ddf3 (staging/mei:
add mei user space example).
Shall I resend the patch with a Fixes tag?
-- 
Regards,
listout
Re: [PATCH] samples: mei: Fix building on musl libc
Posted by Greg KH 3 months, 1 week ago
On Wed, Jul 02, 2025 at 05:17:33PM +0530, Brahmajit Das wrote:
> On 02.07.2025 07:45, Greg KH wrote:
> > On Tue, Jul 01, 2025 at 09:37:26PM +0530, Brahmajit Das wrote:
> ... snip ...
> > > 
> > > Signed-off-by: Brahmajit Das <listout@listout.xyz>
> > > ---
> > >  samples/mei/mei-amt-version.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > What commit id does this fix?
> > 
> > thanks,
> > 
> > greg k-h
> 
> The (both) changes were introduced by commit c52827cc4ddf3 (staging/mei:
> add mei user space example).
> Shall I resend the patch with a Fixes tag?

A fixes tag would be great, th anks.

greg k-h