I'm trying to build a C program on Matlab 2012a, through the command:
mex mat_trans2.c
And I'm getting this error:
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
mex: link of ' "mat_trans2.mexa64"' failed.
Error using mex (line 206)
Unable to complete successfully.
Some time ago I was able to build .c files, I don't know what is happening now! Maybe something has changed after a system upgrade on my Kubuntu 12.04 64 bit.
Is there someone who know how to solve this?
Thank you!!!!
Edit: I edit the message to reply at Shai. Running:
mex -v mat_trans2.c
I get:
**************************************************************************
Warning: Neither -compatibleArrayDims nor -largeArrayDims is selected.
Using -compatibleArrayDims. In the future, MATLAB will require
the use of -largeArrayDims and remove the -compatibleArrayDims
option. For more information, see:
http://www.mathworks.com/help/techdoc/matlab_external/bsflnue-1.html
**************************************************************************
/home/mafalda/MATLAB/bin/mex: 1: /home/mafalda/MATLAB/bin/util/oscheck.sh: /lib64/libc.so.6: not found
/home/mafalda/MATLAB/bin/mex: 1: /home/mafalda/MATLAB/bin/util/oscheck.sh: /lib64/libc.so.6: not found
-> mexopts.sh sourced from directory (DIR = $PREF_DIR)
FILE = /home/mafalda/.matlab/R2012a/mexopts.sh
----------------------------------------------------------------
-> MATLAB = /home/mafalda/MATLAB
-> CC = gcc-4.4
-> CC flags:
CFLAGS = -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread
CDEBUGFLAGS = -g
COPTIMFLAGS = -O -DNDEBUG
CLIBS = -Wl,-rpath-link,/home/mafalda/MATLAB/bin/glnxa64 -L/home/mafalda/MATLAB/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++
arguments = -DMX_COMPAT_32
-> CXX = g++-4.4
-> CXX flags:
CXXFLAGS = -ansi -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O -DNDEBUG
CXXLIBS = -Wl,-rpath-link,/home/mafalda/MATLAB/bin/glnxa64 -L/home/mafalda/MATLAB/bin/glnxa64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> FC = gfortran-4.4
-> FC flags:
FFLAGS = -fexceptions -fbackslash -fPIC -fno-omit-frame-pointer
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O
FLIBS = -Wl,-rpath-link,/home/mafalda/MATLAB/bin/glnxa64 -L/home/mafalda/MATLAB/bin/glnxa64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> LD = gcc-4.4
-> Link flags:
LDFLAGS = -pthread -shared -Wl,--version-script,/home/mafalda/MATLAB/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O
LDEXTENSION = .mexa64
arguments =
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments =
----------------------------------------------------------------
-> gcc-4.4 -c -I/home/mafalda/MATLAB/extern/include -I/home/mafalda/MATLAB/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMX_COMPAT_32 -O -DNDEBUG "mat_trans2.c"
-> gcc-4.4 -O -pthread -shared -Wl,--version-script,/home/mafalda/MATLAB/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -o "mat_trans2.mexa64" mat_trans2.o -Wl,-rpath-link,/home/mafalda/MATLAB/bin/glnxa64 -L/home/mafalda/MATLAB/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
mex: link of ' "mat_trans2.mexa64"' failed.
Error using mex (line 206)
Unable to complete successfully.
I would say the problem is that /lib64/libc.so.6: cannot be found
Plus:
locate libstdc++.so.6
/home/mafalda/MATLAB/bin/glnxa64/libstdc++.so.6
/home/mafalda/MATLAB/bin/glnxa64/libstdc++.so.6.0.13
/home/mafalda/MATLAB/sys/os/glnxa64/libstdc++.so.6
/home/mafalda/MATLAB/sys/os/glnxa64/libstdc++.so.6.0.16
/home/mafalda/MATLAB/toolbox/edalink/foundation/hdllink/scripts/linux32/libstdc++.so.6
/home/mafalda/MATLAB/toolbox/edalink/foundation/hdllink/scripts/linux32/libstdc++.so.6.0.13
/home/mafalda/MATLAB/toolbox/sldv/sldv/polyspace-dvo/lib/x86-linux/libstdc++.so.6
/usr/lib/i386-linux-gnu/libstdc++.so.6
/usr/lib/i386-linux-gnu/libstdc++.so.6.0.16
/usr/lib/x86_64-linux-gnu/libstdc++.so.6
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16
/usr/lib32/libstdc++.so.6
/usr/lib32/libstdc++.so.6.0.16