I’m working on integrating NuttX into an existing C++ project, but I’m
facing several issues.

Background
Initially, I tried using symbolic links to connect my application to NuttX
apps/external and build everything with CMake. However, since NuttX does
not fully support CMake, I changed my approach:

My application’s CMake script now executes NuttX’s configure, make, and
make export steps.

After that, my application links against the NuttX libraries that were
built.

The Problem
I need to use libc and libstdc++ from my ARM toolchain because I require
C++23 features.
I have already modified the relevant menuconfig settings, but I’m
encountering these issues:

Conflicting declarations – Some symbols are coming from the toolchain
libraries, while others are being pulled in from NuttX, resulting in
multiple definition errors.

Unsupported relocations – If I disable NuttX’s libc and libstdc++, I get
errors like:
"... dangerous relocation: unsupported relocation ..."
I’m unsure how to cleanly integrate NuttX with a standalone C++ application
while still using the toolchain’s standard libc and libstdc++ (instead of
NuttX’s minimal libc).

What I’ve Tried
I looked at this example:
https://nuttx.apache.org/docs/latest/guides/cpp_cmake.html

However, when I modify it to use C++23 and enable C++23 features, I still
encounter the same problems.

I also want to avoid the PX4 firmware approach, where they compile NuttX
from their CMake file into libraries and then link to them. While this
might solve the issue, I’m looking for a simpler approach.

Question
What is the recommended way to:

Build NuttX while using the ARM toolchain’s standard libc and libstdc++?
Integrate NuttX into a standalone CMake-based C++23 project without symbol
conflicts?

Reply via email to