Prev: Big help for Histogram back-projection...
Next: NEED HELP: Convert logical true or false to double 1 or 0 values
From: Kimonas Fountoulakis on 17 Jul 2010 15:09 Hi I have a c program that makes some engine calls, I compile it by typing: mex -v -g -c exampleMtxFree.c and mex -g mtxFreeIPM.o exampleMtxFree.o -o hopdmcs -L ../../interface -linterface -L ../../hopdm -lhopdm -lm /usr/lib/libg2c.so.0 -lm ~/Desktop/matlab/bin/glnx86/libeng.so The above commands create the file hopdmcs.mexglx If I try to run the program from a terminal or through MATLAB command line by typing ../hopdmcs.mexglx I get a segmentation fault! The program doesn't even start, I tried to run it into a debugger to see what is going wrong, but even if a put a breakpoint on main function, it still gives me a segmentation fault. Any ideas pls? Thanks in advance!
From: Kimonas Fountoulakis on 17 Jul 2010 18:02 "Kimonas Fountoulakis" <kfoynt(a)hotmail.com> wrote in message <i1sv4f$lak$1(a)fred.mathworks.com>... > Hi > > I have a c program that makes some engine calls, I compile it by typing: > > mex -v -g -c exampleMtxFree.c > > and > mex -g mtxFreeIPM.o exampleMtxFree.o -o hopdmcs -L ../../interface -linterface -L ../../hopdm -lhopdm -lm /usr/lib/libg2c.so.0 -lm ~/Desktop/matlab/bin/glnx86/libeng.so > > The above commands create the file hopdmcs.mexglx > > If I try to run the program from a terminal or through MATLAB command line by typing > > ./hopdmcs.mexglx > > I get a segmentation fault! The program doesn't even start, I tried to run it into a debugger to see what is going wrong, but even if a put a breakpoint on main function, it still gives me a segmentation fault. > > Any ideas pls? > > Thanks in advance! -------------------------------------------------------- I also have to say that I tried to compile it through the terminal and I get: In file included from ../../../matlab/extern/include/engine.h:45, from exampleMtxFree.c:27: .../../../matlab/extern/include/matrix.h:303:22: error: tmwtypes.h: No such file or directory In file included from ../../../matlab/extern/include/engine.h:45, from exampleMtxFree.c:27: .../../../matlab/extern/include/matrix.h:318: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxLogical’ .../../../matlab/extern/include/matrix.h:330: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘char16_t’ .../../../matlab/extern/include/matrix.h:337: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxChar’ In file included from ../../../matlab/extern/include/engine.h:45, from exampleMtxFree.c:27: .../../../matlab/extern/include/matrix.h:504: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsNumeric’ .../../../matlab/extern/include/matrix.h:510: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsCell’ .../../../matlab/extern/include/matrix.h:516: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsLogical’ .../../../matlab/extern/include/matrix.h:522: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsChar’ .../../../matlab/extern/include/matrix.h:528: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsStruct’ .../../../matlab/extern/include/matrix.h:534: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsOpaque’ .../../../matlab/extern/include/matrix.h:540: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsFunctionHandle’ .../../../matlab/extern/include/matrix.h:548: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsObject’ .../../../matlab/extern/include/matrix.h:578: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsComplex’ .../../../matlab/extern/include/matrix.h:584: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsSparse’ .../../../matlab/extern/include/matrix.h:591: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsDouble’ .../../../matlab/extern/include/matrix.h:598: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsSingle’ .../../../matlab/extern/include/matrix.h:605: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsInt8’ .../../../matlab/extern/include/matrix.h:612: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsUint8’ .../../../matlab/extern/include/matrix.h:619: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsInt16’ .../../../matlab/extern/include/matrix.h:626: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsUint16’ .../../../matlab/extern/include/matrix.h:633: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsInt32’ .../../../matlab/extern/include/matrix.h:640: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsUint32’ .../../../matlab/extern/include/matrix.h:647: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsInt64’ .../../../matlab/extern/include/matrix.h:654: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsUint64’ .../../../matlab/extern/include/matrix.h:660: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxGetNumberOfDimensions’ .../../../matlab/extern/include/matrix.h:672: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token .../../../matlab/extern/include/matrix.h:730: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token .../../../matlab/extern/include/matrix.h:779: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsFromGlobalWS’ .../../../matlab/extern/include/matrix.h:785: error: expected declaration specifiers or ‘...’ before ‘bool’ .../../../matlab/extern/include/matrix.h:797: error: expected declaration specifiers or ‘...’ before ‘mwSize’ .../../../matlab/extern/include/matrix.h:809: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsEmpty’ .../../../matlab/extern/include/matrix.h:817: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token .../../../matlab/extern/include/matrix.h:823: error: expected declaration specifiers or ‘...’ before ‘mwIndex’ .../../../matlab/extern/include/matrix.h:829: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token .../../../matlab/extern/include/matrix.h:835: error: expected declaration specifiers or ‘...’ before ‘mwIndex’ .../../../matlab/extern/include/matrix.h:841: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxGetNzmax’ .../../../matlab/extern/include/matrix.h:847: error: expected declaration specifiers or ‘...’ before ‘mwSize’ .../../../matlab/extern/include/matrix.h:860: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxCalcSingleSubscript’ .../../../matlab/extern/include/matrix.h:874: error: expected declaration specifiers or ‘...’ before ‘mwIndex’ .../../../matlab/extern/include/matrix.h:880: error: expected declaration specifiers or ‘...’ before ‘mwIndex’ .../../../matlab/extern/include/matrix.h:899: error: expected declaration specifiers or ‘...’ before ‘mwIndex’ .../../../matlab/extern/include/matrix.h:905: error: expected declaration specifiers or ‘...’ before ‘mwIndex’ .../../../matlab/extern/include/matrix.h:913: error: expected declaration specifiers or ‘...’ before ‘mwIndex’ .../../../matlab/extern/include/matrix.h:920: error: expected declaration specifiers or ‘...’ before ‘mwIndex’ .../../../matlab/extern/include/matrix.h:930: error: expected declaration specifiers or ‘...’ before ‘mwIndex’ .../../../matlab/extern/include/matrix.h:938: error: expected declaration specifiers or ‘...’ before ‘mwIndex’ .../../../matlab/extern/include/matrix.h:950: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsClass’ .../../../matlab/extern/include/matrix.h:962: error: expected ‘)’ before ‘m’ .../../../matlab/extern/include/matrix.h:971: error: expected declaration specifiers or ‘...’ before ‘mwSize’ .../../../matlab/extern/include/matrix.h:978: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token .../../../matlab/extern/include/matrix.h:993: error: expected ‘)’ before ‘ndim’ .../../../matlab/extern/include/matrix.h:1000: error: expected ‘)’ before ‘ndim’ .../../../matlab/extern/include/matrix.h:1007: error: expected ‘)’ before ‘m’ .../../../matlab/extern/include/matrix.h:1013: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token .../../../matlab/extern/include/matrix.h:1019: error: expected ‘)’ before ‘ndim’ .../../../matlab/extern/include/matrix.h:1029: error: expected ‘)’ before ‘m’ .../../../matlab/extern/include/matrix.h:1038: error: expected ‘)’ before ‘value’ .../../../matlab/extern/include/matrix.h:1044: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsLogicalScalar’ .../../../matlab/extern/include/matrix.h:1050: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsLogicalScalarTrue’ .../../../matlab/extern/include/matrix.h:1066: error: expected ‘)’ before ‘m’ .../../../matlab/extern/include/matrix.h:1072: error: expected ‘)’ before ‘m’ .../../../matlab/extern/include/matrix.h:1080: error: expected declaration specifiers or ‘...’ before ‘mwSize’ .../../../matlab/extern/include/matrix.h:1091: error: expected declaration specifiers or ‘...’ before ‘mwSize’ .../../../matlab/extern/include/matrix.h:1107: error: expected declaration specifiers or ‘...’ before ‘mwSize’ .../../../matlab/extern/include/matrix.h:1120: error: expected ‘)’ before ‘m’ .../../../matlab/extern/include/matrix.h:1127: error: expected ‘)’ before ‘m’ .../../../matlab/extern/include/matrix.h:1134: error: expected ‘)’ before ‘ndim’ .../../../matlab/extern/include/matrix.h:1148: error: expected ‘)’ before ‘ndim’ .../../../matlab/extern/include/matrix.h:1212: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsFinite’ .../../../matlab/extern/include/matrix.h:1220: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsInf’ .../../../matlab/extern/include/matrix.h:1228: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mxIsNaN’ In file included from exampleMtxFree.c:27: .../../../matlab/extern/include/engine.h:76: error: expected declaration specifiers or ‘...’ before ‘bool’ .../../../matlab/extern/include/engine.h:85: error: expected declaration specifiers or ‘...’ before ‘bool’ I checked some errors like: the error: tmwtypes.h: and the file indeed exists into the directory!!
From: Kimonas Fountoulakis on 17 Jul 2010 19:33 An update!!! the commands that I used in matlab are: mex -g -c -f /home/kfoynt/Desktop/matlab/bin/engopts.sh exampleMtxFree.c and mex -v -g -f /home/kfoynt/Desktop/matlab/bin/engopts.sh mtxFreeIPM.o exampleMtxFree.o -o hopdmcs -L ../../interface -linterface -L ../../hopdm -lhopdm -lm /usr/lib/libg2c.so.0 -lm ~/Desktop/matlab/bin/glnx86/libeng.so it compiles successfully but when I type to the bash terminal: ../hopdmcs I get: ../hopdmcs: error while loading shared libraries: libeng.so: cannot open shared object file: No such file or directory any ideas again??
From: Kimonas Fountoulakis on 17 Jul 2010 21:48
Ok, I was able to make it work... but now I am getting: Can't start matlab engine!! Please help! :-) |