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/docker > >> > >>> /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 > >> > > > >> > > >> > >> > >>
>From b92dd640250f49670864101c3956b4a5f7757db4 Mon Sep 17 00:00:00 2001 From: Xiang Xiao <xiaoxi...@xiaomi.com> Date: Tue, 2 Jun 2020 17:27:27 +0800 Subject: [PATCH] libc: Declare quick_exit and at_quick_exit prototye will provide the implementation later Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com> Change-Id: I546737e370d1b8b4a77fa1fba17feab6809e16e6 --- include/stdlib.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/stdlib.h b/include/stdlib.h index bca6fb8dcb..9c99a2237f 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -146,8 +146,10 @@ int unsetenv(FAR const char *name); /* Process exit functions */ void exit(int status) noreturn_function; +void quick_exit(int status) noreturn_function; void abort(void) noreturn_function; int atexit(CODE void (*func)(void)); +int at_quick_exit(CODE void (*func)(void)); int on_exit(CODE void (*func)(int, FAR void *), FAR void *arg); /* _Exit() is a stdlib.h equivalent to the unistd.h _exit() function */ -- 2.17.1