필터 지우기
필터 지우기

Mex compiling on 64 bit linux - /usr/bin/ld: cannot find -lstdc++

조회 수: 29 (최근 30일)
Wouter
Wouter 2013년 6월 8일
댓글: Joao Henriques 2014년 11월 17일
Okay I am trying to compile a mex file on 64 bit linux, ubuntu to be precise with Matlab 2013a.
First it gave a error that it could not find GLIBCXX_3.4.15. Which was not part of:
/usr/local/MATLAB/R2013a/sys/os/glnxa64/libstdc++.so.6.
ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17 libstdc++.so.6
in
/usr/local/MATLAB/R2013a/sys/os/glnxa64
Now I tried to compile again and now I get
/usr/bin/ld: cannot find -lstdc++
collect2: error: ld returned 1 exit status
This is the output
>> mex -v tload3.c
**************************************************************************
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/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html
**************************************************************************
-> mexopts.sh sourced from directory (DIR = $PREF_DIR)
FILE = /home/wouter/.matlab/R2013a/mexopts.sh
----------------------------------------------------------------
-> MATLAB = /usr/local/MATLAB/R2013a
-> CC = gcc
-> CC flags:
CFLAGS = -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread
CDEBUGFLAGS = -g
COPTIMFLAGS = -O -DNDEBUG
CLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++
arguments = -DMX_COMPAT_32
-> CXX = g++
-> CXX flags:
CXXFLAGS = -ansi -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O -DNDEBUG
CXXLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> FC = gfortran
-> FC flags:
FFLAGS = -fexceptions -fbackslash -fPIC -fno-omit-frame-pointer
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O
FLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> LD = gcc
-> Link flags:
LDFLAGS = -pthread -shared -Wl,--version-script,/usr/local/MATLAB/R2013a/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O
LDEXTENSION = .mexa64
arguments =
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments =
----------------------------------------------------------------
Warning: You are using gcc version "4.7.3". The version
currently supported with MEX is "4.4.x".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/
-> gcc -c -I/usr/local/MATLAB/R2013a/extern/include -I/usr/local/MATLAB/R2013a/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMX_COMPAT_32 -O -DNDEBUG "tload3.c"
-> gcc -O -pthread -shared -Wl,--version-script,/usr/local/MATLAB/R2013a/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -o "tload3.mexa64" tload3.o -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: error: ld returned 1 exit status
mex: link of ' "tload3.mexa64"' failed.
Error using mex (line 206) Unable to complete successfully. ps there is a another thread with about the same title, http://stackoverflow.com/questions/16219841/error-building-mex-files-matlab-2012a-on-kubuntu-usr-bin-ld-cannot-find-ls, unfortunatly the answer, installing sudo apt-get install libstdc++6-4.4-dev did not work for me.

답변 (1개)

Walter Roberson
Walter Roberson 2013년 6월 8일
You made the link in
/usr/local/MATLAB/R2013a/sys/os/glnxa64
but you do not reference that directory anywhere. Your CXXLIBS and the location you made the link should match.
  댓글 수: 2
Wouter
Wouter 2013년 6월 8일
Hmmm I do not understand what you mean by this. Can you clearify a bit further?
Joao Henriques
Joao Henriques 2014년 11월 17일
Thank you! It's quite easy to confuse 'sys/os/glnxa64' with 'bin/glnxa64'. The location reported by 'mex -v' must be exactly where the symlink is located.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB Compiler SDK에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by