Simulink compilation failure UAV Toolbox Support Package for PX4

I'm using Ubuntu 20.04 and I'm trying to develop the controller in the 'px4demo_PositionController_quadrotor' (https://it.mathworks.com/help/supportpkg/px4/ref/position-tracking-example.html) in my own flight controller (Pixracer R15), all the setup and configuration step are ok but when I try to execute Monitor and Tune or Build, Deploy and Start I get the following compilation error:
Compilation failure for command "/opt/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-g++ -DCONFIG_ARCH_BOARD_PX4_FMU_V4 -DCONSTRAINED_MEMORY -D_SYS_CDEFS_H_ -D_SYS_REENT_H_ -D__CUSTOM_FILE_IO__ -D__PX4_NUTTX -D__STDC_FORMAT_MACROS -DMODULE_NAME=\"px4_simulink_app\" -DPX4_MAIN=px4_simulink_app_app_main -DMODEL=px4demo_PositionController_quadrotor -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DPX4 -DFMUv4 -DNULL=0 -DMW_PX4_NUTTX_BUILD -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -D__linux__ -DXCP_PLATFORM_LINUX_NO_PIE_SUPPORT -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DMW_PX4_DISABLE_MAVLINK=1 -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -Os -DNDEBUG -g -fdata-sections -ffunction-sections -fomit-frame-pointer -fmerge-all-constants -fno-signed-zeros -fno-trapping-math -freciprocal-math -fno-math-errno -fno-strict-aliasing -fvisibility=hidden -include visibility.h -Wall -Wextra -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-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fdiagnostics-color=always -Wno-stringop-truncation -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 -nostdinc++ -fno-sized-deallocation -Wframe-larger-than=2000 -fpermissive -Wno-narrowing -std=gnu++14 -I../../boards/px4/fmu-v4/src -I../../platforms/nuttx/src/px4/common/include -I. -Isrc/lib -I../../platforms/nuttx/src/px4/stm/stm32f4/include -I../../platforms/common -I../../platforms/common/include -I../../src -I../../src/include -I../../src/lib -I../../src/lib/matrix -I../../src/modules -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 -I../../src/modules/px4_simulink_app -I../../src/modules/mavlink -I../../mavlink/include/mavlink -I/home/paolo/tesi -I/home/paolo/SupportPackages/R2022b/toolbox/target/supportpackages/px4/include -I/home/paolo/tesi/px4demo_PositionController_quadrotor_ert_rtw -I/usr/local/MATLAB/R2022b/extern/include -I/usr/local/MATLAB/R2022b/simulink/include -I/usr/local/MATLAB/R2022b/rtw/c/src -I/usr/local/MATLAB/R2022b/rtw/c/src/ext_mode/common -I/usr/local/MATLAB/R2022b/rtw/c/ert -I/usr/local/MATLAB/R2022b/rtw/c/src/ext_mode/serial -o src/modules/px4_simulink_app/CMakeFiles/modules__px4_simulink_app.dir/MW_uORB_Read.cpp.obj -c ../../src/modules/px4_simulink_app/MW_uORB_Read.cpp" with error "In file included from [01m [K<command-line> [m [K:
[01m [K../../src/include/visibility.h:119:10: [m [K [01;31m [Kfatal error: [m [Kcstdlib: No such file or directory
119 | #include [01;31m [K<cstdlib> [m [K
| [01;31m [K^~~~~~~~~ [m [K
compilation terminated.

4 Comments

Did you find any solution? I have the same problem
Hi @lorenzo silvestri, I'm really sorry but I can't help you. I was unable to solve this issue so at the end I used the toolobox on Windows 11 instead of Ubuntu.
Same problem here, is trying to install Windows now.
@xiangming can you tell me if on Windows all worked?

Sign in to comment.

Answers (1)

As far as I understand, you are encountering Simulink compilation failures while trying to use UAV Toolbox Support Package for PX4.
The error message you have shared indicates that the compiler is unable to find the <cstdlib> header file, which could mean that there is an installation issue with the compiler itself. Please make sure that you have installed the toolchain as described in the following:

Products

Release

R2022b

Tags

Asked:

on 29 Sep 2022

Answered:

on 24 Jan 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!