2014-07-24 1 views
0

그래서 mex를 사용하여이 코드를 컴파일하려고했습니다. 문제는 어떤 이유로 든 호환되지 않는 것입니다. lstdc++lpthreadlibm은 찾을 수 없습니다. 다음과 같다MEX 파일 컴파일 문제 (-lstdC++를 찾을 수 없음)

[email protected]:~/Applications/Matlab_2012a/bin$ ls /usr/lib32/ 
crt1.o libanl.so   libc_nonshared.a libg.a   libmcheck.a  libnss_files.so   libpthread.so   librt.so    libz.so.1 
crti.o libBrokenLocale.a libcrypt.a  libgcc_s.so.1  libm.so   libnss_hesiod.so  libquadmath.so.0  libstdc++.so.6  libz.so.1.2.3.4 
crtn.o libBrokenLocale.so libcrypt.so  libgomp.so.1  libnsl.a   libnss_nisplus.so  libquadmath.so.0.0.0 libstdc++.so.6.0.16 Mcrt1.o 
gconv  libbsd-compat.a  libc.so   libgomp.so.1.0.0 libnsl.so   libnss_nis.so   libresolv.a   libthread_db.so  Scrt1.o 
gcrt1.o libc.a    libdl.a   libieee.a   libnss_compat.so libpthread.a   libresolv.so   libutil.a 
libanl.a libcidn.so   libdl.so   libm.a   libnss_dns.so  libpthread_nonshared.a librt.a    libutil.so 

내가 잡 오전 오류 : 내 /usr/lib32 폴더는 다음과 같습니다

K>> make_csolve 

************************************************************************** 
    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/iggy/Applications/Matlab_2012a/bin/mex: 1: /home/iggy/Applications/Matlab_2012a/bin/util/oscheck.sh: /lib64/libc.so.6: not found 
/home/iggy/Applications/Matlab_2012a/bin/mex: 1: /home/iggy/Applications/Matlab_2012a/bin/util/oscheck.sh: /lib64/libc.so.6: not found 
-> mexopts.sh sourced from directory (DIR = $MATLAB/bin) 
    FILE = /home/iggy/Applications/Matlab_2012a/bin/mexopts.sh 
---------------------------------------------------------------- 
-> MATLAB    = /home/iggy/Applications/Matlab_2012a 
-> 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/iggy/Applications/Matlab_2012a/bin/glnxa64 -L/usr/lib32 -L/home/iggy/Applications/Matlab_2012a/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/iggy/Applications/Matlab_2012a/bin/glnxa64 -L/home/iggy/Applications/Matlab_2012a/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,/home/iggy/Applications/Matlab_2012a/bin/glnxa64 -L/home/iggy/Applications/Matlab_2012a/bin/glnxa64 -lmx -lmex -lmat -lm 
     arguments   = -DMX_COMPAT_32 
-> LD     = gcc-4.4 
-> Link flags: 
     LDFLAGS   = -pthread -shared -Wl,--version-script,/home/iggy/Applications/Matlab_2012a/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/iggy/Applications/Matlab_2012a/extern/include -I/home/iggy/Applications/Matlab_2012a/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMX_COMPAT_32 -O -DNDEBUG "csolve.c" 

-> gcc-4.4 -c -I/home/iggy/Applications/Matlab_2012a/extern/include -I/home/iggy/Applications/Matlab_2012a/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMX_COMPAT_32 -O -DNDEBUG "ldl.c" 

-> gcc-4.4 -c -I/home/iggy/Applications/Matlab_2012a/extern/include -I/home/iggy/Applications/Matlab_2012a/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMX_COMPAT_32 -O -DNDEBUG "matrix_support.c" 

-> gcc-4.4 -c -I/home/iggy/Applications/Matlab_2012a/extern/include -I/home/iggy/Applications/Matlab_2012a/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMX_COMPAT_32 -O -DNDEBUG "solver.c" 

-> gcc-4.4 -c -I/home/iggy/Applications/Matlab_2012a/extern/include -I/home/iggy/Applications/Matlab_2012a/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMX_COMPAT_32 -O -DNDEBUG "util.c" 

-> gcc-4.4 -O -pthread -shared -Wl,--version-script,/home/iggy/Applications/Matlab_2012a/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -o "csolve.mexa64" csolve.o ldl.o matrix_support.o solver.o util.o -Wl,-rpath-link,/home/iggy/Applications/Matlab_2012a/bin/glnxa64 -L/usr/lib32 -L/home/iggy/Applications/Matlab_2012a/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++ 

/usr/bin/ld: skipping incompatible /usr/lib32/libm.so when searching for -lm 
/usr/bin/ld: skipping incompatible /usr/lib32/libm.a when searching for -lm 
/usr/bin/ld: cannot find -lstdc++ 
/usr/bin/ld: skipping incompatible /usr/lib32/libpthread.so when searching for -lpthread 
/usr/bin/ld: skipping incompatible /usr/lib32/libpthread.a when searching for -lpthread 
collect2: ld returned 1 exit status 

    mex: link of ' "csolve.mexa64"' failed. 

Error using mex (line 206) 
Unable to complete successfully. 

Error in make_csolve (line 10) 
mex -v csolve.c ldl.c matrix_support.c solver.c util.c 

어떤 조언을 크게 우분투 12.04 오전 (주시면 감사하겠습니다 MATLAB R2012a를 실행하는 64 비트).

답변

0

/use/lib32의 라이브러리는 잘못된 아키텍처 (64 비트 대신 32 비트)이므로 호환되지 않습니다. 먼저 mex -setup을 다시 실행 해보십시오. 현재 설정에 glnxa64 폴더가 있기 때문에 당신이 64 비트 MATLAB (ver으로 확인)을 사용하고 있다고 가정합니다.

/홈 /이기의 예약/응용 프로그램/Matlab_2012a이/빈/MEX : 1 :/홈 /이기의 예약/응용 프로그램/Matlab_2012a이/빈/폴더의 유틸리티/oscheck

그러나, 실제 오류는 다음과 같은 것 같다 의 .sh : /lib64/libc.so.6 : oscheck.sh 때문에

을 찾을 수 없습니다 당신이 관리하고 libc의와 된 libstdc을 찾아 ++ 패키지로 이동해야 할 수도 있습니다, /lib64/libc.so.6을 찾는데 실패, 설치하고 다시 시도하십시오. 하지만 먼저 다른 폴더에있는 기존 libc.so.6에 대한 링크를 만드십시오. 우분투의 일반적인 위치는 다음과 같습니다.

64 비트 우분투 :

sudo ln -s /lib/x86_64-linux-gnu/libc.so.6 /lib64/libc.so.6 

32 비트 우분투 :

sudo ln -s /lib/i386-linux-gnu/libc.so.6 /lib/libc.so.6