Right, newlib is C library. I feel dumb right now, because it seems I didn't know what I was using.
But it is still something that C++ library provided by ARM GCC distribution was only working for me with both main package of ARM GCC and additional ARM newlib package installed. I was not digging into it because it was working. Maybe C++ library which they provide doesn't work without newlib. As Greg said, don't use it. I will also explore other options now. On Sat, 20 Jun 2020, 19:08 Peter van der Perk, <i...@petervanderperk.nl> wrote: > Okay to clarify newlib is only the C library right? I'm using the > gcc-arm-none-eabi-9-2019-q4 toolchain which it seems it comes with > newlib libc but as far as I know I'm not linking to it. Furthermore > I'm interesting in std C++11 functionality for portability not just > the the C++11 dialect. > > About libcxx it seems to be only working partially with my current > toolchain (gcc-arm-none-eabi-9-2019-q4): > With minimal testing I'm already getting these problems: > - iostream gives linker errors with locale e.g. "multiple definition > of `duplocale'" > - optional.cxx doesn't compile, although disabling it can compile further > - linking with libsupc++ gives linker errors e.g. > "std::set_unexpected(void (*)())'" > - GCC9 requires to enable fpermissive CXX flags > > Do I have to use another toolchain? (Although NuttX getting started > guide is reffering to gcc-arm-none-eabi-9) or do I have to downgrade > my NuttX kernel (libcxx hasn't seen any update in 2-3 years maybe that > has to do with?) > > > Quoting Gregory Nutt <spudan...@gmail.com>: > > > Use of newlib with NuttX should be avoid. It is not binary > > compatible with NuttX. See > > > https://cwiki.apache.org/confluence/display/NUTTX/Integrating+with+Newlib > > > > This should be used instead: > > > https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=139629545 > > > > On 6/19/2020 3:54 PM, Maciej Wójcik wrote: > >> I was using newlib. It is bundled with ARM GCC toolchain, at least on > >> Ubuntu and Arch. Worked out of the box, except I remember having minor > >> build issues from time to time, when adding additional headers. This > >> question was appearing here in the past. I am also not sure what is the > >> official answer. > >> > >> If I remember correctly many libraries work, but none of them is > supported > >> by NuttX. By not supported, I mean people are still trying to help with > >> issues, but there is no official recommendation nor guarantee. > >> > >> C++ STL implementations are big projects, constantly changing and > >> toolchains are not always sane in terms which headers they are trying to > >> use. For example they may take a bit of NuttX libc, and mix it with a > bit > >> of its own headers. Then feed it to C++ STL giving unpredictable result > in > >> the end. > >> > >> I am not sure if anything that I am writing above makes sense :D In > >> practice newlib was working, but probably not good for critical > >> applications. I would also be happy to hear what is the official > statement > >> on it now. > >> > >> By the way, such GCC with newlib offers all higher C++ standards, not > just > >> C++11. > >> > >> On Fri, 19 Jun 2020, 23:13 , <i...@petervanderperk.nl> wrote: > >> > >>> For a personal project I want to use C++11, however which C++ library > >>> works best for that? Looking at the NuttX documentation it refers me > >>> to a "Contemporary port of the C++11 LLVM libcxx", but this guide > >>> ( > >>> > https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=139629545 > ) > >>> > >>> is based on a older NuttX fork. > >>> > >>> Nevertheless I've tried to follow the steps on NuttX Master, which > >>> works partially works with some extra modifications (had to enable > >>> fpermissive), after basic testing it seems C++11 threads (<thread>) is > >>> working. But when I use std::cout (<iostream>) compiling gives me the > >>> following linker error: > >>> > >>> arm-none-eabi-ld: > >>> /home/peter/brickpoweredugv/nuttx/staging/libxx.a(ios.o): in function > >>> `std::char_traits<char>::eof()': > >>> > /home/peter/brickpoweredugv/nuttx/include/libcxx/support/xlocale/__nop_locale_mgmt.h:20: > >>> multiple definition of `duplocale'; > >>> > /home/peter/brickpoweredugv/nuttx/staging/libapps.a(connector.home.peter.brickpoweredugv.apps.brickpoweredugv.o):/home/peter/brickpoweredugv/nuttx/include/libcxx/support/xlocale/__nop_locale_mgmt.h:20: > >>> first defined > >>> here > >>> arm-none-eabi-ld: > >>> /home/peter/brickpoweredugv/nuttx/staging/libxx.a(ios.o): in function > >>> `freelocale': > >>> > >>> Thus my question is, is someone actively using libcxx with C++11 in > >>> upstream NuttX and does it work well? Or do I have to use another > >>> libc++ implementation > >>> > >>> Yours sincerely, > >>> > >>> Peter van der Perk > >>> > >>> > > > >