Skip to content

Commit f93ac23

Browse files
committed
fixup lib fetching on linux
1 parent 892f651 commit f93ac23

2 files changed

Lines changed: 14 additions & 20 deletions

File tree

build_mex.m

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,17 @@
22
% For Octave on Linux, you need the package liboctave-dev installed
33
% You also need the liblsl64 binary in the bin folder and a configured
44
% C compiler (mex -setup)
5-
binarypath = fullfile(fileparts(mfilename('fullpath')), 'bin');
6-
if ispc
7-
if exist(fullfile(binarypath, 'liblsl64.lib'), 'file')
8-
libs = {'-llsl64'};
9-
elseif exist(fullfile(binarypath, 'lsl.lib'), 'file')
10-
libs = {'-llsl'};
11-
else
12-
error('Neither liblsl64.lib nor lsl.lib found in bin/');
13-
end
14-
elseif ismac
15-
if exist(fullfile(binarypath, 'liblsl64.dylib'), 'file')
16-
libs = {'-llsl64'};
17-
elseif exist(fullfile(binarypath, 'liblsl.dylib'), 'file')
18-
libs = {'-llsl'};
19-
end
20-
elseif isunix
21-
libs = {'-llsl64','-ldl'};
5+
libs = {};
6+
lsl_fname = lsl_get_dll();
7+
if contains(lsl_fname, '32')
8+
libs{end+1} = '-llsl32';
9+
elseif contains(lsl_fname, '64')
10+
libs{end+1} = '-llsl64';
2211
else
23-
libs = {'-llsl64'};
12+
libs{end+1} = '-llsl';
13+
end
14+
if isunix
15+
libs{end+1} = '-ldl';
2416
end
2517

2618
ext = ['.' mexext];

lsl_get_dll.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
new_sopath = fullfile(binarypath, 'lsl.dll');
4949
elseif ismac && exist(fullfile(binarypath, 'liblsl.dylib'), 'file')
5050
new_sopath = fullfile(binarypath, 'liblsl.dylib');
51+
elseif exist('/usr/lib/liblsl.so', 'file')
52+
new_sopath = fullfile('/usr/lib/liblsl.so');
5153
else
5254
new_sopath = fullfile('/usr/lib/', so_fname);
5355
end
@@ -92,8 +94,8 @@
9294
[~, lib_ix] = min(cellfun(@length, {dylib_list.name}));
9395
lsl_fname = fullfile(dylib_list(lib_ix).folder, dylib_list(lib_ix).name);
9496
elseif isunix
95-
error(['Automatic extraction of debian package not yet supported.', ...
96-
' Please install manually: ' fullfile(binarypath, liblsl_url_fname)]);
97+
error(['liblsl debian package must be installed manually:', ...
98+
' sudo dpkg -i ' fullfile(binarypath, liblsl_url_fname)]);
9799
end
98100
end
99101

0 commit comments

Comments
 (0)