Compilation error on the master branch

I am on the master branch. I want to add some custom application on top of it. However, I am getting compilation error even before adding any code. I upgraded the arm-none-eabi-g++ to the latest version.

Am I missing something?

sakib@sakib:~/Downloads/tobedel/Firmware$ arm-none-eabi-g++ --version

arm-none-eabi-g++ (GNU Tools for Arm Embedded Processors 8-2019-q3-update) 8.3.1 20190703 (release) [gcc-8-branch revision 273027]
sakib@sakib:~/Downloads/tobedel/Firmware$ make px4_fmu-v5_default

[6/351] Performing build step for 'px4io_firmware'
[75/80] Generating nuttx/sched/libsched.a
FAILED: cd /home/sakib/Downloads/tobedel/Firmware/build/px4_fmu-v5_default/external/Build/px4io_firmware/NuttX/nuttx && find sched -type f -name *.o -delete && make -C sched --quiet --no-print-directory all TOPDIR=/home/sakib/Downloads/tobedel/Firmware/build/px4_fmu-v5_default/external/Build/px4io_firmware/NuttX/nuttx KERNEL=y EXTRADEFINES=-D__KERNEL__ >nuttx_build.log
init/os_start.c: In function 'os_start':
init/os_start.c:528:7: error: 'strncpy' output truncated copying 4 bytes from a string of length 9 [-Werror=stringop-truncation]
       strncpy(g_idletcb[cpu].cmn.name, g_idlename, CONFIG_TASK_NAME_SIZE);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [os_start.o] Error 1
[75/80] Building CXX object src/module...eFiles/px4iofirmware.dir/mixer.cpp.obj
ninja: build stopped: subcommand failed.
[18/351] Building CXX object src/drivers/px4io/CMakeFiles/drivers__px4io.dir/px4io.cpp.obj
FAILED: /usr/bin/arm-none-eabi-g++   -DCONFIG_ARCH_BOARD_PX4_FMU_V5 -DMODULE_NAME=\"px4io\" -DPX4_MAIN=px4io_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 -funsafe-math-optimizations -fno-strict-aliasing -fno-math-errno -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=1816 -Wno-cast-align -std=gnu++11 -MMD -MT src/drivers/px4io/CMakeFiles/drivers__px4io.dir/px4io.cpp.obj -MF src/drivers/px4io/CMakeFiles/drivers__px4io.dir/px4io.cpp.obj.d -o src/drivers/px4io/CMakeFiles/drivers__px4io.dir/px4io.cpp.obj -c ../../src/drivers/px4io/px4io.cpp
../../src/drivers/px4io/px4io.cpp: In member function 'virtual int PX4IO::init()':
../../src/drivers/px4io/px4io.cpp:845:24: error: cast between incompatible function types from 'void (*)(int, char**)' to 'main_t' {aka 'int (*)(int, char**)'} [-Werror=cast-function-type]
        (main_t)&PX4IO::task_main_trampoline,
                        ^~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1plus: all warnings being treated as errors
[18/351] Building CXX object src/drive...s/drivers__tap_esc.dir/tap_esc.cpp.obj
FAILED: cd /home/sakib/Downloads/tobedel/Firmware/build/px4_fmu-v5_default/external/Build/px4io_firmware && /usr/bin/cmake --build . && /usr/bin/cmake -E touch /home/sakib/Downloads/tobedel/Firmware/build/px4_fmu-v5_default/external/Stamp/px4io_firmware/px4io_firmware-build
ninja: build stopped: subcommand failed.
Makefile:193: recipe for target 'px4_fmu-v5_default' failed
make: *** [px4_fmu-v5_default] Error 1

You’re running into these issues because you’re using a newer gcc version than recommended here:

You can either try to fix the warnings, remove -Werror in CMakeLists.txt, or make a pull request to fix the issues.

1 Like