MATLAB: Running MATLAB compiled code on RedHat Enterprise Linux Server Release 7.5

MATLAB Compiler

We are using the MATLAB R2018a compiler and runtime, and we're having some trouble with RedHat Enterprise Linux Server Release 7.5.
We build a shared library (e.g. "libmodelcode.so") utilizing .M-files with MATLAB R2018a compiler. This step is done with a computer running Ubuntu Linux and GCC-6.4 installed from Ubuntu's package repository. The compilation step works fine.
Then, as the product we are building is intended to be run with RedHat Enterprise Linux Server Release 7.5, we build the final product with RHEL 7.5, linking against the MATLAB R2018a runtime. However, with RedHat Enterprise Linux, there is no suitable compiler to do it with. By default RedHat comes with a rather old GCC compiler suite. It provides a package "devtools-6" that should install GCC-6.3 required by MATLAB R2018a, but it doesn't come with the correct libstdc++.so version (it is lacking the required GLIBCXX and CXXABI support).
Do you have some recommendations on what would be the best way to proceed with this issue?

Best Answer

Please verify that you have also linked the libstdsc++.so that comes with MATLAB when you compile your code in the G++ command on your RedHat Enterprise Linux Server.