Hi
As I aim to use C++ for some code, I have been trying to use the LLVM C++
library. Trying to build NuttX on a Debian 12 Bookworm and trying to build a
sim:nsh an error manifests itself.
After updating my copy of the NuttX git repository, I execute
./tools/configure.sh sim:nsh
in the nuttx directory.
Then make menuconfig to set use of C++ compiler, initialization, and LLVM lib.
The diff between .config and .config.old after that is:
In */code/nuttx9/nuttx$ diff .config .config.old
325c325
< CONFIG_PTHREAD_MUTEX_TYPES=y
---
> # CONFIG_PTHREAD_MUTEX_TYPES is not set
1096,1107c1096,1097
< CONFIG_HAVE_CXX=y
< CONFIG_HAVE_CXXINITIALIZE=y
< # CONFIG_LIBCXXTOOLCHAIN is not set
< # CONFIG_LIBCXXMINI is not set
< CONFIG_LIBCXX=y
< # CONFIG_UCLIBCXX is not set
< # CONFIG_LIBCXXABI is not set
< CONFIG_LIBSUPCXX=y
< CONFIG_CXX_STANDARD="gnu++20"
< # CONFIG_CXX_EXCEPTION is not set
< # CONFIG_CXX_RTTI is not set
< CONFIG_LIBCXX_VERSION="17.0.6"
---
> # CONFIG_HAVE_CXX is not set
> # CONFIG_HAVE_CXXINITIALIZE is not set
1196d1185
< # CONFIG_EXAMPLES_HELLOXX is not set
1580d1568
< # CONFIG_TESTING_CXXTEST is not set
When executing make, the process downloads libcxx-17.0.6.src.tar.gz
After compiling lots of files the process stops with (the complete terminal
state after the command make):
Create version.h
LN: platform/board to /****************************/nuttx9/apps/platform/dummy
Register: gpio
Register: hello
Register: dumpstack
Register: nsh
Register: sh
patching file libcxx/include/__mbstate_t.h
patching file libcxx/src/chrono.cpp
CP: /************************************/nuttx9/nuttx/include/nuttx/config.h
CP: /************************************/nuttx9/nuttx/include/nuttx/fs/hostfs.h
CXX: libcxx/src/locale.cpp In file included from libcxx/src/locale.cpp:17:
libcxx/src/locale.cpp: In static member function ‘static const int*
std::__1::ctype<char>::__classic_lower_table()’:
libcxx/src/locale.cpp:1226:12: error: ‘locale_t’ {aka ‘void*’} is not a
pointer-to-object type
1226 | return _LIBCPP_GET_C_LOCALE->__ctype_tolower;
| ^~~~~~~~~~~~~~~~~~~~
libcxx/src/locale.cpp: In static member function ‘static const int*
std::__1::ctype<char>::__classic_upper_table()’:
libcxx/src/locale.cpp:1232:12: error: ‘locale_t’ {aka ‘void*’} is not a
pointer-to-object type
1232 | return _LIBCPP_GET_C_LOCALE->__ctype_toupper;
| ^~~~~~~~~~~~~~~~~~~~
make[1]: *** [Makefile:72: libcxx/src/locale.o] Error 1
make: *** [tools/LibTargets.mk:216: libs/libxx/libxx.a] Error 2
Did I miss some configuration option or what is the problem? The configuration
process in menuconfig sort of indicates the C++ library is at version C++17 and
the the CXX STANDARD is C++20, but these are the default values provided by the
menuconfig command.
Anders