mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-09 16:01:54 -09:00
package/openscap: fix build failure with dbus and musl
The openscap build can fail with the following error:
In file included from [...]/src/OVAL/probes/unix/linux/systemdunitproperty_probe.c:38:
[...]/src/OVAL/probes/unix/linux/systemdshared.h: In function ‘get_all_systemd_units’:
[...]/src/OVAL/probes/unix/linux/systemdshared.h:188:50: error: implicit declaration of function ‘basename’; did you mean ‘rename’? [-Wimplicit-function-declaration]
188 | char *unit_name_s = oscap_strdup(basename(value.str));
| ^~~~~~~~
| rename
In file included from [...]/src/OVAL/probes/unix/linux/systemdunitdependency_probe.c:37:
[...]/src/OVAL/probes/unix/linux/systemdshared.h: In function ‘get_all_systemd_units’:
[...]/src/OVAL/probes/unix/linux/systemdshared.h:188:50: error: implicit declaration of function ‘basename’; did you mean ‘rename’? [-Wimplicit-function-declaration]
188 | char *unit_name_s = oscap_strdup(basename(value.str));
| ^~~~~~~~
| rename
This error happens when:
- dbus is enabled in the configuration, making openscap build probes
code
- the toolchain uses musl, which does not declare basename() in string.h
the way glibc does
The build error can be reproduced with the following minimal defconfig:
BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_NEON=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_ARMV7_EABIHF_MUSL_BLEEDING_EDGE=y
BR2_PACKAGE_DBUS=y
BR2_PACKAGE_OPENSCAP=y
Backport the upstream fix to allow openscap to build with such
configuration. The custom patch can be removed once openscap is
re-released on its branch 1.3.x.
The issue affects master, 2026.05.x and 2025.02.x
Fixes: https://autobuild.buildroot.org/results/a874d4f34d36fa9f8566be90ad2d5facb99aec24/
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
committed by
Thomas Petazzoni
parent
5ea2135a56
commit
bd5b267b1d
@@ -0,0 +1,48 @@
|
||||
From ab69b76cb40d6f35d252246e965245804b17591f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Alexis=20Lothor=C3=A9?= <alexis.lothore@bootlin.com>
|
||||
Date: Thu, 13 Aug 2026 15:18:15 +0200
|
||||
Subject: [PATCH] OVAL/probes: add missing header include
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Openscap build can fail with the following log when
|
||||
-Wimplicit-function-declaration is turned into an error:
|
||||
|
||||
In file included from [...]/src/OVAL/probes/unix/linux/systemdunitproperty_probe.c:38:
|
||||
[...]/src/OVAL/probes/unix/linux/systemdshared.h: In function ‘get_all_systemd_units’:
|
||||
[...]/src/OVAL/probes/unix/linux/systemdshared.h:188:50: error: implicit declaration of function ‘basename’; did you mean ‘rename’? [-Wimplicit-function-declaration]
|
||||
188 | char *unit_name_s = oscap_strdup(basename(value.str));
|
||||
| ^~~~~~~~
|
||||
| rename
|
||||
In file included from [...]/src/OVAL/probes/unix/linux/systemdunitdependency_probe.c:37:
|
||||
[...]/src/OVAL/probes/unix/linux/systemdshared.h: In function ‘get_all_systemd_units’:
|
||||
[...]/src/OVAL/probes/unix/linux/systemdshared.h:188:50: error: implicit declaration of function ‘basename’; did you mean ‘rename’? [-Wimplicit-function-declaration]
|
||||
188 | char *unit_name_s = oscap_strdup(basename(value.str));
|
||||
| ^~~~~~~~
|
||||
| rename
|
||||
|
||||
Add the missing header include pointed by `man 3 basename` to fix the
|
||||
error.
|
||||
|
||||
Upstream: https://github.com/OpenSCAP/openscap/commit/ab69b76cb40d6f35d252246e965245804b17591f
|
||||
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
|
||||
---
|
||||
src/OVAL/probes/unix/linux/systemdshared.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/OVAL/probes/unix/linux/systemdshared.h b/src/OVAL/probes/unix/linux/systemdshared.h
|
||||
index 879ae5be9d6c..57e94ca6f49e 100644
|
||||
--- a/src/OVAL/probes/unix/linux/systemdshared.h
|
||||
+++ b/src/OVAL/probes/unix/linux/systemdshared.h
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
+#include <libgen.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include "common/debug_priv.h"
|
||||
--
|
||||
2.55.0
|
||||
|
||||
Reference in New Issue
Block a user