Skip to content

Conversation

@softwarecki
Copy link
Collaborator

Ensure that modules are only built as llext when CONFIG_LLEXT is enabled.

Previously, if a module was configured to be built as a loadable module (config option set to 'm') while CONFIG_LLEXT was disabled, the build would fail due to missing support for llext.

CMake Error at zephyr/cmake/modules/extensions.cmake:5844 (message):
  add_llext_target: CONFIG_LLEXT must be enabled
Call Stack (most recent call first):
  sof/zephyr/CMakeLists.txt:52 (add_llext_target)
  sof/src/debug/tester/llext/CMakeLists.txt:4 (sof_llext_build)

This change adds a conditional check to all relevant CMake files to prevent such errors. It aligns module building behavior with CONFIG_LIBRARY_DEFAULT_MODULAR, which controls whether modules are built as loadable by default. The default behavior depends on whether CONFIG_LLEXT is enabled in the configuration.

Ensure that modules are only built as llext when CONFIG_LLEXT is enabled.

Previously, if a module was configured to be built as a loadable
module (config option set to 'm') while CONFIG_LLEXT was disabled,
the build would fail due to missing support for llext.

This change adds a conditional check to all relevant CMake files
to prevent such errors. It aligns module building behavior with
CONFIG_LIBRARY_DEFAULT_MODULAR, which controls whether modules
are built as loadable by default. The default behavior depends
on whether CONFIG_LLEXT is enabled in the configuration.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds conditional checks to prevent module build failures when CONFIG_LLEXT is disabled but modules are configured to build as loadable extensions.

  • Adds AND DEFINED CONFIG_LLEXT checks to all module CMake conditional statements
  • Prevents build errors when modules are set to 'm' (loadable) but llext support is unavailable
  • Ensures consistent behavior across all audio components, math modules, debug tools, and sample code

Reviewed Changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/samples/audio/CMakeLists.txt Add llext check for smart amp test module
src/probe/CMakeLists.txt Add llext check for probe module
src/math/CMakeLists.txt Add llext checks for FIR and IIR math modules
src/debug/tester/CMakeLists.txt Add llext check for component tester module
src/audio/volume/CMakeLists.txt Add llext check for volume component
src/audio/tensorflow/CMakeLists.txt Add llext check for TensorFlow component
src/audio/template/CMakeLists.txt Add llext check for template component
src/audio/tdfb/CMakeLists.txt Add llext check for TDFB component
src/audio/src/CMakeLists.txt Add llext check for SRC component
src/audio/selector/CMakeLists.txt Add llext check for selector component
src/audio/rtnr/CMakeLists.txt Add llext check for RTNR component
src/audio/mux/CMakeLists.txt Add llext check for mux component
src/audio/multiband_drc/CMakeLists.txt Add llext check for multiband DRC component
src/audio/module_adapter/CMakeLists.txt Add llext check for waves codec module
src/audio/mixin_mixout/CMakeLists.txt Add llext check for mixin/mixout component
src/audio/mfcc/CMakeLists.txt Add llext check for MFCC component
src/audio/level_multiplier/CMakeLists.txt Add llext check for level multiplier component
src/audio/igo_nr/CMakeLists.txt Add llext check for IGO NR component
src/audio/google/CMakeLists.txt Add llext checks for Google RTC and CTC audio processing
src/audio/eq_iir/CMakeLists.txt Add llext check for IIR equalizer component
src/audio/eq_fir/CMakeLists.txt Add llext check for FIR equalizer component
src/audio/drc/CMakeLists.txt Add llext check for DRC component
src/audio/dcblock/CMakeLists.txt Add llext check for DC block component
src/audio/crossover/CMakeLists.txt Add llext check for crossover component
src/audio/codec/CMakeLists.txt Add llext check for DTS codec
src/audio/asrc/CMakeLists.txt Add llext check for ASRC component
src/audio/aria/CMakeLists.txt Add llext check for ARIA component

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@tmleman tmleman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is definitely needed. The only downside is that with this solution, it's easy to forget about it when adding a new module. We should look for a more generic solution later.

Copy link
Member

@abonislawski abonislawski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will change the behaviour of build system.

Right now such dependency is used to ensure it works without LLEXT:

default m if LIBRARY_DEFAULT_MODULAR (which depends on LLEXT)
default y (to build as built-in without LLEXT)

The problem is only with TESTER config which forces 'm' in platform config.

The new problem with new approach is that it will build TESTER module as built-in instead of not building at all.
For such case we have default n for TESTER to ensure it wont build as built-in but this PR will change that.

@lyakh
Copy link
Collaborator

lyakh commented Sep 25, 2025

The problem is only with TESTER config which forces 'm' in platform config.

@abonislawski correct - with current PTL+ configurations. But what about LNL? It only sets DRC to "m" in its .config, so would it also fail if LLEXT is unselected? In general - using a configuration with "LLEXT=n" and some options set to "m" shouldn't break building, should it? In our use-case it seems logical to allow each module to decide what to do then: convert it to "y" or to "n" even though it can be argued, that this should be universal. But I think it would be acceptable to force tester to "n" in such cases. Another option to consider - we could explicitly check for "MODULES=y" and "LLEXT=n" and fail such builds as invalid.

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, but @kv2019i I assume it aligns with teh Kconfig updates ?

@lgirdwood
Copy link
Member

The problem is only with TESTER config which forces 'm' in platform config.

@abonislawski correct - with current PTL+ configurations. But what about LNL? It only sets DRC to "m" in its .config, so would it also fail if LLEXT is unselected? In general - using a configuration with "LLEXT=n" and some options set to "m" shouldn't break building, should it? In our use-case it seems logical to allow each module to decide what to do then: convert it to "y" or to "n" even though it can be argued, that this should be universal. But I think it would be acceptable to force tester to "n" in such cases. Another option to consider - we could explicitly check for "MODULES=y" and "LLEXT=n" and fail such builds as invalid.

The release build for LNL should be llexyt=y and DRC=m ? Are we saying its not ?

Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No conflict with the config updates @lgirdwood , I'm good.

@lgirdwood lgirdwood merged commit 8355a53 into thesofproject:main Sep 30, 2025
35 of 45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants