Make px4_sitl failed due to -Werror=array-bounds= in Matrix.hpp

Can someone here help me with this? I am trying to build px4_sitl using instructions provided by ROS 2 User Guide | PX4 User Guide (main) from release/1.14 branch in the git repo. I am not using the main branch due to a separate issue preventing me from building. I get the following error in the terminal when I try: make px4_sitl. It seems to be something to do with the Matrix.hpp header. Any help would be much appreciated. Platform is ARM64 Ubuntu 18.04. Thanks…

[256/599] Building CXX object src/modules/local_position_estimator/CMakeFiles/modules__local_position_estimator.dir/sensors/lidar.cpp.o
FAILED: src/modules/local_position_estimator/CMakeFiles/modules__local_position_estimator.dir/sensors/lidar.cpp.o
/usr/bin/c++ -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -DMODULE_NAME="local_position_estimator" -DPX4_MAIN=local_position_estimator_app_main -D__CUSTOM_FILE_IO__ -D__PX4_LINUX -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function=“attribute((noreturn))” -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/boards/px4/sitl/src -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/platforms/posix/src/px4/common/include -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/build/px4_sitl_default -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/build/px4_sitl_default/src/lib -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/platforms/posix/src/px4/generic/generic/include -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/platforms/common -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/platforms/common/include -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/include -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/matrix -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/modules -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/platforms/posix/include -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/build/px4_sitl_default/external/Install/include -O2 -g -DNDEBUG -std=gnu++14 -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 -Wno-stringop-truncation -fno-builtin-printf -fno-strength-reduce -Wformat=1 -Wunused-but-set-variable -Wno-format-truncation -fcheck-new -Wreorder -Wno-overloaded-virtual -D__KERNEL__ -MD -MT src/modules/local_position_estimator/CMakeFiles/modules__local_position_estimator.dir/sensors/lidar.cpp.o -MF src/modules/local_position_estimator/CMakeFiles/modules__local_position_estimator.dir/sensors/lidar.cpp.o.d -o src/modules/local_position_estimator/CMakeFiles/modules__local_position_estimator.dir/sensors/lidar.cpp.o -c /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/modules/local_position_estimator/sensors/lidar.cpp
In file included from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/matrix/matrix/math.hpp:8,
from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/mathlib/math/Functions.hpp:45,
from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/mathlib/math/filter/LowPassFilter2p.hpp:41,
from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/controllib/BlockDelay.hpp:48,
from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/controllib/blocks.hpp:42,
from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/modules/local_position_estimator/sensors/…/BlockLocalPositionEstimator.hpp:7,
from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/modules/local_position_estimator/sensors/lidar.cpp:1:
In member function ‘Type& matrix::Matrix<Type, M, N>::operator()(size_t, size_t) [with Type = float; long unsigned int M = 1; long unsigned int N = 1]’,
inlined from ‘bool matrix::inv(const SquareMatrix<Type, M>&, SquareMatrix<Type, M>&, size_t) [with Type = float; long unsigned int M = 1]’ at /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/matrix/matrix/SquareMatrix.hpp:349:20:
/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/matrix/matrix/Matrix.hpp:96:29: error: array subscript 1 is above array bounds of ‘float [1][1]’ [-Werror=array-bounds=]
96 | return data[i][j];
| ~~~~~^
compilation terminated due to -Wfatal-errors.
cc1plus: all warnings being treated as errors
[258/599] Building CXX object src/modules/local_position_estimator/CMakeFiles/modules__local_position_estimator.dir/sensors/sonar.cpp.o
FAILED: src/modules/local_position_estimator/CMakeFiles/modules__local_position_estimator.dir/sensors/sonar.cpp.o
/usr/bin/c++ -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -DMODULE_NAME="local_position_estimator" -DPX4_MAIN=local_position_estimator_app_main -D__CUSTOM_FILE_IO
_ -D__PX4_LINUX -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function=“attribute((noreturn))” -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/boards/px4/sitl/src -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/platforms/posix/src/px4/common/include -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/build/px4_sitl_default -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/build/px4_sitl_default/src/lib -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/platforms/posix/src/px4/generic/generic/include -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/platforms/common -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/platforms/common/include -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/include -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/matrix -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/modules -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/platforms/posix/include -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/build/px4_sitl_default/external/Install/include -O2 -g -DNDEBUG -std=gnu++14 -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 -Wno-stringop-truncation -fno-builtin-printf -fno-strength-reduce -Wformat=1 -Wunused-but-set-variable -Wno-format-truncation -fcheck-new -Wreorder -Wno-overloaded-virtual -D__KERNEL__ -MD -MT src/modules/local_position_estimator/CMakeFiles/modules__local_position_estimator.dir/sensors/sonar.cpp.o -MF src/modules/local_position_estimator/CMakeFiles/modules__local_position_estimator.dir/sensors/sonar.cpp.o.d -o src/modules/local_position_estimator/CMakeFiles/modules__local_position_estimator.dir/sensors/sonar.cpp.o -c /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/modules/local_position_estimator/sensors/sonar.cpp
In file included from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/matrix/matrix/math.hpp:8,
from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/mathlib/math/Functions.hpp:45,
from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/mathlib/math/filter/LowPassFilter2p.hpp:41,
from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/controllib/BlockDelay.hpp:48,
from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/controllib/blocks.hpp:42,
from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/modules/local_position_estimator/sensors/…/BlockLocalPositionEstimator.hpp:7,
from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/modules/local_position_estimator/sensors/sonar.cpp:1:
In member function ‘Type& matrix::Matrix<Type, M, N>::operator()(size_t, size_t) [with Type = float; long unsigned int M = 1; long unsigned int N = 1]’,
inlined from ‘bool matrix::inv(const SquareMatrix<Type, M>&, SquareMatrix<Type, M>&, size_t) [with Type = float; long unsigned int M = 1]’ at /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/matrix/matrix/SquareMatrix.hpp:349:20:
/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/matrix/matrix/Matrix.hpp:96:29: error: array subscript 1 is above array bounds of ‘float [1][1]’ [-Werror=array-bounds=]
96 | return data[i][j];
| ~~~~~^
compilation terminated due to -Wfatal-errors.
cc1plus: all warnings being treated as errors
[259/599] Building CXX object src/modules/local_position_estimator/CMakeFiles/modules__local_position_estimator.dir/sensors/baro.cpp.o
FAILED: src/modules/local_position_estimator/CMakeFiles/modules__local_position_estimator.dir/sensors/baro.cpp.o
/usr/bin/c++ -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -DMODULE_NAME="local_position_estimator" -DPX4_MAIN=local_position_estimator_app_main -D__CUSTOM_FILE_IO
_ -D__PX4_LINUX -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function=“attribute((noreturn))” -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/boards/px4/sitl/src -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/platforms/posix/src/px4/common/include -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/build/px4_sitl_default -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/build/px4_sitl_default/src/lib -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/platforms/posix/src/px4/generic/generic/include -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/platforms/common -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/platforms/common/include -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/include -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/matrix -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/modules -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/platforms/posix/include -I/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/build/px4_sitl_default/external/Install/include -O2 -g -DNDEBUG -std=gnu++14 -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 -Wno-stringop-truncation -fno-builtin-printf -fno-strength-reduce -Wformat=1 -Wunused-but-set-variable -Wno-format-truncation -fcheck-new -Wreorder -Wno-overloaded-virtual -D__KERNEL__ -MD -MT src/modules/local_position_estimator/CMakeFiles/modules__local_position_estimator.dir/sensors/baro.cpp.o -MF src/modules/local_position_estimator/CMakeFiles/modules__local_position_estimator.dir/sensors/baro.cpp.o.d -o src/modules/local_position_estimator/CMakeFiles/modules__local_position_estimator.dir/sensors/baro.cpp.o -c /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/modules/local_position_estimator/sensors/baro.cpp
In file included from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/matrix/matrix/math.hpp:8,
from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/mathlib/math/Functions.hpp:45,
from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/mathlib/math/filter/LowPassFilter2p.hpp:41,
from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/controllib/BlockDelay.hpp:48,
from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/controllib/blocks.hpp:42,
from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/modules/local_position_estimator/sensors/…/BlockLocalPositionEstimator.hpp:7,
from /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/modules/local_position_estimator/sensors/baro.cpp:1:
In member function ‘Type& matrix::Matrix<Type, M, N>::operator()(size_t, size_t) [with Type = float; long unsigned int M = 1; long unsigned int N = 1]’,
inlined from ‘bool matrix::inv(const SquareMatrix<Type, M>&, SquareMatrix<Type, M>&, size_t) [with Type = float; long unsigned int M = 1]’ at /home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/matrix/matrix/SquareMatrix.hpp:349:20:
/home/user/AI_GNN_UAV/PX4/PX4-Autopilot/src/lib/matrix/matrix/Matrix.hpp:96:29: error: array subscript 1 is above array bounds of ‘float [1][1]’ [-Werror=array-bounds=]
96 | return _data[i][j];
| ~~~~~^
compilation terminated due to -Wfatal-errors.
cc1plus: all warnings being treated as errors
[261/599] Building CXX object src/modules/local_position_estimator/CMakeFiles/modules__local_position_estimator.dir/BlockLocalPositionEstimator.cpp.o
ninja: build stopped: subcommand failed.
Makefile:232: recipe for target ‘px4_sitl’ failed
make: *** [px4_sitl] Error 1