Servers by jDrones

Sim_vehicle.py build broken with warning/error on uninitialized array. waf compiler flags?

$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors 6-2017-q2-update) 6.3.1 20170620 (release) [ARM/embedded-6-branch revision 249437]

$waf configure --board Pixhawk1

$waf build plane <— builds fine.

$/Tools/autotest/sim_vehicle.py -v ArduPlane --map --console

./…/libraries/AP_NavEKF2/AP_NavEKF2_MagFusion.cpp: In member function ‘void NavEKF2_core::FuseMagnetometer()’:
…/…/libraries/AP_NavEKF2/AP_NavEKF2_MagFusion.cpp:681:44: error: ‘H_MAG[16]’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
681 | KH[i][j] = Kfusion[i] * H_MAG[j];
| ~~~~~~~^
compilation terminated due to -Wfatal-errors.
cc1plus: some warnings being treated as errors

Waf: Leaving directory `/home/me/Development/ardupilotbase/build/sitl’
Build failed
-> task in ‘objs/AP_NavEKF2’ failed (exit status 1):
{task 140360111670992: cxx AP_NavEKF2_MagFusion.cpp -> AP_NavEKF2_MagFusion.cpp.0.o}
(run with -v to display more information)
SIM_VEHICLE: Build failed
SIM_VEHICLE: Killing tasks

[me@bigboy ardupilotbase]$ waf clean
Project was configured with a different version of Waf, please reconfigure it ???

How do I pass compiler flags into waf to turn this error off ?

I got it to build.

A few things.

  1. The sitl build doesn’t use the ARM toolchain. Sitl doesn’t run on the FC ! Duh ! It runs on the PC, so it uses the native compiler.

  2. It doesn’t look like waf passes in any compiler flags. However, you can set gcc and g++ default compilation flags with export CFLAGS = and export CPPFLAGS =.

So what worked was to export CPPFLAGS = ‘’, which essentially turns everything off. Not very safe, but it worked.

Feel free to correct me if I have this wrong.

Which version of the code is this? It doesn’t seem to be master.

So what worked was to export CPPFLAGS = ¡¢, which essentially turns everything off. Not very safe, but it worked.

For SITL it doesn’t matter. But the same code runs on stm32, so we need
to make sure we understand what’s going on. This isn’t necessarily
your problem, so I completely understand you pushing on. OTOH, it would
be nice to get more information so we can make sure we know what’s going
on.

Feel free to correct me if I have this wrong.

Nope, that’s all pretty much correct AFAICS.

A neater solution is to modify the boards.py file to remove the flag which
is offending you.

Peter

Servers by jDrones