[在编译mex文件前,执行mex -setup设置编译环境]
I'm trying to compile a Mex file on SUSE linux 10.1, which uses GCC 4.1.0.
The file compiles fine, but when I try to run it I get this error:
/opt/Matlab/bin/glnx86/../../sys/os/glnx86/libgcc_s.so.1: version
`GCC_3.3' not found (required by /usr/lib/libstdc++.so.6).
From the documentation, it appears as though Matlab only supports GCC 3.2.3. I suspect that my only solution is to download and compile this compiler and then use it to compile my mex file.If you must use gcc 3.2.3, your best bet is to first build and install gcc 3.3.6, and then use that to build gcc 3.2.3.
3.1. build and install gcc 3.3.6 first
download gcc-3.3.6.tar.bz2 to /home/max/
cd home/max
tar xjvf gcc-3.3.6.tar.bz2 # $srcdir=/home/max/gcc-3.3.6
mkdir objdir
cd objdir
$srcdir/configure --prefix=/opt/gcc-3.3.6 # or wherever
make bootstrap
<wait a long time>
su
make install
3.2 and then use gcc 3.3.6 to build gcc 3.2.3
export PATH=/opt/gcc-3.3.6/bin:$PATH
export LD_LIBRARY_PATH=/opt/gcc-3.3.6/lib:$LD_LIBRARY_PATH
mkdir objdir
cd objdir
$srcdir/configure --prefix=/opt/gcc-3.2.3 # or wherever
make bootstrap
<wait a long time>
su
make install
3.3 now, compile your mex file, before compiling do
export PATH=/opt/gcc-3.2.3/bin:$PATH