在64位Linux上进行Mex编译-/usr/bin/ld:找不到-lstdc ++ [英] Mex compiling on 64 bit linux - /usr/bin/ld: cannot find -lstdc++
问题描述
好吧,我正在尝试在64位linux上编译一个mex文件,确切地说,是用Matlab 2013a编译的ubuntu.
Okay I am trying to compile a mex file on 64 bit linux, ubuntu to be precise with Matlab 2013a.
首先,它给出一个错误,它找不到GLIBCXX_3.4.15
.这不属于
/usr/local/MATLAB/R2013a/sys/os/glnxa64/libstdc++.so.6
.我发现此线程/usr/lib /libstdc++.so.6:找不到版本"GLIBCXX_3.4.15" ,并成功在/usr/local/MATLAB/R2013a/sys/os/glnxa64
First it gave a error that it could not find GLIBCXX_3.4.15
. Which was not part of the
/usr/local/MATLAB/R2013a/sys/os/glnxa64/libstdc++.so.6
. I found this thread /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found and succesfully created a symbolic link ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17 libstdc++.so.6
in /usr/local/MATLAB/R2013a/sys/os/glnxa64
现在我尝试再次编译,现在我得到/usr/bin/ld: cannot find -lstdc++
collect2: error: ld returned 1 exit status
Now I tried to compile again and now I get /usr/bin/ld: cannot find -lstdc++
collect2: error: ld returned 1 exit status
这是输出
>> 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, Error building MEX-files (MATLAB 2012a) on Kubuntu '/usr/bin/ld: cannot find -lstdc++', unfortunatly the answer, installing sudo apt-get install libstdc++6-4.4-dev
did not work for me.
推荐答案
我遇到了同样的问题,并且对我有用
I had the same problem and this worked for me
导航到以下路径cd /usr/local/MATLAB/R2013a/sys/os/glnxa64/
(您的路径可能会有所不同),然后删除libstdc库(或更安全的重命名它)
Navigate to the following path cd /usr/local/MATLAB/R2013a/sys/os/glnxa64/
, (your path might varies) then remove the libstdc library (or safer rename it)
sudo mv libstdc++.so.6 libstdc++.so.6.old
我具有相同的配置,使用Matlab 2013a的Ubuntu Linux 64位
I have the same configuration, Ubuntu Linux 64 bit with Matlab 2013a
这篇关于在64位Linux上进行Mex编译-/usr/bin/ld:找不到-lstdc ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!