Missing arm toolchain include path

#1

I created a new module named fortests. It contains CMakeLists.txt

set(CMAKE_CXX_STANDARD 14)
px4_add_module(
    MODULE
        fortests
    MAIN
        fortests
    SRCS
        fortests.cpp
    DEPENDS
)

and fortests.cpp file

#include <vector>
#include <px4_module.h>

extern "C" __EXPORT int fortests_main(int argc, char *argv[]);

int fortests_main(int argc, char *argv[])
{
    return 0;
}

Also I declared the module in boards/px4/fmu-v5/default.cmake as

	MODULES
		attitude_estimator_q
		camera_feedback
		...
		fortests

When I try to compile px4, I have the following error

~/px4$ make px4_fmu-v5_default
[1/520] Building CXX object src/modules/fortests/CMakeFiles/fortests.dir/fortests.cpp.obj
FAILED: src/modules/fortests/CMakeFiles/fortests.dir/fortests.cpp.obj 
/home/msurov/etc/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-g++  -DCONFIG_ARCH_BOARD_PX4_FMU_V5 -DMODULE_NAME=\"fortests\" -DPX4_MAIN=fortests_app_main -D__CUSTOM_FILE_IO__ -D__DF_NUTTX -D__PX4_NUTTX -D__STDC_FORMAT_MACROS -isystem ../../platforms/nuttx/NuttX/include/cxx -isystem NuttX/nuttx/include/cxx -isystem NuttX/nuttx/include -I../../boards/px4/fmu-v5/src -I. -Isrc -Isrc/lib -Isrc/modules -I../../src -I../../src/include -I../../src/lib -I../../src/lib/DriverFramework/framework/include -I../../src/lib/matrix -I../../src/modules -I../../src/platforms -I../../src/platforms/common -INuttX/nuttx/arch/arm/src/armv7-m -INuttX/nuttx/arch/arm/src/chip -INuttX/nuttx/arch/arm/src/common -INuttX/apps/include -Iexternal/Install/include -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -Os -DNDEBUG   -g -fdata-sections -ffunction-sections -fomit-frame-pointer -fno-signed-zeros -fno-trapping-math -freciprocal-math -fno-math-errno -fno-strict-aliasing -fvisibility=hidden -include visibility.h -Wall -Wextra -Werror -Warray-bounds -Wcast-align -Wdisabled-optimization -Wdouble-promotion -Wfatal-errors -Wfloat-equal -Wformat-security -Winit-self -Wlogical-op -Wpointer-arith -Wshadow -Wuninitialized -Wunknown-pragmas -Wunused-variable -Wno-implicit-fallthrough -Wno-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fdiagnostics-color=always -fno-builtin-printf -fno-strength-reduce -Wformat=1 -Wunused-but-set-variable -Wno-format-truncation -fcheck-new -fno-exceptions -fno-rtti -fno-threadsafe-statics -Wreorder -Wno-overloaded-virtual -D__STDC_VERSION__=199901L -nostdinc++ -Wframe-larger-than=1024 -std=gnu++14 -MD -MT src/modules/fortests/CMakeFiles/fortests.dir/fortests.cpp.obj -MF src/modules/fortests/CMakeFiles/fortests.dir/fortests.cpp.obj.d -o src/modules/fortests/CMakeFiles/fortests.dir/fortests.cpp.obj -c ../../src/modules/fortests/fortests.cpp
../../src/modules/fortests/fortests.cpp:1:10: fatal error: vector: No such file or directory
 #include <vector>
          ^~~~~~~~
compilation terminated.

Of course, I can add the missing directories into my cmakelists.txt as include_directories("/home/msurov/etc/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include/c++/7.2.1/")
but it doesn’t seem a good idea.

#2

On NuttX we don’t currently support the C++ STL. This means you can’t use things like std::vector.
What we usually use is just normal C style arrays or linked lists, for the PX4 implementation, see:

#3

What is the problem heart? As far as I understand, all the headers of STL as well as libs are available within the arm toolchain:

$ ls ./arm-none-eabi/include/c++/7.2.1
algorithm      cfenv               csetjmp    cuchar        fstream           locale    random            string_view    utility
any            cfloat              csignal    cwchar        functional        map       ratio             system_error   valarray
arm-none-eabi  chrono              cstdalign  cwctype       future            math.h    regex             tgmath.h       variant
array          cinttypes           cstdarg    cxxabi.h      initializer_list  memory    scoped_allocator  thread         vector
atomic         ciso646             cstdbool   debug         iomanip           mutex     set               tr1
backward       climits             cstddef    decimal       ios               new       shared_mutex      tr2
bits           clocale             cstdint    deque         iosfwd            numeric   sstream           tuple
bitset         cmath               cstdio     exception     iostream          optional  stack             typeindex
cassert        codecvt             cstdlib    experimental  istream           ostream   stdexcept         typeinfo
ccomplex       complex             cstring    ext           iterator          parallel  stdlib.h          type_traits
cctype         complex.h           ctgmath    fenv.h        limits            profile   streambuf         unordered_map
cerrno         condition_variable  ctime      forward_list  list              queue     string            unordered_set

I’ve tried to include the directories, but faced to some troubles. Well, I added

INCLUDE_DIRECTORIES("/home/msurov/etc/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include/c++/7.2.1/")
INCLUDE_DIRECTORIES("/home/msurov/etc/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include/c++/7.2.1/arm-none-eabi/hard")

then compiler gives

gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include/c++/7.2.1/cstdlib:134:11: error: '::atof' has not been declared
   using ::atof;
#4

Yes but we use the includes in NuttX as far as I know.