Skip to content

audioutils/lame: Add CMake vector sources. - #3666

Merged
acassis merged 1 commit into
apache:masterfrom
casaroli:fix/lame-cmake-vector-sources
Jul 26, 2026
Merged

audioutils/lame: Add CMake vector sources.#3666
acassis merged 1 commit into
apache:masterfrom
casaroli:fix/lame-cmake-vector-sources

Conversation

@casaroli

@casaroli casaroli commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix the CMake build of the bundled LAME encoder for x86 simulator hosts.

LAME's generated configuration enables SSE2 and AVX2 runtime-dispatch paths when the host compiler supports their per-function target attributes. The CMake libmp3lame target omitted the corresponding vector translation units, which left sim:alsa with unresolved symbols at link time. This change adds the complete vector source group only for CONFIG_HOST_X86 and CONFIG_HOST_X86_64; non-x86 simulator hosts retain LAME's scalar implementation.

Companion NuttX PR: apache/nuttx#19541. It supplies the bundled codec header include paths required to compile sim_offload.c.

Impact

  • New feature: No.
  • User adaptation: No.
  • Build impact: Yes. Fixes linking of CMake sim:alsa builds on x86 hosts when LAME enables its vector dispatch.
  • Hardware impact: No. This is host-simulator build integration; x86 vector routines continue to be selected only by LAME's runtime CPU dispatch.
  • Documentation impact: No.
  • Security impact: No.
  • Compatibility impact: No. Non-x86 hosts continue to compile and use the scalar LAME path.
  • Dependency: must be merged with the companion NuttX codec-header PR for a complete sim:alsa CMake fix.

Testing

Verified locally with the companion NuttX branch.

  • Build host: Fedora Linux 44, x86_64, GCC 16.1.1.
  • Target: sim:alsa, CMake/Ninja, CONFIG_SIM_M32=y.

Before this change, after resolving the missing codec headers, the final link failed with unresolved LAME vector symbols:

undefined reference to `quantize_lines_xrpow_avx2'
undefined reference to `count_bit_esc_sse2'

After this change:

cmake -B build -DBOARD_CONFIG=sim:alsa -DNXTMPDIR=OFF -GNinja
cmake --build build -j4

completed successfully and produced nuttx.tgz.

Additional verification:

cmake-format --check audioutils/lame/CMakeLists.txt
git diff --check

Both completed successfully.

No hardware runtime test applies to this host simulator build.

PR verification self-check

  • This PR introduces one focused functional change.
  • All required PR description fields are completed.
  • The commit has a descriptive topic/body, Signed-off-by, and Assisted-by trailer.
  • The modified CMake file passes cmake-format and git diff --check.
  • This PR is ready for review.

Add the SSE2 and AVX2 vector implementation files to the CMake libmp3lame target for x86 simulator hosts. LAME's enabled runtime dispatch paths call these functions, so omitting them leaves sim:alsa with unresolved symbols at link time.

Non-x86 simulator hosts continue to use LAME's scalar implementation.

Assisted-by: Zed:GPT-5.6 Terra
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>

@cederom cederom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you @casaroli :-)

@acassis
acassis merged commit 3ecd036 into apache:master Jul 26, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants