You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Mark Stevens <ma...@thepcsite.co.uk> on 2023/06/24 17:59:56 UTC

C++ Support

I’m currently working on a home project with NuttX and my preferred language is really C++ for what I am doing.  I can work in C if necessary but I’d like to use some C++ features.

So far I have managed to get the framework of what is needed configured and the next step is to start some application implementation.  So I’m thinking core logic unit tested using the simulator and basic C++ application on the laptop.

So I have started a fairly basic test scenario and hit a problem with the C++ support in NuttX.

My application is going to be using some of the STL, at the moment I’m hitting issues with string and vector, two fairly basic and simple classes.  I’m not getting any application to compile successfully.  I have tried:

- Basic C++ support
- LLVM with both the LLVM and GNU low level libraries
- uCLib++ with both LLVM and GNU libraries

I have tried this with both the sim:nsh and the raspberrypi-pico-w:nsh configurations.

The classes I am using are fairly basic so I could implement them myself, I would prefer to use a library version though.

Has anyone managed to use the C++ libraries with NuttX ?

Regards,
Mark
_____________________________
Blog: blog.thepcsite.co.uk
Twitter: @nevynuk






Re: C++ Support

Posted by Mark Stevens <ma...@thepcsite.co.uk>.
My mistake on the version.  The patch builds OK.

Back to working on the project later today.

Thank you.

Regards,
Mark
_____________________________
Blog: blog.thepcsite.co.uk
Twitter: @nevynuk





> On 25 Jun 2023, at 08:50, Mark Stevens <ma...@thepcsite.co.uk> wrote:
> 
> So a little more progress on this one.
> 
> Turning on C++ Exception support for the PicoW:nsh build configuration generates errors:
> 
> CC:  pthread/pthread_testcancel.c machine/arm/gnu_unwind_find_exidx.c:32:8: error: unknown type name '__EIT_entry'
>   32 | static __EIT_entry *__exidx_start_elf;
>      |        ^~~~~~~~~~~
> 
> Configuration is:
> 
> - C++ enabled
> - uCLib++ library
> - GNU low level support
> - Exceptions enabled.
> 
> Turning exceptions off gives me missing symbols, guess that is going to be a missing library in the link phase.
> 
> Regards,
> Mark
> _____________________________
> Blog: blog.thepcsite.co.uk
> Twitter: @nevynuk
> 
> 
> 
> 
> 
>> On 24 Jun 2023, at 18:59, Mark Stevens <ma...@thepcsite.co.uk> wrote:
>> 
>> I’m currently working on a home project with NuttX and my preferred language is really C++ for what I am doing.  I can work in C if necessary but I’d like to use some C++ features.
>> 
>> So far I have managed to get the framework of what is needed configured and the next step is to start some application implementation.  So I’m thinking core logic unit tested using the simulator and basic C++ application on the laptop.
>> 
>> So I have started a fairly basic test scenario and hit a problem with the C++ support in NuttX.
>> 
>> My application is going to be using some of the STL, at the moment I’m hitting issues with string and vector, two fairly basic and simple classes.  I’m not getting any application to compile successfully.  I have tried:
>> 
>> - Basic C++ support
>> - LLVM with both the LLVM and GNU low level libraries
>> - uCLib++ with both LLVM and GNU libraries
>> 
>> I have tried this with both the sim:nsh and the raspberrypi-pico-w:nsh configurations.
>> 
>> The classes I am using are fairly basic so I could implement them myself, I would prefer to use a library version though.
>> 
>> Has anyone managed to use the C++ libraries with NuttX ?
>> 
>> Regards,
>> Mark
>> _____________________________
>> Blog: blog.thepcsite.co.uk
>> Twitter: @nevynuk
>> 
>> 
>> 
>> 
>> 
> 


Re: C++ Support

Posted by Mark Stevens <ma...@thepcsite.co.uk>.
With the patch I am seeing the application exit, it is not excepting my main program loop.

Also, version is now listed as 10.4 not 12.1.

Re comment about LLVm - I’m just looking for something that works and at the moment uCLib++ and LLVm do not work in 12.1.

Regards,
Mark
_____________________________
Blog: blog.thepcsite.co.uk
Twitter: @nevynuk





> On 25 Jun 2023, at 08:50, Mark Stevens <ma...@thepcsite.co.uk> wrote:
> 
> So a little more progress on this one.
> 
> Turning on C++ Exception support for the PicoW:nsh build configuration generates errors:
> 
> CC:  pthread/pthread_testcancel.c machine/arm/gnu_unwind_find_exidx.c:32:8: error: unknown type name '__EIT_entry'
>   32 | static __EIT_entry *__exidx_start_elf;
>      |        ^~~~~~~~~~~
> 
> Configuration is:
> 
> - C++ enabled
> - uCLib++ library
> - GNU low level support
> - Exceptions enabled.
> 
> Turning exceptions off gives me missing symbols, guess that is going to be a missing library in the link phase.
> 
> Regards,
> Mark
> _____________________________
> Blog: blog.thepcsite.co.uk
> Twitter: @nevynuk
> 
> 
> 
> 
> 
>> On 24 Jun 2023, at 18:59, Mark Stevens <ma...@thepcsite.co.uk> wrote:
>> 
>> I’m currently working on a home project with NuttX and my preferred language is really C++ for what I am doing.  I can work in C if necessary but I’d like to use some C++ features.
>> 
>> So far I have managed to get the framework of what is needed configured and the next step is to start some application implementation.  So I’m thinking core logic unit tested using the simulator and basic C++ application on the laptop.
>> 
>> So I have started a fairly basic test scenario and hit a problem with the C++ support in NuttX.
>> 
>> My application is going to be using some of the STL, at the moment I’m hitting issues with string and vector, two fairly basic and simple classes.  I’m not getting any application to compile successfully.  I have tried:
>> 
>> - Basic C++ support
>> - LLVM with both the LLVM and GNU low level libraries
>> - uCLib++ with both LLVM and GNU libraries
>> 
>> I have tried this with both the sim:nsh and the raspberrypi-pico-w:nsh configurations.
>> 
>> The classes I am using are fairly basic so I could implement them myself, I would prefer to use a library version though.
>> 
>> Has anyone managed to use the C++ libraries with NuttX ?
>> 
>> Regards,
>> Mark
>> _____________________________
>> Blog: blog.thepcsite.co.uk
>> Twitter: @nevynuk
>> 
>> 
>> 
>> 
>> 
> 


Re: C++ Support

Posted by Mark Stevens <ma...@wildernesslabs.co>.
So figured out what the problem was with the patch - it compiles.

Just testing execution at the moment.


Regards,
Mark
______________________________
mark.stevens@wildernesslabs.co




> On 25 Jun 2023, at 17:53, Mark Stevens <ma...@wildernesslabs.co> wrote:
> 
> So here is what I have run:
> 
> git checkout master
> git clean -dfx
> git reset —hard
> gh pr checkout 9610
> make distclean
> ./tools/configure.sh -l raspberrypi-pico-w:nsh
> make -j
> 
> So should just be a base configuration and this compiles OK.
> 
> I then reconfigured to system to add
> 
> C++
> uCLib++
> hellowxx
> Removed some applications and tests that I’m not interested in and add my application.
> 
> make -j clean && make -j
> 
> And this results in:
> 
> Create version.h
> sed: 1: "/CONFIG_BASE_DEFCONFIG/ ...": bad flag in substitute command: '}'
> make: *** [include/nuttx/config.h] Error 1
> make: *** Waiting for unfinished jobs....
> 
> Regards,
> Mark
> ______________________________
> mark.stevens@wildernesslabs.co
> 
> 
> 
> 
>> On 25 Jun 2023, at 11:39, Xiang Xiao <xi...@gmail.com> wrote:
>> 
>> Mark, could you try this patch:
>> https://github.com/apache/nuttx/pull/9610
>> 
>> On Sun, Jun 25, 2023 at 3:50 PM Mark Stevens <ma...@thepcsite.co.uk> wrote:
>> 
>>> So a little more progress on this one.
>>> 
>>> Turning on C++ Exception support for the PicoW:nsh build configuration
>>> generates errors:
>>> 
>>> CC:  pthread/pthread_testcancel.c
>>> machine/arm/gnu_unwind_find_exidx.c:32:8: error: unknown type name
>>> '__EIT_entry'
>>>   32 | static __EIT_entry *__exidx_start_elf;
>>>      |        ^~~~~~~~~~~
>>> 
>>> Configuration is:
>>> 
>>> - C++ enabled
>>> - uCLib++ library
>>> - GNU low level support
>>> - Exceptions enabled.
>>> 
>>> Turning exceptions off gives me missing symbols, guess that is going to be
>>> a missing library in the link phase.
>>> 
>>> Regards,
>>> Mark
>>> _____________________________
>>> Blog: blog.thepcsite.co.uk
>>> Twitter: @nevynuk
>>> 
>>> 
>>> 
>>> 
>>> 
>>>> On 24 Jun 2023, at 18:59, Mark Stevens <ma...@thepcsite.co.uk> wrote:
>>>> 
>>>> I’m currently working on a home project with NuttX and my preferred
>>> language is really C++ for what I am doing.  I can work in C if necessary
>>> but I’d like to use some C++ features.
>>>> 
>>>> So far I have managed to get the framework of what is needed configured
>>> and the next step is to start some application implementation.  So I’m
>>> thinking core logic unit tested using the simulator and basic C++
>>> application on the laptop.
>>>> 
>>>> So I have started a fairly basic test scenario and hit a problem with
>>> the C++ support in NuttX.
>>>> 
>>>> My application is going to be using some of the STL, at the moment I’m
>>> hitting issues with string and vector, two fairly basic and simple
>>> classes.  I’m not getting any application to compile successfully.  I have
>>> tried:
>>>> 
>>>> - Basic C++ support
>>>> - LLVM with both the LLVM and GNU low level libraries
>>>> - uCLib++ with both LLVM and GNU libraries
>>>> 
>>>> I have tried this with both the sim:nsh and the raspberrypi-pico-w:nsh
>>> configurations.
>>>> 
>>>> The classes I am using are fairly basic so I could implement them
>>> myself, I would prefer to use a library version though.
>>>> 
>>>> Has anyone managed to use the C++ libraries with NuttX ?
>>>> 
>>>> Regards,
>>>> Mark
>>>> _____________________________
>>>> Blog: blog.thepcsite.co.uk
>>>> Twitter: @nevynuk
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> 
> 


Re: C++ Support

Posted by Mark Stevens <ma...@wildernesslabs.co>.
So here is what I have run:

git checkout master
git clean -dfx
git reset —hard
gh pr checkout 9610
make distclean
./tools/configure.sh -l raspberrypi-pico-w:nsh
make -j

So should just be a base configuration and this compiles OK.

I then reconfigured to system to add

C++
uCLib++
hellowxx
Removed some applications and tests that I’m not interested in and add my application.

make -j clean && make -j

And this results in:

Create version.h
sed: 1: "/CONFIG_BASE_DEFCONFIG/ ...": bad flag in substitute command: '}'
make: *** [include/nuttx/config.h] Error 1
make: *** Waiting for unfinished jobs....

Regards,
Mark
______________________________
mark.stevens@wildernesslabs.co




> On 25 Jun 2023, at 11:39, Xiang Xiao <xi...@gmail.com> wrote:
> 
> Mark, could you try this patch:
> https://github.com/apache/nuttx/pull/9610
> 
> On Sun, Jun 25, 2023 at 3:50 PM Mark Stevens <ma...@thepcsite.co.uk> wrote:
> 
>> So a little more progress on this one.
>> 
>> Turning on C++ Exception support for the PicoW:nsh build configuration
>> generates errors:
>> 
>> CC:  pthread/pthread_testcancel.c
>> machine/arm/gnu_unwind_find_exidx.c:32:8: error: unknown type name
>> '__EIT_entry'
>>   32 | static __EIT_entry *__exidx_start_elf;
>>      |        ^~~~~~~~~~~
>> 
>> Configuration is:
>> 
>> - C++ enabled
>> - uCLib++ library
>> - GNU low level support
>> - Exceptions enabled.
>> 
>> Turning exceptions off gives me missing symbols, guess that is going to be
>> a missing library in the link phase.
>> 
>> Regards,
>> Mark
>> _____________________________
>> Blog: blog.thepcsite.co.uk
>> Twitter: @nevynuk
>> 
>> 
>> 
>> 
>> 
>>> On 24 Jun 2023, at 18:59, Mark Stevens <ma...@thepcsite.co.uk> wrote:
>>> 
>>> I’m currently working on a home project with NuttX and my preferred
>> language is really C++ for what I am doing.  I can work in C if necessary
>> but I’d like to use some C++ features.
>>> 
>>> So far I have managed to get the framework of what is needed configured
>> and the next step is to start some application implementation.  So I’m
>> thinking core logic unit tested using the simulator and basic C++
>> application on the laptop.
>>> 
>>> So I have started a fairly basic test scenario and hit a problem with
>> the C++ support in NuttX.
>>> 
>>> My application is going to be using some of the STL, at the moment I’m
>> hitting issues with string and vector, two fairly basic and simple
>> classes.  I’m not getting any application to compile successfully.  I have
>> tried:
>>> 
>>> - Basic C++ support
>>> - LLVM with both the LLVM and GNU low level libraries
>>> - uCLib++ with both LLVM and GNU libraries
>>> 
>>> I have tried this with both the sim:nsh and the raspberrypi-pico-w:nsh
>> configurations.
>>> 
>>> The classes I am using are fairly basic so I could implement them
>> myself, I would prefer to use a library version though.
>>> 
>>> Has anyone managed to use the C++ libraries with NuttX ?
>>> 
>>> Regards,
>>> Mark
>>> _____________________________
>>> Blog: blog.thepcsite.co.uk
>>> Twitter: @nevynuk
>>> 
>>> 
>>> 
>>> 
>>> 
>> 
>> 


Re: C++ Support

Posted by Xiang Xiao <xi...@gmail.com>.
Mark, could you try this patch:
https://github.com/apache/nuttx/pull/9610

On Sun, Jun 25, 2023 at 3:50 PM Mark Stevens <ma...@thepcsite.co.uk> wrote:

> So a little more progress on this one.
>
> Turning on C++ Exception support for the PicoW:nsh build configuration
> generates errors:
>
> CC:  pthread/pthread_testcancel.c
> machine/arm/gnu_unwind_find_exidx.c:32:8: error: unknown type name
> '__EIT_entry'
>    32 | static __EIT_entry *__exidx_start_elf;
>       |        ^~~~~~~~~~~
>
> Configuration is:
>
> - C++ enabled
> - uCLib++ library
> - GNU low level support
> - Exceptions enabled.
>
> Turning exceptions off gives me missing symbols, guess that is going to be
> a missing library in the link phase.
>
> Regards,
> Mark
> _____________________________
> Blog: blog.thepcsite.co.uk
> Twitter: @nevynuk
>
>
>
>
>
> > On 24 Jun 2023, at 18:59, Mark Stevens <ma...@thepcsite.co.uk> wrote:
> >
> > I’m currently working on a home project with NuttX and my preferred
> language is really C++ for what I am doing.  I can work in C if necessary
> but I’d like to use some C++ features.
> >
> > So far I have managed to get the framework of what is needed configured
> and the next step is to start some application implementation.  So I’m
> thinking core logic unit tested using the simulator and basic C++
> application on the laptop.
> >
> > So I have started a fairly basic test scenario and hit a problem with
> the C++ support in NuttX.
> >
> > My application is going to be using some of the STL, at the moment I’m
> hitting issues with string and vector, two fairly basic and simple
> classes.  I’m not getting any application to compile successfully.  I have
> tried:
> >
> > - Basic C++ support
> > - LLVM with both the LLVM and GNU low level libraries
> > - uCLib++ with both LLVM and GNU libraries
> >
> > I have tried this with both the sim:nsh and the raspberrypi-pico-w:nsh
> configurations.
> >
> > The classes I am using are fairly basic so I could implement them
> myself, I would prefer to use a library version though.
> >
> > Has anyone managed to use the C++ libraries with NuttX ?
> >
> > Regards,
> > Mark
> > _____________________________
> > Blog: blog.thepcsite.co.uk
> > Twitter: @nevynuk
> >
> >
> >
> >
> >
>
>

Re: C++ Support

Posted by spudaneco <sp...@gmail.com>.
UCLibc++ is very old.  Most people use libxx from LLVMSent from my Galaxy
-------- Original message --------From: Mark Stevens <ma...@thepcsite.co.uk> Date: 6/25/23  1:50 AM  (GMT-06:00) To: dev@nuttx.apache.org Subject: Re: C++ Support So a little more progress on this one.Turning on C++ Exception support for the PicoW:nsh build configuration generates errors:CC:  pthread/pthread_testcancel.c machine/arm/gnu_unwind_find_exidx.c:32:8: error: unknown type name '__EIT_entry'   32 | static __EIT_entry *__exidx_start_elf;      |        ^~~~~~~~~~~Configuration is:- C++ enabled- uCLib++ library- GNU low level support- Exceptions enabled.Turning exceptions off gives me missing symbols, guess that is going to be a missing library in the link phase.Regards,Mark_____________________________Blog: blog.thepcsite.co.ukTwitter: @nevynuk> On 24 Jun 2023, at 18:59, Mark Stevens <ma...@thepcsite.co.uk> wrote:> > I’m currently working on a home project with NuttX and my preferred language is really C++ for what I am doing.  I can work in C if necessary but I’d like to use some C++ features.> > So far I have managed to get the framework of what is needed configured and the next step is to start some application implementation.  So I’m thinking core logic unit tested using the simulator and basic C++ application on the laptop.> > So I have started a fairly basic test scenario and hit a problem with the C++ support in NuttX.> > My application is going to be using some of the STL, at the moment I’m hitting issues with string and vector, two fairly basic and simple classes.  I’m not getting any application to compile successfully.  I have tried:> > - Basic C++ support> - LLVM with both the LLVM and GNU low level libraries> - uCLib++ with both LLVM and GNU libraries> > I have tried this with both the sim:nsh and the raspberrypi-pico-w:nsh configurations.> > The classes I am using are fairly basic so I could implement them myself, I would prefer to use a library version though.> > Has anyone managed to use the C++ libraries with NuttX ?> > Regards,> Mark> _____________________________> Blog: blog.thepcsite.co.uk> Twitter: @nevynuk> > > > > 

Re: C++ Support

Posted by Mark Stevens <ma...@thepcsite.co.uk>.
So a little more progress on this one.

Turning on C++ Exception support for the PicoW:nsh build configuration generates errors:

CC:  pthread/pthread_testcancel.c machine/arm/gnu_unwind_find_exidx.c:32:8: error: unknown type name '__EIT_entry'
   32 | static __EIT_entry *__exidx_start_elf;
      |        ^~~~~~~~~~~

Configuration is:

- C++ enabled
- uCLib++ library
- GNU low level support
- Exceptions enabled.

Turning exceptions off gives me missing symbols, guess that is going to be a missing library in the link phase.

Regards,
Mark
_____________________________
Blog: blog.thepcsite.co.uk
Twitter: @nevynuk





> On 24 Jun 2023, at 18:59, Mark Stevens <ma...@thepcsite.co.uk> wrote:
> 
> I’m currently working on a home project with NuttX and my preferred language is really C++ for what I am doing.  I can work in C if necessary but I’d like to use some C++ features.
> 
> So far I have managed to get the framework of what is needed configured and the next step is to start some application implementation.  So I’m thinking core logic unit tested using the simulator and basic C++ application on the laptop.
> 
> So I have started a fairly basic test scenario and hit a problem with the C++ support in NuttX.
> 
> My application is going to be using some of the STL, at the moment I’m hitting issues with string and vector, two fairly basic and simple classes.  I’m not getting any application to compile successfully.  I have tried:
> 
> - Basic C++ support
> - LLVM with both the LLVM and GNU low level libraries
> - uCLib++ with both LLVM and GNU libraries
> 
> I have tried this with both the sim:nsh and the raspberrypi-pico-w:nsh configurations.
> 
> The classes I am using are fairly basic so I could implement them myself, I would prefer to use a library version though.
> 
> Has anyone managed to use the C++ libraries with NuttX ?
> 
> Regards,
> Mark
> _____________________________
> Blog: blog.thepcsite.co.uk
> Twitter: @nevynuk
> 
> 
> 
> 
>