jcursiolf opened a new issue #5530:
URL: https://github.com/apache/incubator-nuttx/issues/5530


   I am new to NuttX and I have been trying to use the "[C++ Example using 
CMake](https://nuttx.apache.org/docs/latest/guides/cpp_cmake.html)" guide 
available  in the official documentation. No changes whatsoever to code. That 
is:
   
   ```sh
   cd nuttx
   ./tools/configure.sh stm32f4discovery:testlibcxx
   ```
   Set RTOS Features -> Tasks and Scheduling -> Application entry point to 
‘hellocpp_main’
   ```sh
   make export
   ```
   
   And in the hellocpp/ main folder:
   ```sh
   mkdir build
   cd build
   cmake ..
   make
   ```
   
   I have tested Nuttx 10.0.1, 10.1.0 and 10.2.0. The first one does not 
export. The other two appear to be OK while doing `cmake ..` (edited just 
folder names due to NDAs):
   
   ```sh
   $ cmake ..
   -- The C compiler identification is GNU 9.2.1
   -- The CXX compiler identification is GNU 9.2.1
   -- Check for working C compiler: /usr/bin/arm-none-eabi-gcc
   -- Check for working C compiler: /usr/bin/arm-none-eabi-gcc -- works
   -- Detecting C compiler ABI info
   -- Detecting C compiler ABI info - done
   -- Detecting C compile features
   -- Detecting C compile features - done
   -- Check for working CXX compiler: /usr/bin/arm-none-eabi-g++
   -- Check for working CXX compiler: /usr/bin/arm-none-eabi-g++ -- works
   -- Detecting CXX compiler ABI info
   -- Detecting CXX compiler ABI info - done
   -- Detecting CXX compile features
   -- Detecting CXX compile features - done
   -- Configuring done
   -- Generating done
   -- Build files have been written to: /path/to/hellocpp/build
   ```
   
    However, `make` ends in the same error for both :
   
   ```
   $ make
   Scanning dependencies of target hellocpp
   [ 33%] Building CXX object src/CMakeFiles/hellocpp.dir/HelloWorld.cpp.obj
   In file included from 
/path/to/hellocpp/nuttx-export-10.1.0/include/libcxx/cstdio:98,
                    from /path/to/hellocpp/src/HelloWorld.cpp:1:
   /path/to/hellocpp/nuttx-export-10.1.0/include/libcxx/__config:1142:6: error: 
#error "No thread API"
    1142 | #    error "No thread API"
         |      ^~~~~
   In file included from 
/path/to/hellocpp/nuttx-export-10.1.0/include/nuttx/sched.h:33,
                    from 
/path/to/hellocpp/nuttx-export-10.1.0/include/sched.h:36,
                    from 
/path/to/hellocpp/nuttx-export-10.1.0/include/stdio.h:32,
                    from 
/path/to/hellocpp/nuttx-export-10.1.0/include/libcxx/cstdio:99,
                    from /path/to/hellocpp/src/HelloWorld.cpp:1:
   /path/to/hellocpp/nuttx-export-10.1.0/include/signal.h:416:42: warning: 'int 
sigaction(int, const sigaction*, sigaction*)' hides constructor for 'struct 
sigaction' [-Wshadow]
     416 |                FAR struct sigaction *oact);
         |                                          ^
   In file included from 
/path/to/hellocpp/nuttx-export-10.1.0/include/libcxx/cstddef:44,
                    from 
/path/to/hellocpp/nuttx-export-10.1.0/include/libcxx/initializer_list:46,
                    from 
/path/to/hellocpp/nuttx-export-10.1.0/include/libcxx/algorithm:639,
                    from 
/path/to/hellocpp/nuttx-export-10.1.0/include/libcxx/__string:57,
                    from 
/path/to/hellocpp/nuttx-export-10.1.0/include/libcxx/string_view:175,
                    from 
/path/to/hellocpp/nuttx-export-10.1.0/include/libcxx/string:506,
                    from /path/to/hellocpp/src/HelloWorld.cpp:2:
   /usr/lib/gcc/arm-none-eabi/9.2.1/include/stddef.h:426:3: error: conflicting 
declaration 'typedef struct max_align_t max_align_t'
     426 | } max_align_t;
         |   ^~~~~~~~~~~
   In file included from 
/path/to/hellocpp/nuttx-export-10.1.0/include/string.h:30,
                    from 
/path/to/hellocpp/nuttx-export-10.1.0/include/strings.h:30,
                    from 
/path/to/hellocpp/nuttx-export-10.1.0/include/sched.h:33,
                    from 
/path/to/hellocpp/nuttx-export-10.1.0/include/stdio.h:32,
                    from 
/path/to/hellocpp/nuttx-export-10.1.0/include/libcxx/cstdio:99,
                    from /path/to/hellocpp/src/HelloWorld.cpp:1:
   /path/to/hellocpp/nuttx-export-10.1.0/include/stddef.h:105:3: note: previous 
declaration as 'typedef struct max_align_t max_align_t'
     105 | } max_align_t;
         |   ^~~~~~~~~~~
   In file included from 
/path/to/hellocpp/nuttx-export-10.1.0/include/libcxx/atomic:571,
                    from 
/path/to/hellocpp/nuttx-export-10.1.0/include/libcxx/memory:681,
                    from 
/path/to/hellocpp/nuttx-export-10.1.0/include/libcxx/algorithm:643,
                    from 
/path/to/hellocpp/nuttx-export-10.1.0/include/libcxx/__string:57,
                    from 
/path/to/hellocpp/nuttx-export-10.1.0/include/libcxx/string_view:175,
                    from 
/path/to/hellocpp/nuttx-export-10.1.0/include/libcxx/string:506,
                    from /path/to/hellocpp/src/HelloWorld.cpp:2:
   
/path/to/hellocpp/nuttx-export-10.1.0/include/libcxx/__threading_support:270:55:
 error: expected ')' before '*' token
     270 |                         void(_LIBCPP_TLS_DESTRUCTOR_CC* 
__at_exit)(void*));
         |                             ~                         ^
   
/path/to/hellocpp/nuttx-export-10.1.0/include/libcxx/__threading_support:270:55:
 error: expected ')' before '*' token
   
/path/to/hellocpp/nuttx-export-10.1.0/include/libcxx/__threading_support:269:24:
 note: to match this '('
     269 | int __libcpp_tls_create(__libcpp_tls_key* __key,
         |                        ^
   
/path/to/hellocpp/nuttx-export-10.1.0/include/libcxx/__threading_support:270:55:
 error: expected initializer before '*' token
     270 |                         void(_LIBCPP_TLS_DESTRUCTOR_CC* 
__at_exit)(void*));
         |                                                       ^
   make[2]: *** [src/CMakeFiles/hellocpp.dir/build.make:63: 
src/CMakeFiles/hellocpp.dir/HelloWorld.cpp.obj] Error 1
   make[1]: *** [CMakeFiles/Makefile2:94: src/CMakeFiles/hellocpp.dir/all] 
Error 2
   make: *** [Makefile:84: all] Error 2
   ```
   
   I have found [this 
link](https://lists.apache.org/thread/v7p79k5s9kr2sf6sg9gqzm52qkfzdss4) as a 
person that had a similar problem, but I could not pinpoint in the discussion 
what should I do to make it work. I also understood that #1592 should have 
fixed the issue. What am I missing?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to