Failure during compilation of Copter firmware in Linux. gcc compiler error: <cmath> NO such file or directory

Hello ArduPilot Community!
I am trying to build ArduCopter firmware in a Linux environment, but I am having some issues at the final step (the compilation step).

I followed all the steps listed in:
(Got a little confused because I was following a Youtube video, and discovered that apparently, the steps change and are updated on an hourly basis!)

I was successful in most of the steps. However, when I reached the last step of compiling the code, it begins without issues and then stops when compiling

Not just that, but also a bunch of other files.
And the error I get is as follows

[7/8] Creating build/Pixhawk1/ap_version.h
[ 9/552] Compiling libraries/AC_AttitudeControl/AC_AttitudeControl_Sub.cpp
[ 10/552] Compiling libraries/AC_AttitudeControl/AC_AttitudeControl_Heli.cpp
[ 11/552] Compiling libraries/AC_AttitudeControl/ControlMonitor.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/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
compilation terminated.

I tried removing gcc compiler, gcc-arm-none-eabi, and tried getting other versions. But still useless. I tried 2017, 2018 and in the end, I tried the 2015 version (because it is the one listed in the Wiki), but still with no success.
What do you think the problem is?

Thank you!

Edit 1: The build command works fine for SITL.

Hi. Did you (or anyone) solve this issue?