필터 지우기
필터 지우기

Running mex files compiled on Linux

조회 수: 10 (최근 30일)
Bogdan Cristea Eugen
Bogdan Cristea Eugen 2012년 8월 30일
댓글: An Tran Lam 2014년 6월 2일
When I am running from MATLAB a mex file compiled from a cpp source file I get the following error:
Invalid MEX-file '/home/bogdan/C++/IT++/mex/test.mexa64': /usr/local/MATLAB/R2012a/bin/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/local/lib64/libitpp.so.8)
The solution seems to create soft links in MATLAB library folder to newer version of these libraries as provided by a particular Linux distribution (in my case openSUSE 12.1 x86_64).
My question is if this is the standard solution recommended by Mathworks? Are there any issues with this approach (should all libraries be updated to newer versions, since incompatibility issues might arise)?
  댓글 수: 1
An Tran Lam
An Tran Lam 2014년 6월 2일
I have same questions as you. Even I set LD_LIBRARY_PATH, it does no solve the problem. Does anyone know why LD_LIBRARY_PATH won't have the effect on Matlab.

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

답변 (2개)

Ken Atwell
Ken Atwell 2012년 8월 30일
Before soft-linking from the MATLAB folder, I would first try unsetting LD_LIBRARY_PATH within MATLAB
>> setenv('LD_LIBRARY_PATH', '')
There is, at least in theory, a possibility that MATLAB will crash because there will be two C++ libraries in memory, but it is worth a shot. Let us know how you make out.

Bogdan Cristea Eugen
Bogdan Cristea Eugen 2012년 8월 30일
Well, I am not sure what you mean by soft-linking. I have tried to run my mex file before and after I have used
setenv('LD_LIBRARY_PATH', '')
but I get the same error
Invalid MEX-file '/home/bogdan/C++/IT++/mex/test.mexa64': /usr/local/MATLAB/R2012a/bin/glnxa64/libstdc++.so.6:
version `GLIBCXX_3.4.15' not found (required by /usr/local/lib64/libitpp.so.8)
Even if, after running setenv(), I see that LD_LIBRARY_PATH is empty, it seems that MATLAB stores in some kind of cache the library path.
  댓글 수: 4
Friedrich
Friedrich 2012년 8월 31일
Since its a general System problem which happens with any compiled application (so not only mex files, also plain C files compiled outside of MATLAB) I doubt there is a MathWork specific solution. Its a general GCC Bug on Linux.
An Tran Lam
An Tran Lam 2014년 6월 2일
Even I set LD_LIBRARY_PATH, it does no solve the problem. Does anyone know why LD_LIBRARY_PATH won't have the effect on Matlab. Strange phenomenon is that why Matlab uses /usr/local/MATLAB/R2012a/bin/glnxa64/libstdc++.so.6 first. While in LD_LIBRARY_PATH it should be in the second. LD_LIBRARY_PATH=/usr/local/MATLAB/R2012a/sys/os/glnxa64:/usr/local/MATLAB/R2012a/bin/glnxa64

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

카테고리

Help CenterFile Exchange에서 Call C++ from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by