Building ArduPilot v3.6.12 on Ubuntu 18.04 for Intel Aero RTF drone (board=aerofc-v1)

I initially run the following command from the root directory ardupilot:

./waf configure --board aerofc-v1
Output:
Setting top to : /home/aerofc-build/ardupilot
Setting out to : /home/aerofc-build/ardupilot/build
Autoconfiguration : enabled
Setting board to : aerofc-v1
Checking for program ‘arm-none-eabi-ar’ : /opt/gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-ar
Using toolchain : arm-none-eabi
Checking for ‘g++’ (C++ compiler) : /usr/lib/ccache/arm-none-eabi-g++
Checking for ‘gcc’ (C compiler) : /usr/lib/ccache/arm-none-eabi-gcc
Checking for c flags ‘-MMD’ : yes
Checking for cxx flags ‘-MMD’ : yes
Checking for HAVE_CMATH_ISFINITE : no
Checking for HAVE_CMATH_ISINF : no
Checking for HAVE_CMATH_ISNAN : no
Checking for NEED_CMATH_ISFINITE_STD_NAMESPACE : no
Checking for NEED_CMATH_ISINF_STD_NAMESPACE : no
Checking for NEED_CMATH_ISNAN_STD_NAMESPACE : no
Checking for header endian.h : not found
Checking for header byteswap.h : not found
Checking for program ‘cmake’ : /usr/bin/cmake
Checking cmake version : 3.10.2
Checking for program ‘ninja, ninja-build’ : not found
Checking for program ‘make’ : /usr/bin/make
Checking for program ‘python’ : /usr/bin/python
Checking for python version >= 2.7.0 : 2.7.17
Checking for program ‘python’ : /usr/bin/python
Checking for python version >= 2.7.0 : 2.7.17
Source is git repository : yes
Update submodules : yes
Checking for program ‘git’ : /usr/bin/git
Gtest : STM32 boards currently don’t support compiling gtest
Checking for program ‘arm-none-eabi-size’ : /opt/gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-size
Benchmarks : disabled
Unit tests : disabled
Checking for program ‘rsync’ : /usr/bin/rsync
‘configure’ finished successfully (1.366s)


./waf copter
Output:
Waf: Entering directory `/home/aerofc-build/ardupilot/build/aerofc-v1’
[15/16] CMake Build px4 msg_gen
No such file or directory
CMake Error: Generator: execution of make failed. Make command was: “” “msg_gen”

Waf: Leaving directory `/home/aerofc-build/ardupilot/build/aerofc-v1’
Build failed
-> task in ‘px4_msg_gen’ failed (exit status 1):
{task 140712092286560: cmake_build_task -> }
/usr/bin/cmake --build /home/aerofc-build/ardupilot/build/aerofc-v1/modules/PX4Firmware --target msg_gen

Can someone help with this error?

Okay I solved the error by re-installing the build tools for ubuntu from the directory Tools/scripts/ and running the script:

./install-prereqs-ubuntu.sh -y

This however install STM32 cross compiler toolchain from an old url which gave a 404 error. So I had to change the url in the script. Open the script in any editor of your liking. I used Atom:

atom install-prereqs-ubuntu.sh

On line 29: ARM_TARBALL_URL=“http://firmware.ardupilot.org/Tools/PX4-tools/$ARM_TARBALL

Change the url to:
ARM_TARBALL_URL=“http://firmware.ardupilot.org/Tools/STM32-tools/archived/$ARM_TARBALL

Rerun the script and it should install everything and proceed smoothly.
Then proceed as follows from the ardupilot root directory:

Tools/scripts/./install-prereqs-ubuntu.sh -y
. ~/.profile
./waf configure --board aerofc-v1
./waf copter

This should compile and build the nuttx + ardupilot firmware in the /ardupilot/build/bin directory as ardupilot.px4.
You can also find a corresponding ELF binary in the same directory