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

93 views (last 30 days)
Upon giving the following command from Matlab command prompt, I get this error:
>>[status, result] = system('./testGEA outDataTest1.txt')
status =
result =
./testGEA: symbol lookup error: /home/swagatika/softwares/qvision.0.8.0/lib/ undefined symbol: _ZN12QApplication10commitDataER15QSessionManager
testGEA is an executable file compiled using Qvision library (link :
I can successfully execute the command from Linux(ubuntu 10.10) terminal, but calling from Matlab fails.
Please help.

Accepted Answer

Walter Roberson
Walter Roberson on 25 Feb 2012
Possibly a badly linked library
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.
Swagatika on 26 Feb 2012
I also used nm which gives U which means that the symbol is undefined.
$ nm -D /home/swagatika/softwares/qvision.0.8.0/lib/ | grep _ZN12QApplication10commitDataER15QSessionManager
U _ZN12QApplication10commitDataER15QSessionManager

Sign in to comment.

More Answers (4)

Swagatika on 1 Mar 2012
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/ | grep _ZN12QApplication10commitDataER15QSessionManager0012d1f0 T _ZN12QApplication10commitDataER15QSessionManager
nm -D /usr/lib/ | grep _ZN12QApplication10commitDataER15QSessionManager U _ZN12QApplication10commitDataER15QSessionManager
So the symbol is defined in /usr/lib/, and is in undefined state in /usr/lib/
When I checked in Matlab (!ldd ./testGEA), was being linked from another path ~/softwares/matlab/bin/glnx86/, and it did not have the symbol. So Matlab was searching for the symbol in another library where it was present in in "Undefined" state and throwing error. So the solution was to delete from ~/softwares/matlab/bin/glnx86/. And now, was taken from path /usr/lib/ where the symbol was present. And it got solved!!
Thanks for your help...
Regards, Swagatika

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

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

Swagatika on 29 Feb 2012
doing ldd in testGEA in terminal and in matlab gives different results:
from terminal:
:~/softwares/qvision.0.8.0/examples/testGEA$ ldd testGEA => (0x0097a000) => /usr/lib/ (0x00179000) => /usr/lib/ (0x00110000) => /home/swagatika/softwares/qvision.0.8.0/lib/ (0x00464000) => /usr/lib/ (0x00366000) => /usr/lib/ (0x00687000) => /usr/lib/ (0x0097b000) => /usr/lib/ (0x028ed000) => /usr/lib/ (0x003a9000) => /usr/lib/mesa/ (0x0076b000) => /lib/ (0x00419000) => /usr/lib/ (0x007be000) => /lib/ (0x00433000) => /lib/ (0x008a9000) => /lib/ (0x03ae2000) => /usr/lib/ (0x008c5000) => /lib/ (0x00143000) => /usr/lib/ (0x00147000) => /usr/lib/ (0x118b3000) => /usr/lib/ (0x1d05e000) => /usr/lib/ (0x0093c000) => /usr/lib/ (0x1cd51000) => /lib/ (0x1ed67000) => /lib/ (0x11c21000) => /lib/ (0x0cd57000) => /usr/lib/ (0x0d78a000) => /usr/lib/ (0x00151000) => /usr/lib/ (0x090b1000) => /usr/lib/ (0x018ae000) => /usr/lib/ (0x00459000) => /lib/ (0x0096c000) => /usr/lib/ (0x0045e000) => /usr/lib/ (0x07344000) => /usr/lib/ (0x0c79c000) => /lib/ (0x086c2000)
/lib/ (0x0015b000) => /usr/lib/ (0x1be8a000) => /lib/ (0x120bf000) => /usr/lib/ (0x15f63000) => /usr/lib/ (0x00975000) => /lib/ (0x17efe000) => /lib/ (0x04b66000) => /usr/lib/ (0x0c617000)
from matlab:
!ldd testGEA => (0x00df9000) => /usr/lib/ (0x002e9000) => /usr/lib/ (0x00110000) => /home/swagatika/softwares/qvision.0.8.0/lib/ (0x006c4000) => /home/swagatika/softwares/matlab/bin/glnx86/ (0x00e27000) => /home/swagatika/softwares/matlab/bin/glnx86/ (0x00143000) => /home/swagatika/softwares/matlab/bin/glnx86/ (0x00e6a000) => /home/swagatika/softwares/matlab/bin/glnx86/ (0x00909000) => /usr/lib/ (0x004d8000) => /usr/lib/mesa/ (0x001b6000) => /lib/ (0x00209000) => /home/swagatika/softwares/matlab/sys/os/glnx86/ (0x00548000) => /lib/ (0x00d18000) => /home/swagatika/softwares/matlab/sys/os/glnx86/ (0x00223000) => /lib/ (0x00b1c000) => /lib/ (0x0022e000) => /lib/ (0x00243000) => /lib/ (0x0024c000) => /usr/lib/ (0x00de5000) => /home/swagatika/softwares/matlab/bin/glnx86/ (0x00250000) => /usr/lib/ (0x00d7c000) => /usr/lib/ (0x002ce000) => /usr/lib/ (0x1f3b4000) => /usr/lib/ (0x0064f000) => /usr/lib/ (0x002de000) => /usr/lib/ (0x00631000) => /lib/ (0x00637000)
/lib/ (0x008eb000) => /home/swagatika/softwares/matlab/bin/glnx86/ (0x00653000) => /usr/lib/ (0x0067e000) => /usr/lib/ (0x002e4000) => /usr/lib/ (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 is taken from its actual path.
I created a soft link for the same in /usr/lib. still the same error comes
  1 Comment
Swagatika on 29 Feb 2012
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: cannot open shared object file: No such file or directory

Sign in to comment.


Find more on Programming Utilities in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!