MattiaMontanari / openGJK

Fast and reliable implementation of the Gilbert-Johnson-Keerthi (GJK) algorithm for C, C#, Go, Matlab and Python
https://www.mattiamontanari.com/opengjk/
GNU General Public License v3.0
135 stars 37 forks source link

Error Using mex - Matlab under Linux #33

Closed Amir-Zargar closed 1 year ago

Amir-Zargar commented 1 year ago

On Ubuntu 20.04.4 LTS and with gcc version 10.3.0 (Ubuntu 10.3.0-1ubuntu1~20.04).

mex(fullfile('openGJK.c'),... % Source of openGJK '-largeArrayDims', ... % Support large arrays optflug, ... % Compiler flag for debug/optimisation fullfile('-I','/home/amir/MATLAB/Gabriel/OpenGJK_Master/include'),... % Folder to header files '-outdir', pwd,... % Ouput directory for writing mex function '-output', 'openGJK',... % Name of ouput mex file '-DMATLAB_MEX_BUILD',... % Define variable for mex function in source files silflag ) % Silent/verbose flag /home/amir/MATLAB/Gabriel/OpenGJK_Master/openGJK.c: In function ‘mexFunction’: /home/amir/MATLAB/Gabriel/OpenGJK_Master/openGJK.c:733:13: warning: implicit declaration of function ‘mxCreategkFloatMatrix’; did you mean ‘mxCreateStructMatrix’? [-Wimplicit-function-declaration] 733 | plhs[0] = mxCreategkFloatMatrix(1, 1, mxREAL); | ^~~~~ | mxCreateStructMatrix /home/amir/MATLAB/Gabriel/OpenGJK_Master/openGJK.c:733:11: warning: assignment to ‘mxArray ’ {aka ‘struct mxArray_tag ’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion] 733 | plhs[0] = mxCreategkFloatMatrix(1, 1, mxREAL); | ^ /home/amir/MATLAB/Gabriel/OpenGJK_Master/openGJK.c:766:17: warning: implicit declaration of function ‘gjk’ [-Wimplicit-function-declaration] 766 | distance[0] = gjk(bd1, bd2, &s); | ^~~

Error using mex /usr/bin/ld: /tmp/mex_1491118059826_3560/openGJK.o: in function mexFunction': openGJK.c:(.text+0x3464): undefined reference tomxCreategkFloatMatrix' /usr/bin/ld: openGJK.c:(.text+0x355d): undefined reference to `gjk' collect2: error: ld returned 1 exit status

MattiaMontanari commented 1 year ago

@Amir-Zargar please clone the branch in #34 and let me know if it works. Thanks

Amir-Zargar commented 1 year ago

Hi,

I downloaded new codes and run it again which gave me the same error, as I posted in GitLab.

Thank you, Amir

From: Mattia Montanari @. Sent: October 18, 2022 4:28 PM To: MattiaMontanari/openGJK @.> Cc: Hajzargarbashi, Amir @.>; Mention @.> Subject: Re: [MattiaMontanari/openGJK] Error Using mex - Matlab under Linux (Issue #33)

Attention This email originated from outside of the NRC. Attention Ce courriel provient de l'extérieur du CNRC.

@Amir-Zargarhttps://github.com/Amir-Zargar please clone the branch in #34https://github.com/MattiaMontanari/openGJK/pull/34 and let me know if it works. Thanks

— Reply to this email directly, view it on GitHubhttps://github.com/MattiaMontanari/openGJK/issues/33#issuecomment-1282964624, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANJCXKXJ325JXRTYTWQ2RHLWD4B4HANCNFSM6AAAAAARHIOHOA. You are receiving this because you were mentioned.Message ID: @.**@.>>

Amir-Zargar commented 1 year ago

Thank you, problem solved. I have my mex file running on Matlab under Linux.