MATLAB: Do I receive a ‘warning: libstdc++-libc6.1-2.so.3 …’ when I try to compile stand-alone code on Linux Redhat 7.0 with the MATLAB C/C++ Math LIbrary 2.1 (R12)

7.0compilelibstdc++-libc6.1-2.so.3linuxMATLAB C/C++ Math Libraryredhatstandalonewarning

Why do I receive a 'warning: libstdc++-libc6.1-2.so.3 …' when I try to compile stand-alone code on Linux Redhat 7.0 with the MATLAB C/C++ Math LIbrary 2.1 (R12)?
I am receiving the following error from mbuild when trying to compile a stand-alone application for Linux (Redhat 7.0):
/usr/bin/ld: warning: libstdc++-libc6.1-2.so.3, needed by
/usr/local/matlab6/extern/lib/glnx86/libmatpp.so, not found (try using
--rpath)
The "mbuild" command invokes:
g++ -Wl,--rpath-link,/usr/local/matlab6/bin/glnx86
-L/usr/local/matlab6/bin/glnx86 -o test2
<all the .o files ...>
-Wl,--rpath-link,/usr/local/matlab6/bin/glnx86
-L/usr/local/matlab6/extern/lib/glnx86
-lmatpp -lmmfile -lmatlb -lmat -lmx -lm
"ldconfig" gives the following:
libstdc++.so.2.9 -> libstdc++.so.2.9.dummy
libstdc++-libc6.2-2.so.3 -> libstdc++-3-libc6.2-2-2.10.0.so
libstdc++-libc6.1-1.so.2 -> libstdc++-2-libc6.1-1-2.9.0.so
libstdc++.so.2.8 -> libstdc++.so.2.8.0
libstdc++.so.2.7.2 -> libstdc++.so.2.7.2.8
libstdc++.so.27 -> libstdc++.so.27.1.4
And this from "rpm":
libstdc++-devel-2.96-54
compat-libstdc++-6.2-2.9.0.9
libstdc++-2.96-54
To get things to compile, I "downgraded" to libstdc++-libc6.1-2.so.3 using
the libstdc++-2.95.1_2.10.0-3-i386.rpm file. However, I am a bit perplexed
as to why the "2-2.so.3" version (as opposed to "1-2.so.3") is not used,
having a higher major revision number.

Best Answer

This problem occurs because the library 'libmatlb' was not shipped with the Math library 2.1 (R12).
If you have MATLAB, you can copy the file you need (for example, libstdc++-3-libc6.2-2-2.10.0.so):
from:
$MATLAB/sys/os/glnx86
(where $MATLAB = the MATLAB root directory on your machine)
to:
$MATLAB/extern/lib/glnx86.
(where $MATLAB = the MATLAB root directory on your machine)
This has been corrected for MATLAB C/C++ Math Library 2.2 (R12.1) and later by including "libmatlb" for glnx86 in the $MATLAB/extern/lib directory.