From cf2bae4c064a023559fca09f1970d8959bd9a658 Mon Sep 17 00:00:00 2001 From: Vinayak Katoch Date: Mon, 19 Jan 2026 13:14:42 +0530 Subject: [PATCH 1/2] Non-Android builds lack BSD string functions Standard glibc does not provide BSD-specific string functions like strlcpy and strlcat, which are needed for safe string operations. Android includes these functions natively, but Linux GNU builds require an external library to provide them. Add dependency on libbsd-overlay for non-Android targets to provide the missing BSD functions. Configure the build system to detect and link against libbsd when building for Linux GNU platforms. Signed-off-by: Vinayak Katoch --- configure.ac | 8 ++++++++ src/Makefile.am | 12 ++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 7a87f37d..886ce929 100644 --- a/configure.ac +++ b/configure.ac @@ -63,6 +63,14 @@ AS_IF([test "$compile_for_android" = no], [ AC_SUBST(YAML_LIBS) ]) +# Check for libbsd only if not Android (provides strlcpy, strlcat, etc.) +AS_IF([test "$compile_for_android" = no], [ + PKG_CHECK_MODULES([BSD], [libbsd-overlay], [], + [AC_MSG_ERROR([libbsd (libbsd-overlay) is required but not found.])]) + AC_SUBST(BSD_CFLAGS) + AC_SUBST(BSD_LIBS) +]) + # Configure config base path option (--with-config-base-dir) AC_ARG_WITH([config-base-dir], [AS_HELP_STRING([--with-config-base-dir=PATH], diff --git a/src/Makefile.am b/src/Makefile.am index 991058ba..fd0e080a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,7 +5,7 @@ LIBDSPRPC_CFLAGS = -fno-short-enums -U_DEBUG -DARM_ARCH_7A -DLE_ENABLE -DENABLE_ if ANDROID_CC LIBDSPRPC_CFLAGS += -DDEFAULT_DSP_SEARCH_PATHS='";/vendor/lib/rfsa/adsp;/vendor/dsp;"' else -LIBDSPRPC_CFLAGS += -DPARSE_YAML @YAML_CFLAGS@ -DDEFAULT_DSP_SEARCH_PATHS='";/usr/lib/rfsa/adsp;/usr/lib/dsp;"' +LIBDSPRPC_CFLAGS += -DPARSE_YAML @YAML_CFLAGS@ @BSD_CFLAGS@ -DDEFAULT_DSP_SEARCH_PATHS='";/usr/lib/rfsa/adsp;/usr/lib/dsp;"' endif LIBDSPRPC_SOURCES = \ @@ -67,11 +67,11 @@ LIBDEFAULT_LISTENER_SOURCES = \ if ANDROID_CC USE_LOG = -llog else -# Add YAML libs to link flags for non-Android builds -libadsprpc_la_LIBADD = @YAML_LIBS@ -libcdsprpc_la_LIBADD = @YAML_LIBS@ -libsdsprpc_la_LIBADD = @YAML_LIBS@ -libgdsprpc_la_LIBADD = @YAML_LIBS@ +# Add YAML and BSD libs to link flags for non-Android builds +libadsprpc_la_LIBADD = @YAML_LIBS@ @BSD_LIBS@ +libcdsprpc_la_LIBADD = @YAML_LIBS@ @BSD_LIBS@ +libsdsprpc_la_LIBADD = @YAML_LIBS@ @BSD_LIBS@ +libgdsprpc_la_LIBADD = @YAML_LIBS@ @BSD_LIBS@ endif ADSP_CFLAGS = $(LIBDSPRPC_CFLAGS) -DDEFAULT_DOMAIN_ID=0 From e3acb5816d32f0ee571c9a8c6704183d68fad88f Mon Sep 17 00:00:00 2001 From: Vinayak Katoch Date: Mon, 19 Jan 2026 14:06:29 +0530 Subject: [PATCH 2/2] ci: update workflows with libbsd-dev dependency Add libbsd-dev:arm64 to ARM64 workflows (build_linux_arm64.yml, codeql.yml, abi-compat.yml) and ensure libbsd-dev is in build_linux_gnu.yml to resolve configure errors during compilation. Signed-off-by: Vinayak Katoch --- .github/workflows/abi-compat.yml | 3 ++- .github/workflows/build_linux_arm64.yml | 3 ++- .github/workflows/build_linux_gnu.yml | 2 +- .github/workflows/codeql.yml | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/abi-compat.yml b/.github/workflows/abi-compat.yml index 281ef33a..6771d22e 100644 --- a/.github/workflows/abi-compat.yml +++ b/.github/workflows/abi-compat.yml @@ -82,7 +82,8 @@ jobs: automake autoconf libtool pkg-config \ gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu \ libyaml-dev \ - libyaml-0-2:arm64 libyaml-dev:arm64 + libyaml-0-2:arm64 libyaml-dev:arm64 \ + libbsd-dev:arm64 # Sanity checks abi-compliance-checker -version diff --git a/.github/workflows/build_linux_arm64.yml b/.github/workflows/build_linux_arm64.yml index cfcb8e0c..52636f92 100644 --- a/.github/workflows/build_linux_arm64.yml +++ b/.github/workflows/build_linux_arm64.yml @@ -63,7 +63,8 @@ jobs: automake autoconf libtool pkg-config \ gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu\ libyaml-dev \ - libyaml-0-2:arm64 libyaml-dev:arm64 + libyaml-0-2:arm64 libyaml-dev:arm64 \ + libbsd-dev:arm64 - name: Sanity check libyaml (headers + ARM64 pc) run: | diff --git a/.github/workflows/build_linux_gnu.yml b/.github/workflows/build_linux_gnu.yml index b3fe1ad9..8f57fbdd 100644 --- a/.github/workflows/build_linux_gnu.yml +++ b/.github/workflows/build_linux_gnu.yml @@ -26,7 +26,7 @@ jobs: sudo apt-get install -y \ build-essential \ autoconf automake libtool pkg-config \ - libyaml-dev \ + libyaml-dev libbsd-dev \ tar gzip - name: Compile code for LE platform diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 588a214d..596c7381 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -77,7 +77,8 @@ jobs: automake autoconf libtool pkg-config \ gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu\ libyaml-dev \ - libyaml-0-2:arm64 libyaml-dev:arm64 + libyaml-0-2:arm64 libyaml-dev:arm64 \ + libbsd-dev:arm64 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL