I don't know, I don't use C++ !!! Maybe Xiang or Masayuki has some suggestions, because they use it with NuttX!
BR, Alan On Fri, Jul 25, 2025 at 12:14 PM Bartek22 <bartol2...@gmail.com> wrote: > Thanks for reply, so what is the solution in that case and how can I use > libc++ from arm toolchain to avoid this issue? > Best regards, > Bartek > > > Wiadomość napisana przez Alan C. Assis <acas...@gmail.com> w dniu 25 > lip 2025, o godz. 16:57: > > > > Hi Bart, > > > > You cannot replace NuttX libc with another external libc because the > kernel > > is tightly coupled to it. > > > > Some functions could work fine, but others will create issues. In the > past > > all kernel libc used the same name as these libc functions for > > applications, not when a function is kernel specific it will include the > > prefix nx_. > > > > Probably some kernel functions are still dependent on those same libc > names > > used by applications, in this case replacing them with an external libc > > will be an issue. > > > > BR, > > > > Alan > > > >> On Fri, Jul 25, 2025 at 9:54 AM Bartek22 <bartol2...@gmail.com> wrote: > >> > >> I tried to compile simple app from NuttX with standard library from > >> toolchain and I'm getting this errors: > arm-none-eabi/include/stdlib.h:39:3: > >> error: conflicting declaration 'typedef struct div_t div_t' 39 | } > div_t; | > >> ^~~~~ Because it sees definitions from NuttX and toolchain library, I'm > >> using latest ARM toolchain 14.3. > >> > >> pt., 25 lip 2025 o 14:36 Bartek22 <bartol2...@gmail.com> napisał(a): > >> > >>> 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? > >>> > >> >