Error building px4_fmu-v5

Hello PX4 community,

I cloned the PX4-Autopilot repo and am trying to build the fmuv5 target. I am on the main branch and have not made any changes. I am running WSL2 on Win 10.

I have tried running the following before make px4_fmu-v5_default:

make distclean
make clean
git submodule sync --recursive && git submodule update --init --recursive

This is the console output:

(PX4-Autopilot_env) pbreuer@ZENBOOK:~/ROS2/ws_seawind/src/PX4-Autopilot (main)$ make px4_fmu-v5_default
– PX4 version: v1.15.0-alpha1-54-g94d4dc85f8 (1.15.0)
– Found PythonInterp: /home/pbreuer/ROS2/ws_seawind/src/PX4-Autopilot/PX4-Autopilot_env/bin/python3 (found suitable version “3.10.12”, minimum required is “3”)
– PX4 config file: /home/pbreuer/ROS2/ws_seawind/src/PX4-Autopilot/boards/px4/fmu-v5/default.px4board
– PLATFORM nuttx
– TOOLCHAIN arm-none-eabi
– ARCHITECTURE cortex-m7
– ROMFSROOT px4fmu_common
– IO px4_io-v2_default
– SERIAL_GPS1 /dev/ttyS0
– SERIAL_TEL1 /dev/ttyS1
– SERIAL_TEL2 /dev/ttyS2
– SERIAL_TEL4 /dev/ttyS3
– UAVCAN_INTERFACES 2
– UAVCAN_TIMER_OVERRIDE 6
– PX4 config: px4_fmu-v5_default
– PX4 platform: nuttx
– The CXX compiler identification is GNU 10.3.1
– The C compiler identification is GNU 10.3.1
– The ASM compiler identification is GNU
– Found assembler: /usr/bin/arm-none-eabi-gcc
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: /usr/bin/arm-none-eabi-g++ - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: /usr/bin/arm-none-eabi-gcc - skipped
– Detecting C compile features
– Detecting C compile features - done
– Enabling double FP precision hardware instructions
– cmake build type: MinSizeRel
– drivers/px4io: ROMFS including px4_io-v2_default
– Found PythonInterp: /home/pbreuer/ROS2/ws_seawind/src/PX4-Autopilot/PX4-Autopilot_env/bin/python3 (found version “3.10.12”)
/home/pbreuer/ROS2/ws_seawind/src/PX4-Autopilot/src/drivers/uavcan/libuavcan/libuavcan/dsdl_compiler/setup.py:3: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
from distutils.core import setup
– Using C++11
– Release build type: MinSizeRel
/home/pbreuer/ROS2/ws_seawind/src/PX4-Autopilot/PX4-Autopilot_env/bin/python3: Error while finding module specification for ‘symforce.symbolic’ (ModuleNotFoundError: No module named ‘symforce’)
– ROMFS: ROMFS/px4fmu_common
– ROMFS: Adding platforms/nuttx/init/stm32f7/rc.board_arch_defaults → /etc/init.d/rc.board_arch_defaults
– ROMFS: Adding boards/px4/fmu-v5/init/rc.board_defaults → /etc/init.d/rc.board_defaults
– ROMFS: Adding boards/px4/fmu-v5/init/rc.board_sensors → /etc/init.d/rc.board_sensors
– ROMFS: Adding boards/px4/fmu-v5/extras/px4_fmu-v5_bootloader.bin → /etc/extras/px4_fmu-v5_bootloader.bin
– ROMFS: Adding boards/px4/fmu-v5/extras/px4_io-v2_default.bin → /etc/extras/px4_io-v2_default.bin
– Configuring done
– Generating done
– Build files have been written to: /home/pbreuer/ROS2/ws_seawind/src/PX4-Autopilot/build/px4_fmu-v5_default
[ 0%] Generating …/…/…/platforms/nuttx/NuttX/nuttx/.config
[ 0%] Generating Flight Tasks
[ 0%] Generating combined event json file
[ 0%] Generating uORB topic headers
make[4]: warning: jobserver unavailable: using -j1. Add ‘+’ to parent make rule.
make[4]: warning: jobserver unavailable: using -j1. Add ‘+’ to parent make rule.
[ 0%] Generating px4 event header file
[ 0%] Built target flighttasks_generated
[ 0%] Generating serial_params.c
[ 0%] Built target events_header
[ 0%] git submodule src/modules/uxrce_dds_client/Micro-XRCE-DDS-Client
[ 0%] Built target git_micro_xrce_dds_client
[ 0%] Generating serial_params.c
[ 0%] Generating parameters.xml
[ 0%] Generating parameters.xml
[ 0%] Generating …/…/…/platforms/nuttx/NuttX/nuttx/include/nuttx/config.h, …/…/…/platforms/nuttx/NuttX/nuttx/include/arch/chip
make[4]: warning: jobserver unavailable: using -j1. Add ‘+’ to parent make rule.
make[4]: warning: jobserver unavailable: using -j1. Add ‘+’ to parent make rule.
[ 0%] Built target uorb_headers
[ 0%] Generating git version header
[ 0%] Built target ver_gen
[ 0%] Generating actuators.json
[ 0%] Built target parameters_xml
[ 0%] Generating px4_parameters.hpp
[ 0%] git submodule platforms/nuttx/NuttX/nuttx
make[4]: warning: jobserver unavailable: using -j1. Add ‘+’ to parent make rule.
make[4]: warning: jobserver unavailable: using -j1. Add ‘+’ to parent make rule.
[ 0%] Built target git_nuttx
[ 0%] Generating output_functions.hpp
[ 0%] Built target parameters_header
[ 0%] Built target output_functions_header
[ 0%] git submodule src/drivers/gps/devices
[ 0%] git submodule src/drivers/uavcan/libuavcan
[ 0%] Built target git_uavcan
[ 0%] PX4 UAVCAN dsdl compiler
[ 0%] Built target git_gps_devices
[ 0%] Running dsdl compiler
[ 0%] Built target actuators_json
[ 0%] git submodule src/modules/mavlink/mavlink
[ 0%] Built target git_mavlink_v2
[ 0%] Generating uORB topic ucdr headers
[ 0%] Built target libuavcan_dsdlc
[ 0%] Generating XRCE-DDS topic bridge
[ 0%] Built target px4_uavcan_dsdlc
[ 0%] Creating airframes.xml
[ 0%] Built target topic_bridge_files
[ 0%] Generating …/…/…/…/platforms/nuttx/NuttX/nuttx/tools/jlink-nuttx.so
make[4]: warning: jobserver unavailable: using -j1. Add ‘+’ to parent make rule.
[ 0%] Built target airframes_xml
[ 0%] Generating Mavlink uAvionix: src/modules/mavlink/mavlink/message_definitions/v1.0/uAvionix.xml
[ 0%] Built target jlink-nuttx
[ 0%] Built target mavlink_c_generate_uavionix
[ 0%] Built target nuttx_context
[ 0%] Generating nuttx/mm/libmm.a
[ 0%] Building C object src/lib/crc/CMakeFiles/crc.dir/crc.c.obj
[ 0%] Building CXX object src/lib/perf/CMakeFiles/perf.dir/perf_counter.cpp.obj
make[4]: warning: jobserver unavailable: using -j1. Add ‘+’ to parent make rule.
[ 0%] Linking C static library libcrc.a
[ 0%] Built target crc
[ 0%] Building CXX object src/lib/tinybson/CMakeFiles/tinybson.dir/tinybson.cpp.obj
[ 0%] Linking CXX static library libperf.a
[ 0%] Built target perf
[ 0%] Building CXX object boards/px4/fmu-v5/src/CMakeFiles/board_bus_info.dir/i2c.cpp.obj
[ 0%] Linking CXX static library libtinybson.a
[ 0%] Built target tinybson
[ 0%] Building CXX object boards/px4/fmu-v5/src/CMakeFiles/board_bus_info.dir/spi.cpp.obj
[ 0%] Generating nuttx/drivers/libdrivers.a
make[4]: warning: jobserver unavailable: using -j1. Add ‘+’ to parent make rule.
[ 0%] Linking CXX static library libboard_bus_info.a
[ 0%] Built target board_bus_info
[ 0%] Generating nuttx/fs/libfs.a
make[4]: warning: jobserver unavailable: using -j1. Add ‘+’ to parent make rule.
[ 0%] Built target nuttx_mm_build
[ 0%] Generating nuttx/sched/libsched.a
make[4]: warning: jobserver unavailable: using -j1. Add ‘+’ to parent make rule.
[ 1%] Built target nuttx_drivers_build
[ 1%] Generating nuttx/libs/libxx/libxx.a
make[4]: warning: jobserver unavailable: using -j1. Add ‘+’ to parent make rule.
[ 1%] Built target nuttx_xx_build
[ 1%] Generating nuttx/arch/arm/src/libarch.a
make[4]: warning: jobserver unavailable: using -j1. Add ‘+’ to parent make rule.
chip/stm32_gpio.c:49:11: note: ‘#pragma message: CONFIG_STM32F7_USE_LEGACY_PINMAP will be deprecated migrate board.h see tools/stm32_pinmap_tool.py’
49 | # pragma message “CONFIG_STM32F7_USE_LEGACY_PINMAP will be deprecated migrate board.h see tools/stm32_pinmap_tool.py”
| ^~~~~~~
[ 1%] Built target nuttx_fs_build
[ 1%] Generating nuttx/libs/libc/libc.a
make[4]: warning: jobserver unavailable: using -j1. Add ‘+’ to parent make rule.
[ 1%] Built target uorb_ucdr_headers
[ 1%] Building CXX object src/modules/commander/ModeUtil/CMakeFiles/mode_util.dir/control_mode.cpp.obj
[ 1%] Building CXX object src/modules/commander/ModeUtil/CMakeFiles/mode_util.dir/mode_requirements.cpp.obj
[ 1%] Linking CXX static library libmode_util.a
[ 1%] Built target mode_util
[ 1%] Creating directories for ‘libmicroxrceddsclient_project’
[ 1%] No download step for ‘libmicroxrceddsclient_project’
[ 1%] No update step for ‘libmicroxrceddsclient_project’
[ 1%] No patch step for ‘libmicroxrceddsclient_project’
[ 1%] Performing configure step for ‘libmicroxrceddsclient_project’
[ 1%] Built target nuttx_arch_build
[ 1%] Building C object boards/px4/fmu-v5/src/CMakeFiles/drivers_userspace.dir/stm32_userspace.c.obj
[ 2%] Linking C static library libdrivers_userspace.a
[ 2%] Built target drivers_userspace
[ 2%] Generating px4 event json file from source
gmake[3]: /bin/sh: Argument list too long
gmake[3]: *** [src/lib/events/CMakeFiles/events_json.dir/build.make:1456: events/px4.json] Error 127
gmake[2]: *** [CMakeFiles/Makefile2:17482: src/lib/events/CMakeFiles/events_json.dir/all] Error 2
gmake[2]: *** Waiting for unfinished jobs…
[ 2%] Built target nuttx_sched_build
– libmicroxrceddsclient_project configure command succeeded. See also /home/pbreuer/ROS2/ws_seawind/src/PX4-Autopilot/build/px4_fmu-v5_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-configure-.log
[ 3%] Performing build step for ‘libmicroxrceddsclient_project’
– libmicroxrceddsclient_project build command succeeded. See also /home/pbreuer/ROS2/ws_seawind/src/PX4-Autopilot/build/px4_fmu-v5_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-build-
.log
[ 3%] Performing install step for ‘libmicroxrceddsclient_project’
– libmicroxrceddsclient_project install command succeeded. See also /home/pbreuer/ROS2/ws_seawind/src/PX4-Autopilot/build/px4_fmu-v5_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-install-*.log
[ 3%] Completed ‘libmicroxrceddsclient_project’
[ 3%] Built target libmicroxrceddsclient_project
[ 3%] Built target nuttx_c_build
gmake[1]: *** [Makefile:156: all] Error 2
make: *** [Makefile:227: px4_fmu-v5_default] Error 2

Any help is greatly appreciated!
Thank you!

@pbreuer Are you sure you have all the dependencies installed correctly?

I (re-)installed the Arm GNU toolchain (using these instructions as I am running WSL2 with Ubuntu 22.04).

The checks mentioned here are successful.

I installed all the Python package requirements in a virtual environment with Python3.8 (needed for the Arm GNU toolchain) using

python3 -m pip install --requirement ./Tools/setup/requirements.txt

Are there other dependencies needed that I am not aware of?

Thank you for your assistance in this:)

Did you run the bash ./PX4-Autopilot/Tools/setup/ubuntu.sh command?

Maybe more general, have you looked at the setting up as a developer docs page?

@Per_Frivik Thank you for the hint!

I should mention that I am trying to make a docker dev container for developing with/building PX4.

The container is based on this official PX4 Dockerfile.

make px4_fmu-v5_default doesn’t run successfully inside the container.

In attempt to make it build succesfully I do the following (inside the container):

  1. Run the ubuntu.sh setup script (attempting to build now gives gcc-arm-none-eabi related errors)
  2. Install the Arm GNU toolchain using these instructions
  3. Sync submodules and clean build folder:
    git submodule sync --recursive && git submodule update --init --recursive && make distclean

Building now gives an errors related to [-Werror=dangling-pointer=].

Has anyone ever built PX4 for a NuttX target inside the dev container? I feel like this should definitely work.

Any help is appreciated! Thanks!

I (re-)installed the Arm GNU toolchain (using these instructions as I am running WSL2 with Ubuntu 22.04).

Here you mention that you are running 22.04, but the link you sent which you based your container on, states that it supports the ROS 2 Rolling environment, which according to this link, does not support 22.04 Rolling Ridley (rolling) — ROS 2 Documentation: Foxy documentation.

I am using this Dockerfile (based on the ROS 2 rolling container) which installs ROS 2 humble.

I also feel like this issue is independent of the ROS version installed though. Unless I’ve missed something, I feel like on a fresh Ubuntu install (in this case provided by the container with 22.04), following the setup instructions (i.e. running the ubuntu.sh setup script) should suffice to enable building PX4?

I am now simply trying to build a NuttX target inside an official PX4 container (with no ROS 2 installed). I believe this should be possible.

I figure it’s best if I go through the errors I am encountering step by step:

To make this easily reproducible I have done the following:

  1. Run a Ubuntu 22.04 (Jammy) Docker container according to the instructions by running:
# enable access to xhost from the container
xhost +

# Run docker and open bash shell
docker run -it --privileged \
--env=LOCAL_USER_ID="$(id -u)" \
-v ~/src/PX4-Autopilot:/src/PX4-Autopilot/:rw \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-e DISPLAY=:0 \
--network host \
--name=px4-base px4io/px4-dev-base-jammy bash
  1. Try to build a NuttX target e.g. make px4_fmu-v5_default. This gives the following error:

CMake Error at CMakeLists.txt:219 (project):
The CMAKE_CXX_COMPILER:

arm-none-eabi-g++

is not a full path and was not found in the PATH.

Tell CMake where to find the compiler by setting either the environment
variable “CXX” or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.

CMake Error at CMakeLists.txt:219 (project):
The CMAKE_C_COMPILER:

arm-none-eabi-gcc

is not a full path and was not found in the PATH.

Tell CMake where to find the compiler by setting either the environment
variable “CC” or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.

– Enabling double FP precision hardware instructions
CMake Error at CMakeLists.txt:219 (project):
The CMAKE_ASM_COMPILER:

arm-none-eabi-gcc

is not a full path and was not found in the PATH.

Tell CMake where to find the compiler by setting either the environment
variable “ASM” or the CMake cache entry CMAKE_ASM_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.

How can I resolve this error?