PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.54k stars 13.52k forks source link

Build failure on branch release/1.12 #17990

Closed robwaat closed 3 years ago

robwaat commented 3 years ago

Describe the bug Use of the make command fails and returns an error when building against branch release/1.12 on multiple targets including px4_sitl_default.

To Reproduce Steps to reproduce the behavior:

  1. Install developer tool chain and git clone PX4-Autopilot repo.
  2. Checkout release branch git checkout release/1.12.
  3. Update git submodules git submodule update --init --recursive
  4. Run make command make px4_sitl_default.
  5. The error message included below appears on the terminal.

Expected behavior Clean compilation of the intended target.

Log Files and Screenshots The complete terminal output following the make command is given below, including the error message.

robwaat@Ubuntu18-04:~/Documents/PX4-Autopilot$ make px4_sitl_default
-- PX4 version: v1.12.0-5-g0f46220236
-- PX4 config file: /home/robwaat/Documents/PX4-Autopilot/boards/px4/sitl/default.cmake
-- PX4 config: px4_sitl_default
-- PX4 platform: posix
-- PX4 lockstep: enabled
-- cmake build type: RelWithDebInfo
-- The CXX compiler identification is GNU 7.5.0
-- The C compiler identification is GNU 7.5.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Building for code coverage
-- ccache enabled (export CCACHE_DISABLE=1 to disable)
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.6.9", minimum required is "3") 
-- build type is RelWithDebInfo
-- PX4 ECL: Very lightweight Estimation & Control Library v1.9.0-rc1-569-g71fc1b8
-- ROMFS: ROMFS/px4fmu_common
-- Configuring done
-- Generating done
-- Build files have been written to: /home/robwaat/Documents/PX4-Autopilot/build/px4_sitl_default
[0/809] git submodule src/drivers/gps/devices
[9/809] git submodule src/lib/ecl
[14/809] git submodule mavlink/include/mavlink/v2.0
[656/809] Building CXX object src/modu...sensors.dir/voted_sensors_update.cpp.o
FAILED: src/modules/sensors/CMakeFiles/modules__sensors.dir/voted_sensors_update.cpp.o 
/usr/bin/ccache /usr/bin/c++  -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -DMODULE_NAME=\"sensors\" -DPX4_MAIN=sensors_app_main -D__CUSTOM_FILE_IO__ -D__PX4_LINUX -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function="__attribute__((noreturn))" -I../../boards/px4/sitl/src -I../../platforms/posix/src/px4/common/include -I. -Isrc/lib -I../../platforms/posix/src/px4/generic/generic/include -I../../platforms/common -I../../platforms/common/include -I../../src -I../../src/include -I../../src/lib -I../../src/lib/matrix -I../../src/modules -I../../platforms/posix/include -Iexternal/Install/include -I../../src/modules/sensors -O2 -g -DNDEBUG -fPIC   -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 -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-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 -std=gnu++14 -MD -MT src/modules/sensors/CMakeFiles/modules__sensors.dir/voted_sensors_update.cpp.o -MF src/modules/sensors/CMakeFiles/modules__sensors.dir/voted_sensors_update.cpp.o.d -o src/modules/sensors/CMakeFiles/modules__sensors.dir/voted_sensors_update.cpp.o -c ../../src/modules/sensors/voted_sensors_update.cpp
../../src/modules/sensors/voted_sensors_update.cpp: In member function ‘void sensors::VotedSensorsUpdate::imuPoll(sensor_combined_s&)’:
../../src/modules/sensors/voted_sensors_update.cpp:218:34: error: ‘events’ has not been declared
   checkFailover(_accel, "Accel", events::px4::enums::sensor_type_t::accel);
                                  ^~~~~~
compilation terminated due to -Wfatal-errors.
[659/809] Building CXX object src/syst..._listener.dir/listener_generated.cpp.o
ninja: build stopped: subcommand failed.
Makefile:224: recipe for target 'px4_sitl_default' failed
make: *** [px4_sitl_default] Error 1

Additional context The error seems to have appeared following commit 0f46220. The target will compile successfully if lines 217-219 of src/modules/sensors/voted_sensors_update.cpp are altered as follows.

// use sensor voter to find best if SENS_IMU_MODE is enabled or ORB_ID(sensor_selection) has never published
checkFailover(_accel, "Accel");
checkFailover(_gyro, "Gyro");

It's possible this is due to the lack of existence of src/lib/events in the release/1.12 branch. The target compiles successfully on checkout of tag v1.12.0.

dagar commented 3 years ago

Thanks for reporting, the small commit cherry-picked from master needed a tiny change. The branch is now updated and is about to become v1.12.1.