* [PATCH kvmtool] vfio: include libgen.h (for musl compatibility)
@ 2025-06-29 20:22 Thomas Perale
2025-06-30 9:02 ` Alexandru Elisei
2025-07-21 14:35 ` Will Deacon
0 siblings, 2 replies; 4+ messages in thread
From: Thomas Perale @ 2025-06-29 20:22 UTC (permalink / raw)
To: kvm; +Cc: thomas.perale
Starting GCC14 'implicit-function-declaration' are treated as errors by
default. When building kvmtool with musl libc, the following error
occurs due to missing declaration of 'basename':
vfio/core.c:537:22: error: implicit declaration of function ‘basename’ [-Wimplicit-function-declaration]
537 | group_name = basename(group_path);
| ^~~~~~~~
vfio/core.c:537:22: warning: nested extern declaration of ‘basename’ [-Wnested-externs]
vfio/core.c:537:20: error: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
537 | group_name = basename(group_path);
| ^
This patch fixes the issue by including the appropriate header, ensuring
compatibility with musl and GCC14.
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
Signed-off-by: Thomas Perale <perale.thomas@gmail.com>
---
vfio/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/vfio/core.c b/vfio/core.c
index 3ff2c0b..8f88489 100644
--- a/vfio/core.c
+++ b/vfio/core.c
@@ -3,6 +3,7 @@
#include "kvm/ioport.h"
#include <linux/list.h>
+#include <libgen.h>
#define VFIO_DEV_DIR "/dev/vfio"
#define VFIO_DEV_NODE VFIO_DEV_DIR "/vfio"
--
2.50.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH kvmtool] vfio: include libgen.h (for musl compatibility) 2025-06-29 20:22 [PATCH kvmtool] vfio: include libgen.h (for musl compatibility) Thomas Perale @ 2025-06-30 9:02 ` Alexandru Elisei 2025-06-30 9:04 ` Alexandru Elisei 2025-07-21 14:35 ` Will Deacon 1 sibling, 1 reply; 4+ messages in thread From: Alexandru Elisei @ 2025-06-30 9:02 UTC (permalink / raw) To: Thomas Perale; +Cc: kvm Hi, On Sun, Jun 29, 2025 at 10:22:21PM +0200, Thomas Perale wrote: > Starting GCC14 'implicit-function-declaration' are treated as errors by > default. When building kvmtool with musl libc, the following error > occurs due to missing declaration of 'basename': > > vfio/core.c:537:22: error: implicit declaration of function ‘basename’ [-Wimplicit-function-declaration] > 537 | group_name = basename(group_path); > | ^~~~~~~~ > vfio/core.c:537:22: warning: nested extern declaration of ‘basename’ [-Wnested-externs] > vfio/core.c:537:20: error: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion] > 537 | group_name = basename(group_path); > | ^ > > This patch fixes the issue by including the appropriate header, ensuring > compatibility with musl and GCC14. > > Signed-off-by: Thomas Perale <thomas.perale@mind.be> > Signed-off-by: Thomas Perale <perale.thomas@gmail.com> > --- > vfio/core.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/vfio/core.c b/vfio/core.c > index 3ff2c0b..8f88489 100644 > --- a/vfio/core.c > +++ b/vfio/core.c > @@ -3,6 +3,7 @@ > #include "kvm/ioport.h" > > #include <linux/list.h> > +#include <libgen.h> Looking at man 3 basename, there are two version of basename, one is the POSIX version (this is the one you get by including libgen.h), the other one is the GNU version. I don't think kvmtool cares about the differences (group_path is never '/', and it's not a static string), so if the POSIX version makes compilation with musl possible: Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com> Also checked that this is the only occurence of basename in the sources. Thanks, Alex > > #define VFIO_DEV_DIR "/dev/vfio" > #define VFIO_DEV_NODE VFIO_DEV_DIR "/vfio" > -- > 2.50.0 > > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH kvmtool] vfio: include libgen.h (for musl compatibility) 2025-06-30 9:02 ` Alexandru Elisei @ 2025-06-30 9:04 ` Alexandru Elisei 0 siblings, 0 replies; 4+ messages in thread From: Alexandru Elisei @ 2025-06-30 9:04 UTC (permalink / raw) To: will, julien.thierry.kdev; +Cc: kvm, thomas.perale Hi, Adding the maintainers. On Mon, Jun 30, 2025 at 10:02:58AM +0100, Alexandru Elisei wrote: > Hi, > > On Sun, Jun 29, 2025 at 10:22:21PM +0200, Thomas Perale wrote: > > Starting GCC14 'implicit-function-declaration' are treated as errors by > > default. When building kvmtool with musl libc, the following error > > occurs due to missing declaration of 'basename': > > > > vfio/core.c:537:22: error: implicit declaration of function ‘basename’ [-Wimplicit-function-declaration] > > 537 | group_name = basename(group_path); > > | ^~~~~~~~ > > vfio/core.c:537:22: warning: nested extern declaration of ‘basename’ [-Wnested-externs] > > vfio/core.c:537:20: error: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion] > > 537 | group_name = basename(group_path); > > | ^ > > > > This patch fixes the issue by including the appropriate header, ensuring > > compatibility with musl and GCC14. > > > > Signed-off-by: Thomas Perale <thomas.perale@mind.be> > > Signed-off-by: Thomas Perale <perale.thomas@gmail.com> > > --- > > vfio/core.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/vfio/core.c b/vfio/core.c > > index 3ff2c0b..8f88489 100644 > > --- a/vfio/core.c > > +++ b/vfio/core.c > > @@ -3,6 +3,7 @@ > > #include "kvm/ioport.h" > > > > #include <linux/list.h> > > +#include <libgen.h> > > Looking at man 3 basename, there are two version of basename, one is the POSIX > version (this is the one you get by including libgen.h), the other one is the > GNU version. I don't think kvmtool cares about the differences (group_path is > never '/', and it's not a static string), so if the POSIX version makes > compilation with musl possible: > > Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com> > > Also checked that this is the only occurence of basename in the sources. > > Thanks, > Alex > > > > > #define VFIO_DEV_DIR "/dev/vfio" > > #define VFIO_DEV_NODE VFIO_DEV_DIR "/vfio" > > -- > > 2.50.0 > > > > > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH kvmtool] vfio: include libgen.h (for musl compatibility) 2025-06-29 20:22 [PATCH kvmtool] vfio: include libgen.h (for musl compatibility) Thomas Perale 2025-06-30 9:02 ` Alexandru Elisei @ 2025-07-21 14:35 ` Will Deacon 1 sibling, 0 replies; 4+ messages in thread From: Will Deacon @ 2025-07-21 14:35 UTC (permalink / raw) To: kvm, Thomas Perale; +Cc: catalin.marinas, kernel-team, Will Deacon On Sun, 29 Jun 2025 22:22:21 +0200, Thomas Perale wrote: > Starting GCC14 'implicit-function-declaration' are treated as errors by > default. When building kvmtool with musl libc, the following error > occurs due to missing declaration of 'basename': > > vfio/core.c:537:22: error: implicit declaration of function ‘basename’ [-Wimplicit-function-declaration] > 537 | group_name = basename(group_path); > | ^~~~~~~~ > vfio/core.c:537:22: warning: nested extern declaration of ‘basename’ [-Wnested-externs] > vfio/core.c:537:20: error: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion] > 537 | group_name = basename(group_path); > | ^ > > [...] Applied to kvmtool (master), thanks! [1/1] vfio: include libgen.h (for musl compatibility) https://git.kernel.org/will/kvmtool/c/ba6830eec0f5 Cheers, -- Will https://fixes.arm64.dev https://next.arm64.dev https://will.arm64.dev ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-07-21 14:36 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-06-29 20:22 [PATCH kvmtool] vfio: include libgen.h (for musl compatibility) Thomas Perale 2025-06-30 9:02 ` Alexandru Elisei 2025-06-30 9:04 ` Alexandru Elisei 2025-07-21 14:35 ` Will Deacon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox