This is because Alan's porting isn't compatible with the NuttX's latest master. Please try this patch which integrate the latest libc++(11.0.0-rc1) into NuttX: https://github.com/apache/incubator-nuttx/pull/1592 Note: you don't need git clone libc++ manually, Makefile will do this automatically.
> -----Original Message----- > From: Matt DeWall <mdew...@gmail.com> > Sent: Friday, August 14, 2020 9:23 AM > To: dev@nuttx.apache.org > Subject: Re: cpp cxx help - No thread API > > Thanks Xiang. We're definitely getting closer, I now hit some conflicting > declarations within libcxx: > > IN: arch/arm/src/libarch.a -> staging/libarch.a > make[1]: Entering directory '/nuttx/nuttx/libs/libxx' > CXX: libxx_cxa_atexit.cxx > CXX: libxx_eabi_atexit.cxx > CXX: libcxx/algorithm.cxx > In file included from /nuttx/nuttx/include/string.h:45, > from /nuttx/nuttx/include/libcxx/string.h:61, > from /nuttx/nuttx/include/libcxx/cstring:61, > from /nuttx/nuttx/include/libcxx/algorithm:638, > from libcxx/algorithm.cxx:10: > /nuttx/nuttx/include/libcxx/stddef.h:57:21: error: conflicting declaration > 'typedef long double max_align_t' > 57 | typedef long double max_align_t; > | ^~~~~~~~~~~ > In file included from /nuttx/nuttx/include/libcxx/cstddef:43, > from /nuttx/nuttx/include/libcxx/initializer_list:47, > from /nuttx/nuttx/include/libcxx/algorithm:636, > from libcxx/algorithm.cxx:10: > /nuttx/nuttx/include/stddef.h:120:3: note: previous declaration as 'typedef > struct max_align_t max_align_t' > 120 | } max_align_t; > | ^~~~~~~~~~~ > In file included from /nuttx/nuttx/include/libcxx/__locale:40, > from /nuttx/nuttx/include/libcxx/ios:216, > from /nuttx/nuttx/include/libcxx/ostream:138, > from /nuttx/nuttx/include/libcxx/istream:163, > from /nuttx/nuttx/include/libcxx/random:1646, > from libcxx/algorithm.cxx:11: > /nuttx/nuttx/include/libcxx/support/xlocale/__nop_locale_mgmt.h:20:24: > error: 'void* duplocale(locale_t)' was declared extern' and later 'static' > [-fpermissive] > 20 | static inline locale_t duplocale(locale_t) { > | ^~~~~~~~~ > In file included from /nuttx/nuttx/include/libcxx/__locale:21, > from /nuttx/nuttx/include/libcxx/ios:216, > from /nuttx/nuttx/include/libcxx/ostream:138, > from /nuttx/nuttx/include/libcxx/istream:163, > from /nuttx/nuttx/include/libcxx/random:1646, > from libcxx/algorithm.cxx:11: > /nuttx/nuttx/include/locale.h:127:10: note: previous declaration of 'void* > duplocale(locale_t)' > 127 | locale_t duplocale(locale_t locobj); > | ^~~~~~~~~ > In file included from /nuttx/nuttx/include/libcxx/__locale:40, > from /nuttx/nuttx/include/libcxx/ios:216, > from /nuttx/nuttx/include/libcxx/ostream:138, > from /nuttx/nuttx/include/libcxx/istream:163, > from /nuttx/nuttx/include/libcxx/random:1646, > from libcxx/algorithm.cxx:11: > /nuttx/nuttx/include/libcxx/support/xlocale/__nop_locale_mgmt.h:24:20: > error: 'void freelocale(locale_t)' was declared extern' and later 'static' > [-fpermissive] > 24 | static inline void freelocale(locale_t) { > | ^~~~~~~~~~ > In file included from /nuttx/nuttx/include/libcxx/__locale:21, > from /nuttx/nuttx/include/libcxx/ios:216, > from /nuttx/nuttx/include/libcxx/ostream:138, > from /nuttx/nuttx/include/libcxx/istream:163, > from /nuttx/nuttx/include/libcxx/random:1646, > from libcxx/algorithm.cxx:11: > /nuttx/nuttx/include/locale.h:128:6: note: previous declaration of 'void > freelocale(locale_t)' > 128 | void freelocale(locale_t locobj); > | ^~~~~~~~~~ > In file included from /nuttx/nuttx/include/libcxx/__locale:40, > from /nuttx/nuttx/include/libcxx/ios:216, > from /nuttx/nuttx/include/libcxx/ostream:138, > from /nuttx/nuttx/include/libcxx/istream:163, > from /nuttx/nuttx/include/libcxx/random:1646, > from libcxx/algorithm.cxx:11: > /nuttx/nuttx/include/libcxx/support/xlocale/__nop_locale_mgmt.h:27:24: > error: 'void* newlocale(int, const char*, locale_t)' was declared 'extern' > and later 'static' [-fpermissive] > 27 | static inline locale_t newlocale(int, const char *, locale_t) { > | ^~~~~~~~~ > In file included from /nuttx/nuttx/include/libcxx/__locale:21, > from /nuttx/nuttx/include/libcxx/ios:216, > from /nuttx/nuttx/include/libcxx/ostream:138, > from /nuttx/nuttx/include/libcxx/istream:163, > from /nuttx/nuttx/include/libcxx/random:1646, > from libcxx/algorithm.cxx:11: > /nuttx/nuttx/include/locale.h:126:10: note: previous declaration of 'void* > newlocale(int, const char*, locale_t)' > 126 | locale_t newlocale(int category_mask, FAR const char *locale, > locale_t base); > | ^~~~~~~~~ > In file included from /nuttx/nuttx/include/libcxx/__locale:40, > from /nuttx/nuttx/include/libcxx/ios:216, > from /nuttx/nuttx/include/libcxx/ostream:138, > from /nuttx/nuttx/include/libcxx/istream:163, > from /nuttx/nuttx/include/libcxx/random:1646, > from libcxx/algorithm.cxx:11: > /nuttx/nuttx/include/libcxx/support/xlocale/__nop_locale_mgmt.h:31:24: > error: 'void* uselocale(locale_t)' was declared extern' and later 'static' > [-fpermissive] > 31 | static inline locale_t uselocale(locale_t) { > | ^~~~~~~~~ > In file included from /nuttx/nuttx/include/libcxx/__locale:21, > from /nuttx/nuttx/include/libcxx/ios:216, > from /nuttx/nuttx/include/libcxx/ostream:138, > from /nuttx/nuttx/include/libcxx/istream:163, > from /nuttx/nuttx/include/libcxx/random:1646, > from libcxx/algorithm.cxx:11: > /nuttx/nuttx/include/locale.h:130:10: note: previous declaration of 'void* > uselocale(locale_t)' > 130 | locale_t uselocale(locale_t newloc); > | ^~~~~~~~~ > make[1]: *** [Makefile:80: algorithm.o] Error 1 > make[1]: Leaving directory '/nuttx/nuttx/libs/libxx' > make: *** [tools/LibTargets.mk:203: libs/libxx/libxx.a] Error 2 > > On Wed, Aug 12, 2020 at 8:55 PM Xiang Xiao <xiaoxiang781...@gmail.com> > wrote: > > > Matt, please try the attached workaround. I will provide the real > > implementation later. > > > > > -----Original Message----- > > > From: Matt DeWall <mdew...@gmail.com> > > > Sent: Thursday, August 13, 2020 9:48 AM > > > To: dev@nuttx.apache.org > > > Subject: Re: cpp cxx help - No thread API > > > > > > I should add that I also tried Marc's original answer (multiple > > > lines to > > > Make.defs) with the same result. > > > > > > On Wed, Aug 12, 2020 at 6:38 PM Matt DeWall <mdew...@gmail.com> wrote: > > > > > > > Xiang and Marc, thank you very much for your quick responses. > > > > > > > > That did get me further, I'm getting an error around "at_quick_exit" > > now. > > > > Based on my googles it's regarding std11 or std17 options not > > > > being defined. > > > > > > > > I did try adding -std=c++11 to the Make.defs but it didn't have > > > > any effect. I'm using the libcxx I cloned from > > > > https://bitbucket.org/acassis/libcxx (per the docs) if that makes > > > > any difference. > > > > > > > > Error: > > > > make[1]: Entering directory '/nuttx/nuttx/libs/libxx' > > > > CXX: libxx_cxa_atexit.cxx > > > > In file included from libxx.hxx:62, > > > > from libxx_cxa_atexit.cxx:44: > > > > /nuttx/nuttx/include/libcxx/cstdlib:155:9: error: '::at_quick_exit' > > > > has not been declared > > > > 155 | using ::at_quick_exit; > > > > | ^~~~~~~~~~~~~ > > > > /nuttx/nuttx/include/libcxx/cstdlib:156:9: error: '::quick_exit' > > > > has not been declared > > > > 156 | using ::quick_exit; > > > > | ^~~~~~~~~~ > > > > make[1]: *** [Makefile:80: libxx_cxa_atexit.o] Error 1 > > > > make[1]: Leaving directory '/nuttx/nuttx/libs/libxx' > > > > make: *** [tools/LibTargets.mk:203: libs/libxx/libxx.a] Error 2 > > > > > > > > Thanks! > > > > > > > > Matt > > > > > > > > > > > > On Wed, Aug 12, 2020 at 12:22 AM Xiang Xiao > > > > <xiaoxiang781...@gmail.com> > > > > wrote: > > > > > > > >> Yes, include setting is done in the recently: > > > >> commit d32e9c38dfb0659a7f3c0cf586ba1584cd7eb3d6 > > > >> Author: Xiang Xiao <xiaoxi...@xiaomi.com> > > > >> Date: Sat Jul 11 18:37:40 2020 +0800 > > > >> > > > >> boards: Move the C/C++ search path to the common place > > > >> > > > >> so all boards support uClibc++/libc++ automatically > > > >> > > > >> Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com> > > > >> Change-Id: Ibe6fafbec57f7acb26ea6188a3e9923ea82295c5 > > > >> which is part of the work to make libc++/uCLibc++ available to > > > >> all > > boards. > > > >> > > > >> > -----Original Message----- > > > >> > From: Marc Rosen <ma...@zeitcontrol.de> > > > >> > Sent: Wednesday, August 12, 2020 2:46 PM > > > >> > To: dev@nuttx.apache.org > > > >> > Subject: Re: cpp cxx help - No thread API > > > >> > > > > >> > I should look more through before starting to say stuff. > > > >> > > > > >> > So most of the stuff I mentioned is moot because it was moved > > > >> > to a > > > >> different place that I was not aware of. > > > >> > > > > >> > So Matt as Xiang mentioned the ARCHCXXFLAGS line should be enough. > > > >> Importend is the define of __NuttX__ because it enables the > > > >> > necessary options for libcpp to compile. > > > >> > > > > >> > regards > > > >> > > > > >> > Marc Rosen > > > >> > > > > >> > ZeitControl Cardsystems GmbH > > > >> > Siedlerweg 39 > > > >> > D-32429 Minden > > > >> > Tel. ++49 (0)571 50 52 222 > > > >> > Fax. ++49 (0)571 50 52 299 > > > >> > E-Mail ma...@zeitcontrol.de > > > >> > > > > >> > Am 12.08.2020 um 08:32 schrieb Marc Rosen: > > > >> > > Hi, > > > >> > > > > > >> > > i did a curiosity check on this. > > > >> > > No Make.defs for STM32 boards on master from some what > > > >> > > yesterday evening (my localtime) has any include definitions for > > > >> > > c++. > > > >> > > > > > >> > > So to help Matt. the following is from my current config add > > > >> > > this to your Make.defs in your /nuttx/nuttx folder: > > > >> > > > > > >> > > ARCHINCLUDESXX += ${shell $(INCDIR) -s "$(CC)" > > > >> > > $(TOPDIR)$(DELIM)include} ARCHINCLUDESXX += ${shell $(INCDIR) > > > >> > > -s > > > >> "$(CC)" > > > >> > > $(TOPDIR)$(DELIM)include$(DELIM)cxx} > > > >> > > ARCHINCLUDESXX += ${shell $(INCDIR) -s "$(CC)" > > > >> > > $(TOPDIR)$(DELIM)include$(DELIM)libcxx} > > > >> > > > > > >> > > ifeq ($(CONFIG_LIBCXX),y) > > > >> > > ARCHCXXFLAGS += -std=c++17 -D__NuttX__ > > > >> > > -D_LIBCPP_BUILD_STATIC > > > >> > > > > > >> > > ifneq ($(CONFIG_CXX_EXCEPTION),y) > > > >> > > ARCHCXXFLAGS += -D_LIBCPP_NO_EXCEPTIONS > > > >> > > endif > > > >> > > > > > >> > > ifeq ($(CONFIG_LIBCXX_BUILD_LIBRARY),y) > > > >> > > ARCHCXXFLAGS += -D_LIBCPP_BUILDING_LIBARAY > > > >> > > endif > > > >> > > > > > >> > > endif > > > >> > > > > > >> > > regards > > > >> > > > > > >> > > Marc Rosen > > > >> > > > > > >> > > ZeitControl Cardsystems GmbH > > > >> > > Siedlerweg 39 > > > >> > > D-32429 Minden > > > >> > > Tel. ++49 (0)571 50 52 222 > > > >> > > Fax. ++49 (0)571 50 52 299 > > > >> > > E-Mail ma...@zeitcontrol.de > > > >> > > > > > >> > > Am 12.08.2020 um 08:07 schrieb Xiang Xiao: > > > >> > >> Do you have this in your boards/Make.defs: > > > >> > >> ARCHCXXFLAGS += -D__NuttX__ -nostdinc++ Since there are many > > > >> > >> complex setting to make C++ library work on NuttX, but this > > > >> > >> setting spread > > > >> in different Make.defs, I plan to enhance the experience in the > > > >> > next couple weeks(actually, all is done in our internal > > > >> > development > > > >> branch): > > > >> > >> 1.Centralize the setting to arch/Toolchain.defs, so all > > > >> > >> boards will > > > >> support libc++/uClibc++ automatically. > > > >> > >> 2.Upgrade to the latest uClibc++(already upstream) and > > > >> > >> libc++ without the special NuttX hack 3.Modify Makefile to > > > >> > >> automatically download the package from the official > > > >> > >> release(uClibc++ already upstream) 4.Enable all deconfig > > > >> > >> related to uClibc++/libc++ in the daily build system > > > >> > >> > > > >> > >>> -----Original Message----- > > > >> > >>> From: Matt DeWall <mdew...@gmail.com> > > > >> > >>> Sent: Wednesday, August 12, 2020 10:53 AM > > > >> > >>> To: dev@nuttx.apache.org > > > >> > >>> Subject: cpp cxx help - No thread API > > > >> > >>> > > > >> > >>> Hi devs! I'm getting started on NuttX and love the project. > > > >> Looking to port my cpp project to NuttX. > > > >> > >>> > > > >> > >>> I'm having trouble compiling the CPP version of the hello > > > >> > >>> world using the existing documentation. I'm able to build > > > >> > >>> nuttx just > > > >> fine and flash my device using the C version of Hello World. > > > >> > >>> > > > >> > >>> The error during CXX building is "No thread API" > > > >> > >>> > > > >> > >>> > > > >> > >>> *Background:* > > > >> > >>> > > > >> > >>> I'm following the (latest?) directions here: > > > >> > >>> > > > >> > >>> https://github.com/apache/incubator-nuttx/ > > > >> > >>> > > > >> > >>> I made my own docker image based on this Dockerfile which I > > > >> understand nuttx is using for some part of ci/cid/testing: > > > >> > >>> > > > >> > >>> > > > >> https://github.com/apache/incubator-nuttx-testing/blob/master/doc > > > >> ker > > > >> > >>> /linux/Dockerfile > > > >> > >>> > > > >> > >>> Running the following commands: > > > >> > >>> > > > >> > >>> git clone https://github.com/apache/incubator-nuttx.git > > > >> > >>> nuttx git clone > > > >> > >>> https://github.com/apache/incubator-nuttx-apps.git > > > >> > >>> apps > > > >> > >>> > > > >> > >>> Then I configure for my own board (stm32f103rbt6) > > > >> > >>> ./configure.sh nucleo-f103rb/nsh > > > >> > >>> > > > >> > >>> After "make menuconfig" and configuring the C hello world > > > >> > >>> app, I'm > > > >> able to build and flash my board and run "hello" just fine. > > > >> > >>> > > > >> > >>> This leads me to believe my toolchain is good to go. > > > >> > >>> > > > >> > >>> > > > >> > >>> *Installing libcxx:* > > > >> > >>> > > > >> > >>> So moving on the c++ docs found here: > > > >> > >>> > > > >> https://cwiki.apache.org/confluence/pages/viewpage.action?pageId= > > > >> 139 > > > >> > >>> 629545 > > > >> > >>> but they may be outdated? > > > >> > >>> > > > >> > >>> Running: > > > >> > >>> > > > >> > >>> git clone https://bitbucket.org/acassis/libcxx > > > >> > >>> cd libcxx > > > >> > >>> ./install /nuttx/nuttx > > > >> > >>> > > > >> > >>> "Installing LLVM/libcxx in the NuttX source > > > >> > >>> treeInstallation > > > >> succeeded" > > > >> > >>> > > > >> > >>> I skipped the other two lines in that guide because they > > > >> > >>> seem to > > > >> clone a different and older nuttx clone from Alan's repo. > > > >> > >>> > > > >> > >>> > > > >> > >>> *Trying to implement c++:* > > > >> > >>> > > > >> > >>> Going over to make menuconfig and enabling the following > > > >> > >>> options (and whatever comes with them) > > > >> > >>> > > > >> > >>> Libary Routines->Have C++ Compiler > > > >> > >>> > > > >> > >>> Libary Routines->Build LLVM libc++ > > > >> > >>> > > > >> > >>> Applications->Hello World C++ example > > > >> > >>> > > > >> > >>> When I go to build I get a "No thread API"... > > > >> > >>> > > > >> > >>> make[2]: Entering directory > > > >> > >>> '/nuttx/apps/examples/helloxx'In file included from > > > >> > >>> /nuttx/nuttx/include/libcxx/cstdio:99,from > > > >> > >>> > > ./helloxx_main.cxx:42:/nuttx/nuttx/include/libcxx/__config:845:4: > > > >> error: > > > >> > >>> #error "No thread API"845 | # error "No thread API" > > > >> > >>> > > > >> > >>> I've only seen a 3 year old post where some person was > > > >> > >>> using their > > > >> own toolchain, so I'm not clear on how to proceed. > > > >> > >>> > > > >> > >>> I think I need to include some extra things in my Make.defs > > > >> > >>> but I'm usually working at a higher layer, I'm a > > > >> > >>> medium-level linux person > > > >> and have next to zero experience developing c/c++ apps on > > > >> > linux, but I"ve written plenty of apps on Windows. > > > >> > >>> > > > >> > >>> Really appreciate any help or insight you can provide, thanks! > > > >> > >>> > > > >> > >>> Matt > > > >> > > > > > >> > > > > >> > > > >> > > > >> > >