symbol lookup error: undefined symbol , upon calling C executable from matlab using system command

조회 수: 28 (최근 30일)
Upon giving the following command from Matlab command prompt, I get this error:
>>[status, result] = system('./testGEA outDataTest1.txt')
status =
127
result =
./testGEA: symbol lookup error: /home/swagatika/softwares/qvision.0.8.0/lib/libqvision.so.0: undefined symbol: _ZN12QApplication10commitDataER15QSessionManager
testGEA is an executable file compiled using Qvision library (link : http://qvision.sourceforge.net/testGEA_8cpp.html)
I can successfully execute the command from Linux(ubuntu 10.10) terminal, but calling from Matlab fails.
Please help.
Thanks.

채택된 답변

Walter Roberson
Walter Roberson 2012년 2월 25일
Possibly a badly linked library http://nrcw.com/?p=546
The symbol might be defined in a library that does not happen to be on the LD_LIBRARY_PATH that is used by MATLAB.
The script that starts MATLAB often sets up LD_LIBRARY_PATH
You could probably use "ldd" to track down which library is supplying the symbol when you execute from the terminal.
  댓글 수: 2
Swagatika
Swagatika 2012년 2월 26일
Hi,
ldd gives the following:
~/softwares/qvision.0.8.0/lib$ ldd libqvision.so.0
linux-gate.so.1 => (0x00363000)
libgsl.so.0 => /usr/lib/libgsl.so.0 (0x007b6000)
libgslcblas.so.0 => /usr/lib/libgslcblas.so.0 (0x001d0000)
libQtXml.so.4 => /usr/lib/libQtXml.so.4 (0x005cf000)
libQtOpenGL.so.4 => /usr/lib/libQtOpenGL.so.4 (0x00a0a000)
libQtGui.so.4 => /usr/lib/libQtGui.so.4 (0x00fa4000)
libQtCore.so.4 => /usr/lib/libQtCore.so.4 (0x061b1000)
libGLU.so.1 => /usr/lib/libGLU.so.1 (0x00110000)
libGL.so.1 => /usr/lib/mesa/libGL.so.1 (0x00203000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00180000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00c38000)
libm.so.6 => /lib/libm.so.6 (0x0019a000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00256000)
libc.so.6 => /lib/libc.so.6 (0x00612000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00272000)
libdl.so.2 => /lib/libdl.so.2 (0x001c0000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00af6000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00364000)
libQtDBus.so.4 => /usr/lib/libQtDBus.so.4 (0x004c0000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x002e9000)
libaudio.so.2 => /usr/lib/libaudio.so.2 (0x00319000)
libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00b00000)
libpng12.so.0 => /lib/libpng12.so.0 (0x00330000)
libz.so.1 => /lib/libz.so.1 (0x00481000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x0053b000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x001c4000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x0057e000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00597000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00355000)
librt.so.1 => /lib/librt.so.1 (0x0035a000)
libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0x00496000)
libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x0049a000)
libXxf86vm.so.1 => /usr/lib/libXxf86vm.so.1 (0x005a7000)
libdrm.so.2 => /lib/libdrm.so.2 (0x005ad000)
/lib/ld-linux.so.2 (0x004a2000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x0076f000)
libexpat.so.1 => /lib/libexpat.so.1 (0x00789000)
libXt.so.6 => /usr/lib/libXt.so.6 (0x009a3000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x005b7000)
libpcre.so.3 => /lib/libpcre.so.3 (0x00bcf000)
libuuid.so.1 => /lib/libuuid.so.1 (0x005bb000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x005c0000)
I have no clue what to do next. Please guide me.
Thanks for the link , but I have installed, qvision: http://sourceforge.net/projects/qvision/files/QVision%200.8.0/
So I am not sure if downloading entire package will help me : qt-all-opensource-src-4.5.3.tar.gz
Thanks again!
Swagatika
Swagatika 2012년 2월 26일
I also used nm which gives U which means that the symbol is undefined.
$ nm -D /home/swagatika/softwares/qvision.0.8.0/lib/libqvision.so.0 | grep _ZN12QApplication10commitDataER15QSessionManager
U _ZN12QApplication10commitDataER15QSessionManager

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

추가 답변 (4개)

Swagatika
Swagatika 2012년 3월 1일
Hi,
I could sort out the issue. I found out that doing ldd in testGEA in terminal and in matlab gives different results:
So, there were some libararies which were being linked from different paths for the 2 cases(terminal and matlab). That means the symbol ZN12QApplication10commitDataER15QSessionManager was being defined in one of the libaries being linked when you used terminal, but was undefined in the same library ( but different path) in matlab.
so I did nm for each of the path that ldd showed : and I found: $ nm -D /usr/lib/libQtGui.so.4 | grep _ZN12QApplication10commitDataER15QSessionManager0012d1f0 T _ZN12QApplication10commitDataER15QSessionManager
nm -D /usr/lib/libqvision.so.0 | grep _ZN12QApplication10commitDataER15QSessionManager U _ZN12QApplication10commitDataER15QSessionManager
So the symbol is defined in /usr/lib/libQtGui.so.4, and is in undefined state in /usr/lib/libqvision.so.0.
When I checked in Matlab (!ldd ./testGEA), libQtGui.so.4 was being linked from another path ~/softwares/matlab/bin/glnx86/libQtGui.so.4, and it did not have the symbol. So Matlab was searching for the symbol in another library where it was present in libqvision.so.0 in "Undefined" state and throwing error. So the solution was to delete libQtGui.so.4 from ~/softwares/matlab/bin/glnx86/. And now, libQtGui.so.4 was taken from path /usr/lib/ where the symbol was present. And it got solved!!
Thanks for your help...
Regards, Swagatika

Swagatika
Swagatika 2012년 2월 28일
I also tried installing the package qt-all-opensource-src-4.5.3.tar.gz, but this did not help me :(

Swagatika
Swagatika 2012년 2월 29일
Hey, I get the following, can this provide any clue in some way?
~/softwares/qvision.0.8.0/examples/testGEA$ nm -D /usr/lib/libQtGui.so.4 | grep _ZN12QApplication10commitDataER15QSessionManager 0012d1f0 T _ZN12QApplication10commitDataER15QSessionManager

Swagatika
Swagatika 2012년 2월 29일
doing ldd in testGEA in terminal and in matlab gives different results:
from terminal:
:~/softwares/qvision.0.8.0/examples/testGEA$ ldd testGEA
linux-gate.so.1 => (0x0097a000)
libgsl.so.0 => /usr/lib/libgsl.so.0 (0x00179000)
libgslcblas.so.0 => /usr/lib/libgslcblas.so.0 (0x00110000)
libqvision.so.0 => /home/swagatika/softwares/qvision.0.8.0/lib/libqvision.so.0 (0x00464000)
libQtXml.so.4 => /usr/lib/libQtXml.so.4 (0x00366000)
libQtOpenGL.so.4 => /usr/lib/libQtOpenGL.so.4 (0x00687000)
libQtGui.so.4 => /usr/lib/libQtGui.so.4 (0x0097b000)
libQtCore.so.4 => /usr/lib/libQtCore.so.4 (0x028ed000)
libGLU.so.1 => /usr/lib/libGLU.so.1 (0x003a9000)
libGL.so.1 => /usr/lib/mesa/libGL.so.1 (0x0076b000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00419000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x007be000)
libm.so.6 => /lib/libm.so.6 (0x00433000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x008a9000)
libc.so.6 => /lib/libc.so.6 (0x03ae2000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x008c5000)
libdl.so.2 => /lib/libdl.so.2 (0x00143000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00147000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x118b3000)
libQtDBus.so.4 => /usr/lib/libQtDBus.so.4 (0x1d05e000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x0093c000)
libaudio.so.2 => /usr/lib/libaudio.so.2 (0x1cd51000)
libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x1ed67000)
libpng12.so.0 => /lib/libpng12.so.0 (0x11c21000)
libz.so.1 => /lib/libz.so.1 (0x0cd57000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x0d78a000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x00151000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x090b1000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x018ae000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00459000)
librt.so.1 => /lib/librt.so.1 (0x0096c000)
libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0x0045e000)
libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x07344000)
libXxf86vm.so.1 => /usr/lib/libXxf86vm.so.1 (0x0c79c000)
libdrm.so.2 => /lib/libdrm.so.2 (0x086c2000)
/lib/ld-linux.so.2 (0x0015b000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x1be8a000)
libexpat.so.1 => /lib/libexpat.so.1 (0x120bf000)
libXt.so.6 => /usr/lib/libXt.so.6 (0x15f63000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00975000)
libpcre.so.3 => /lib/libpcre.so.3 (0x17efe000)
libuuid.so.1 => /lib/libuuid.so.1 (0x04b66000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x0c617000)
from matlab:
!ldd testGEA
linux-gate.so.1 => (0x00df9000)
libgsl.so.0 => /usr/lib/libgsl.so.0 (0x002e9000)
libgslcblas.so.0 => /usr/lib/libgslcblas.so.0 (0x00110000)
libqvision.so.0 => /home/swagatika/softwares/qvision.0.8.0/lib/libqvision.so.0 (0x006c4000)
libQtXml.so.4 => /home/swagatika/softwares/matlab/bin/glnx86/libQtXml.so.4 (0x00e27000)
libQtOpenGL.so.4 => /home/swagatika/softwares/matlab/bin/glnx86/libQtOpenGL.so.4 (0x00143000)
libQtGui.so.4 => /home/swagatika/softwares/matlab/bin/glnx86/libQtGui.so.4 (0x00e6a000)
libQtCore.so.4 => /home/swagatika/softwares/matlab/bin/glnx86/libQtCore.so.4 (0x00909000)
libGLU.so.1 => /usr/lib/libGLU.so.1 (0x004d8000)
libGL.so.1 => /usr/lib/mesa/libGL.so.1 (0x001b6000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00209000)
libstdc++.so.6 => /home/swagatika/softwares/matlab/sys/os/glnx86/libstdc++.so.6 (0x00548000)
libm.so.6 => /lib/libm.so.6 (0x00d18000)
libgcc_s.so.1 => /home/swagatika/softwares/matlab/sys/os/glnx86/libgcc_s.so.1 (0x00223000)
libc.so.6 => /lib/libc.so.6 (0x00b1c000)
libz.so.1 => /lib/libz.so.1 (0x0022e000)
librt.so.1 => /lib/librt.so.1 (0x00243000)
libdl.so.2 => /lib/libdl.so.2 (0x0024c000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00de5000)
libfreetype.so.6 => /home/swagatika/softwares/matlab/bin/glnx86/libfreetype.so.6 (0x00250000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00d7c000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x002ce000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x1f3b4000)
libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0x0064f000)
libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x002de000)
libXxf86vm.so.1 => /usr/lib/libXxf86vm.so.1 (0x00631000)
libdrm.so.2 => /lib/libdrm.so.2 (0x00637000)
/lib/ld-linux.so.2 (0x008eb000)
libexpat.so.1 => /home/swagatika/softwares/matlab/bin/glnx86/libexpat.so.1 (0x00653000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x0067e000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x002e4000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00641000)
Matlab takes many shared libraries from its own path matlab/bin/glnx86/ which are otherwise taken from /usr/lib if we check at terminal. But qvision.so.0 is taken from its actual path.
I created a soft link for the same in /usr/lib. still the same error comes
  댓글 수: 1
Swagatika
Swagatika 2012년 2월 29일
I tried running the executable in another system and I got the following error:
/Desktop/try$ ./testGEA_API0 problem-138-19878-pre.txt
./testGEA_API0: error while loading shared libraries: libqvision.so.0: cannot open shared object file: No such file or directory

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

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by