lsl_archived icon indicating copy to clipboard operation
lsl_archived copied to clipboard

Undefined function 'lsl_resolve_all_' in Matlab Viewer

Open lauradvall opened this issue 8 years ago • 8 comments

Hello,

I have downloaded labstreaminglayer, installed dependencies, and added the liblsl-Matlab and the Apps/MATLABViewer to the Path. However, when I type "vis_stream", I get the following error:

Undefined function 'lsl_resolve_all_' for input arguments of type 'struct'.

Error in lsl_resolve_all (line 26) tmpresults = lsl_resolve_all_(lib,timeout);

Error in vis_stream>find_streams (line 221) streams = lsl_resolve_all(lib,0.3);

Error in vis_stream (line 77) streamnames = find_streams(lib);

The lsl_resolve_all_ is indeed in the mex folder.

Any suggestions?

lauradvall avatar Aug 07 '17 17:08 lauradvall

See readme.txt at https://github.com/sccn/labstreaminglayer/tree/master/LSL/liblsl-Matlab Especially note "The bin/ directory needs to contain an up-to-date build of the library file for your MATLAB version (e.g. liblsl64.dll for 64-bit MATLAB on Windows)."

mgrivich avatar Aug 07 '17 18:08 mgrivich

Thank you, yes I compiled the latest liblsl64.dylib according to https://github.com/sccn/labstreaminglayer/blob/master/LSL/liblsl/INSTALL and copied them in the /liblsl-Matlab/bin folder, but still getting the same error.

Any other suggestions?

lauradvall avatar Aug 07 '17 18:08 lauradvall

It is difficult to tell from here. Almost certainly it is a problem with files/functions not being in the path that you think are available. Here is a post that discusses issues like you are describing: https://www.mathworks.com/matlabcentral/newsreader/view_thread/328532.html? It may be helpful.

mgrivich avatar Aug 07 '17 18:08 mgrivich

I googled "not finding functions in the mex folder".

mgrivich avatar Aug 07 '17 18:08 mgrivich

On a Mac, you often can't fix a missing library problem just by copying it into a folder that happens to be on the path. You have to copy it into a folder where the executable will look, and where the library thinks it belongs. Start by doing otool -L on each of the mex files and on the dylib, then look into install_name_tool to fix the problem.

Please tell us which instructions you followed to build the dylib, where you got the mex files from (or if you compiled them yourself, which instructions you followed), and report the output of otool.

cboulay avatar Aug 07 '17 18:08 cboulay

Thank you both, I think I found the error, but could not fix it yet. I downloaded the dependencies by running "python get_deps.py" and this installed the .mexw64, .mexw64.md5, .mexa64 and .mexa64.md5 in the liblsl-Matlab/mex folder, but not the .mexmaci64 files, which is what is actually needed to run it from Matlab in MacOSx.

So the mex files need to be recompiled. I tried recompiling all of them myself (mex "file.c") but I got additional compilation errors and I was hoping there was an easier way to get them if somebody has already compiled them for Mac OSx.

Thanks,

lauradvall avatar Aug 07 '17 22:08 lauradvall

I found the .mexmaci64 files in the "liblsl-Matlab/mex/build-rolling" folder of the liblsl-Matlab-1.11 library in the ftp: ftp://sccn.ucsd.edu/pub/software/LSL/SDK/liblsl-Matlab-1.11.zip

Would be great if these mex files could be also included with the official dependencies that are downloaded with the get_deps.py script.

Thank you all for your help

lauradvall avatar Aug 08 '17 13:08 lauradvall

So the mex files need to be recompiled. I tried recompiling all of them myself (mex "file.c") but I got additional compilation errors and I was hoping there was an easier way to get them if somebody has already compiled them for Mac OSx.

Could you try the newly added build_mex.m?

tstenner avatar May 04 '18 09:05 tstenner