in general, this is a problem of support by Mathworks. We do not have a direct influence on that issue. However, I can understand that the support of GCC versions with Matlab is an issue for the compilation of MEX files.
I also had this issue once, when running a Vienna Simulator on Ubuntu. Back at the time, I think I used Ubuntu 15 or something, however, I made it work. I think the only solution is to install the highest GCC version that is supported by Matlab, although it is very old. Please consider a solution like this