In the following code, even though the application does not use exceptions, an exception is still thrown in libcxx
If libcxxabi is not enabled, the toolchain default implementation will be used. However, arm-gcc does not enable thread
support by default, which will cause errors in a multi-threaded environment.
Therefore, we need to use libcxxabi to ensure normal functions in a multi-threaded environment.
using namespace std;
void foo(bool recur);
int bar(bool recur)
{
if (recur) {
foo(false);
}
return 0xFAFAFA;
}
void foo(bool recur)
{
static int i = bar(recur);
cout << "Static is:" << i << "\n";
}
int main(int argc, char *argv[])
{
foo(true);
return 0;
}
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
./helloxx_main.cxx:29:10: fatal error: cxxabi.h: No such file or directory
29 | #include <cxxabi.h>
| ^~~~~~~~~~
CONFIG_LIBCXXABI is turned on, but the library include is not linked to nuttx/include, causing the compilation to fail.
Signed-off-by: wangmingrong <wangmingrong@xiaomi.com>
- Add __config_site for NuttX.
In libcxx 12.0.0. CMake concatenated __config_site with _config,
which enabled NuttX to build without its inclusion. In 15.0.7, this
file is configured by CMake and included explicitly in __config.
- Add additional include directories.
- Mute always_inline warning.
- Make the download of libcxx/libcxxabi configurable
In the past, predefined macros were generated by define.sh scripts
Now they are generated by concatenating environment variables
In this way, when executing makefile, no shell command will be executed,
it will improve the speed of executing makfile
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
It is okay for the application to be built without RTTI (-fno-rrti), but
libcxxabi requires RTTI at least for the library.
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>