Skip to content

Conversation

@Barto22
Copy link

@Barto22 Barto22 commented Jan 13, 2026

This commit switches SIM board builds from GCC to Clang and migrates
the C++ runtime to LLVM's libc++ and libc++abi. This PR is related to: #17826 and #17849

Summary

Recent C++ code additions require features provided by modern C++ runtimes
and standard libraries. The GNU toolchain versions currently available in CI
and common Linux distributions (GCC < 15) lack several required C++ standard
library capabilities needed by the latest libc++/libc++abi.
To ensure continued progress on C++ support in NuttX, this change:

  • Switches SIM builds to Clang as the primary compiler
  • Adopts LLVM's libc++ and libc++abi as the default runtime/standard library
  • Updates related flags and linker options for compatibility

This brings the SIM toolchain in line with modern C++ requirements and avoids
blocking future features on GCC version availability.

Impact

  • SIM board builds now default to Clang + libc++/libc++abi
  • Improved support for modern C++20/C++23 features
  • No impact on embedded architectures/toolchains (limited to SIM boards)
  • No ABI impact for non-SIM boards
  • CI builds gain broader warning coverage and better diagnostics
  • No documentation updates required at this time, but users building SIM
    locally may need Clang + libc++ installed

Testing

Test matrix executed across Linux CI:

  • SIM builds validated with Clang + libc++/libc++abi
  • Full build completed without regressions
  • ostest executed successfully under the SIM target
  • Additional C++ examples confirmed to compile and run correctly

Host: GitHub Actions CI (Ubuntu Linux)
Compiler: Clang 21 (LLVM libc++ 21.1.8)
Prior GCC versions tested (< 15) confirmed incompatibility with modern libc++

No regressions observed in SIM functionality.

This commit will change toolchain in SIM boards that uses Libcxx to use clang because GCC < 15 have lack of features needed for latest LLVM libcxx and libcxxabi.

Signed-off-by: Bartosz <bartol2205@gmail.com>
Copy link
Member

@raiden00pl raiden00pl left a comment

Choose a reason for hiding this comment

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

this way you break the test env for all users who have gcc-15 support on their hosts and don't use clang which I think is the default behavior for nuttx users. If you want to fix errors in CI, you should change the compiler in tools/ci/testlist/sim-XX.dat like its done for example here:

/arm/lpc54xx,CONFIG_ARM_TOOLCHAIN_CLANG

This commit will add clang toolchain only for CI builds.

Signed-off-by: Bartosz <bartol2205@gmail.com>
@Barto22
Copy link
Author

Barto22 commented Jan 13, 2026

this way you break the test env for all users who have gcc-15 support on their hosts and don't use clang which I think is the default behavior for nuttx users. If you want to fix errors in CI, you should change the compiler in tools/ci/testlist/sim-XX.dat like its done for example here:

/arm/lpc54xx,CONFIG_ARM_TOOLCHAIN_CLANG

Done

Revert changes in scripts.

Signed-off-by: Bartosz <bartol2205@gmail.com>
Revert formatting.

Signed-off-by: Bartosz <bartol2205@gmail.com>
@xiaoxiang781216
Copy link
Contributor

@Barto22 please sqaush your intermediate patch.

Style fixes.

Signed-off-by: Bartosz <bartol2205@gmail.com>
Revert formatting.

Signed-off-by: Bartosz <bartol2205@gmail.com>
Signed-off-by: Bartosz <bartol2205@gmail.com>
Revert formatting.

Signed-off-by: Bartosz <bartol2205@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: CI Area: Tooling Board: simulator Size: L The size of the change in this PR is large Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants