Problem when configuring waf builder for pxf board

Hello Ardupilot community!

I am trying to build the ArduCopter firmware, but I am having some issues. At first, I was following a Youtube video, but I then realized that things have changed a bit, and I followed up the steps listed on the website, this link:
http://ardupilot.org/dev/docs/building-setup-linux.html
(I am using Ubuntu 18.10).

Most of the steps were successful, however, I am facing some issues. At first, I didn’t know which board to select… Pixhawk1 or pxf? (I am assuming pxf was px4-v2 previously).
I decided to configure waf for Pixhawk1 (I am using the original Pixhawk with px4 installed).
But when I first tried to build the firmware I got this error:

[ 9/552] Compiling libraries/AC_AttitudeControl/AC_AttitudeControl_Sub.cpp
[ 10/552] Compiling libraries/AC_AttitudeControl/ControlMonitor.cpp
[ 11/552] Compiling libraries/AC_AttitudeControl/AC_AttitudeControl_Heli.cpp
[ 12/552] Compiling libraries/AC_AttitudeControl/AC_PosControl_Sub.cpp
In file included from …/…/libraries/AP_Param/AP_Param.h:25:0,
from …/…/libraries/AC_AttitudeControl/AC_AttitudeControl.h:7,
from …/…/libraries/AC_AttitudeControl/ControlMonitor.cpp:1:
…/…/libraries/AP_Common/missing/cmath:3:22: fatal error: cmath: No such file or directory
#include_next
^
compilation terminated.

In file included from …/…/libraries/AP_Param/AP_Param.h:25:0,
from …/…/libraries/AC_AttitudeControl/AC_AttitudeControl.h:7,
from …/…/libraries/AC_AttitudeControl/AC_AttitudeControl_Sub.h:6,
from …/…/libraries/AC_AttitudeControl/AC_AttitudeControl_Sub.cpp:1:
…/…/libraries/AP_Common/missing/cmath:3:22: fatal error: cmath: No such file or directory
#include_next
^
compilation terminated.

In file included from …/…/libraries/AP_Param/AP_Param.h:25:0,
from …/…/libraries/AC_AttitudeControl/AC_PosControl.h:4,
from …/…/libraries/AC_AttitudeControl/AC_PosControl_Sub.h:3,
from …/…/libraries/AC_AttitudeControl/AC_PosControl_Sub.cpp:1:
…/…/libraries/AP_Common/missing/cmath:3:22: fatal error: cmath: No such file or directory
#include_next
^
compilation terminated.

In file included from …/…/libraries/AP_Param/AP_Param.h:25:0,
from …/…/libraries/AC_AttitudeControl/AC_AttitudeControl.h:7,
from …/…/libraries/AC_AttitudeControl/AC_AttitudeControl_Heli.h:6,
from …/…/libraries/AC_AttitudeControl/AC_AttitudeControl_Heli.cpp:1:
…/…/libraries/AP_Common/missing/cmath:3:22: fatal error: cmath: No such file or directory
#include_next
^
compilation terminated.
Waf: Leaving directory `/home/osboxes/ardupilot/build/Pixhawk1’
Build failed
→ task in ‘objs/AC_AttitudeControl’ failed (exit status 1):
{task 139683473623712: cxx ControlMonitor.cpp → ControlMonitor.cpp.0.o}
(run with -v to display more information)
→ task in ‘objs/AC_AttitudeControl’ failed (exit status 1):
{task 139683473623472: cxx AC_AttitudeControl_Sub.cpp → AC_AttitudeControl_Sub.cpp.0.o}
(run with -v to display more information)
→ task in ‘objs/AC_AttitudeControl’ failed (exit status 1):
{task 139683473623592: cxx AC_PosControl_Sub.cpp → AC_PosControl_Sub.cpp.0.o}
(run with -v to display more information)
→ task in ‘objs/AC_AttitudeControl’ failed (exit status 1):
{task 139683473623352: cxx AC_AttitudeControl_Heli.cpp → AC_AttitudeControl_Heli.cpp.0.o}
(run with -v to display more information)

I tried removing and re-installing gcc-arm-none-eaib, but with no use, I tried to use the compiler in the website, still no use, I installed and removed cmake, g++, and still all efforts are in vain… And nothing changed. I am pretty sure the issue is something with the compiler, but I don’t know where exactly.

I tried another path, which is to configure the waf to change the borad to pxf, and this is the result I got:

Setting top to : /home/osboxes/ardupilot
Setting out to : /home/osboxes/ardupilot/build
Autoconfiguration : enabled
GCOV code coverage analysis : no
Setting board to : pxf
Using toolchain : arm-linux-gnueabihf
Checking for ‘g++’ (C++ compiler) : not found
Checking for ‘clang++’ (C++ compiler) : not found
could not configure a C++ compiler!
(complete log in /home/osboxes/ardupilot/build/config.log)

Which means it cannot even find a C++ compiler, which doesn’t make senes because I have already installed them. (I also did the step of adding the bin file of gcc-none-arm-eabi to my directory, but it’s all the same)

I would be grateful if you could help me!
Thank you!

Edit 1: The build command works fine for SITL.