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



Reply via email to