Run Lua in SITL, but something is wrong

I have tested lua scripts for copter, it works well, but when I tested it for plane as following:

sim_vehicle.py -v ArduPlane plane_aerobatics.lua --console --map

there is the error

{‘waf_target’: ‘bin/arduplane’, ‘default_params_filename’: ‘default_params/plane.parm’, ‘model’: ‘plane’, ‘sitl-port’: True}
SIM_VEHICLE: Building
SIM_VEHICLE: “/home/apm/arduplan432/ardupilot/modules/waf/waf-light” “build” “–target” “bin/arduplane”
Waf: Entering directory `/home/apm/arduplan432/ardupilot/build/sitl’
Embedding file locations.txt:Tools/autotest/locations.txt
Embedding file models/Callisto.json:Tools/autotest/models/Callisto.json
[901/961] Compiling ArduPlane/mode_qstabilize.cpp
[902/961] Compiling ArduPlane/GCS_Mavlink.cpp
In file included from …/…/libraries/AP_HAL/AP_HAL_Namespace.h:4,
from …/…/libraries/AP_HAL/Semaphores.h:3,
from …/…/libraries/AP_HAL_SITL/Semaphores.h:6,
from …/…/libraries/AP_HAL/board/sitl.h:56,
from …/…/libraries/AP_HAL/AP_HAL_Boards.h:125,
from …/…/libraries/GCS_MAVLink/GCS.h:6,
from …/…/ArduPlane/GCS_Mavlink.h:3,
from …/…/ArduPlane/GCS_Mavlink.cpp:1:
…/…/libraries/AP_HAL/utility/functor.h:32:39: error: parse error in template argument list
32 | Functor<rettype, ## VA_ARGS>::bind<std::remove_reference<decltype(*this)>::type, func>(this)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
…/…/ArduPlane/Plane.h:625:13: note: in expansion of macro ‘FUNCTOR_BIND_MEMBER’
625 | FUNCTOR_BIND_MEMBER(&Plane::, bool, const AP_Mission::Mission_Command &),
| ^~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.

In file included from …/…/libraries/AP_HAL/AP_HAL_Namespace.h:4,
from …/…/libraries/AP_HAL/AP_HAL.h:5,
from …/…/libraries/AP_Param/AP_Param.h:27,
from …/…/ArduPlane/mode.h:3,
from …/…/ArduPlane/mode_qstabilize.cpp:1:
…/…/libraries/AP_HAL/utility/functor.h:32:39: error: parse error in template argument list
32 | Functor<rettype, ## VA_ARGS>::bind<std::remove_reference<decltype(*this)>::type, func>(this)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
…/…/ArduPlane/Plane.h:625:13: note: in expansion of macro ‘FUNCTOR_BIND_MEMBER’
625 | FUNCTOR_BIND_MEMBER(&Plane::, bool, const AP_Mission::Mission_Command &),
| ^~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.

Waf: Leaving directory `/home/apm/arduplan432/ardupilot/build/sitl’
Build failed
→ task in ‘bin/arduplane’ failed (exit status 1):
{task 140549539850048: cxx GCS_Mavlink.cpp → GCS_Mavlink.cpp.47.o}
(run with -v to display more information)
→ task in ‘bin/arduplane’ failed (exit status 1):
{task 140549539895104: cxx mode_qstabilize.cpp → mode_qstabilize.cpp.47.o}
(run with -v to display more information)
SIM_VEHICLE: Build failed
SIM_VEHICLE: Killing tasks

I test master and 4.5.0 branch, both have this, my ubuntu version is 20.04, thanks

Try deleting the build/sitl directory and recompiling.

I try delete the whole build directory and recompile, but it has the same problem, thanks

Works for me on latest master.
I tried:

  • ./waf configure --board sitl
  • ./waf clean
  • cd ArduPlane/sitl
  • sim_vehicle.py -v ArduPlane plane_aerobatics.lua --console --map

compiled and ran with no errors

I clone the latest verison, it still could not work
and I could not find the ArduPlane/sitl folder, may it be the ArduPlane folder
I will try it again, thanks

I test it in another pc, and i t works, I think there are some difference in the development environment

Did you run Tools/environment_install/install-prereqs-ubuntu.sh to install the dev environment?

Yes, I run this script

Do you have the right compiler version?

$ gcc --version
gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0

The successful one is 10.3.1, and that does not work is 9.4.0, maybe this cause the problem? Thanks

The environment installation script should install the right compiler.