パスを通すための関数がエラーを出してしまう

10 ビュー (過去 30 日間)
tomoki takeuchi
tomoki takeuchi 2019 年 11 月 28 日
回答済み: tomoki takeuchi 2019 年 12 月 9 日
どうしても分からなかったため質問失礼します。
LSL環境を使うためのmファイルなのですが実行するとエラーを出してしまいます。
以下が実行したいプログラムになります
function hlib = lsl_loadlib(binarypath,debugging,keep_persistent)
% Load the lab streaming layer library.
% [LibHandle] = lsl_loadlib(BinaryPath,DebugVersion)
%
% This operation loads the library, after which its functions (starting with lsl_) can be used.
%
% In:
% BinaryPath : Optionally the path to the locations of the liblsl bin folder (default: relative
% to this .m file).
%
% DebugVersion : Optionally load the debug version of the library (default: false)
%
% Persistent : keep the library handle around until shutdown (default: true)
%
% Out:
% Handle : handle to the library
% when the handle is deleted, the library will be unloaded
%
% Notes:
% Do not delete this handle while you still have LSL objects (streaminfos, inlets, outlets)
% alive.
%
% Christian Kothe, Swartz Center for Computational Neuroscience, UCSD
% 2012-03-05
if ~exist('binarypath','var') || isempty(binarypath)
binarypath = [fileparts(mfilename('fullpath')) filesep 'bin']; end
if ~exist('debugging','var') || isempty(debugging)
debugging = false; end
if ~exist('keep_persistent','var') || isempty(keep_persistent)
keep_persistent = true; end
persistent lib;
if keep_persistent && ~isempty(lib)
hlib = lib;
else
if ispc
ext = '.dll';
elseif ismac
ext = '.dylib';
elseif isunix
ext = '.so';
else
error('Your operating system is not supported by this version of the lab streaming layer API.');
end
if strfind(computer,'64')
bitness = '64';
else
bitness = '32';
end
if debugging
debug = '-debug';
else
debug = '';
end
dllpath = [binarypath filesep 'liblsl' bitness debug ext];
if ~exist(dllpath,'file')
error(['Apparently the file "' dllpath '" is missing on your computer. Cannot load the lab streaming layer.']); end
% open the library and make sure that it gets auto-deleted when the handle is erased
try
hlib = lsl_loadlib_(dllpath);
catch e
disp('See https://github.com/labstreaminglayer/liblsl-Matlab/#troubleshooting for troubleshooting tips');
error(['Error loading the liblsl library: ', e.message]);
end
hlib.on_cleanup = onCleanup(@()lsl_freelib_(hlib));
if keep_persistent
lib = hlib; end
end
こちらがエラー文です。
エラー: lsl_loadlib (line 69)
Error loading the liblsl library: 関数 'lsl_loadlib_' (タイプ'char' の入力引数) が未定義です。
またこのエラーが起こった際に実行するべきmファイルがあったのですがこちらもエラーを出してしまいました。
こちらがmexを用いて行われておりこの関数の指定している物がよく分かっておりません。
% Build mex bindings
% For Octave on Linux, you need the package liboctave-dev installed
% You also need the liblsl64 binary in the bin folder and a configured
% C compiler (mex -setup)
libs = {'-llsl64'};
if ispc
dllext = 'dll';
elseif ismac
dllext = 'dylib';
elseif isunix
dllext = 'so';
libs = {'-llsl64','-ldl'};
end
if isempty(dir(['bin/liblsl64.', dllext]))
error(['liblsl64.' dllext ' not found in bin/']);
end
ext = ['.' mexext];
files = dir('mex/*.c');
cd('bin');
for i = 1:length(files)
f = files(i);
[~, base, ~] = fileparts(f.name);
targetstats = dir([base, ext]);
if isempty(targetstats) || f.datenum > targetstats.datenum
mex('-I../../liblsl/include','-L.', libs{:}, ['../mex/', f.name]);
else
disp([base, ext, ' up to date']);
end
end
if ismac
system('install_name_tool -add_rpath "@loader_path/" lsl_loadlib_.mexmaci64')
end
cd('..');
エラー文がこちらです
>> build_mex
エラー: mex
MEX は -l オプションで指定されたライブラリ 'lsl64' を見つけることができません。
MEX は、名前が次のいずれかであるファイルを検索しました:
liblsl64.lib
lsl64.lib
ライブラリ名が正しいことを確認してください。ライブラリが既存のパスに
存在しない場合、-L オプションでパスを指定してください。
エラー: build_mex (line 30)
mex('-I../../liblsl/include','-L.', libs{:}, ['../mex/', f.name]);
解決方法かもしくはエラー文の原因に推測されるものを教えてください。
よろしくお願いします。

回答 (2 件)

Etsuo Maeda
Etsuo Maeda 2019 年 12 月 2 日
回答がついていないようなので・・・
LSL環境なるものが何かわかりませんが、ご自身で書いたコードではないのであれば、まずは作成者に確認すべきかと。
自力でなんとかするなら、
mex('-I../../liblsl/include','-L.', libs{:}, ['../mex/', f.name]);
の出力文字列が何になっているのか、ブレークポイントを置くなどして確認してみてはどうでしょうか。
おそらくは -L オプションでliblsl64.lib とか liblsl64.dll という名前のバイナリを追加するようになっているはずです。
% You also need the liblsl64 binary in the bin folder and a configured
% C compiler (mex -setup)
と書いてあるとおり、binフォルダなる場所に置く用のバイナリを作成者が頒布しているはずです。
作成者の示す通りにファイル群をおけば、当初のエラーであるlsl_loadlib_.mex/ lsl_loadlib_.mexmaci64が見つからないというエラーは解消されるはずです。
HTH

tomoki takeuchi
tomoki takeuchi 2019 年 12 月 9 日
返信遅くなってしまい申し訳ありません
現在回答待ちです。
回答が出次第こちらに追記します。

カテゴリ

Help Center および File ExchangeC MEX ファイル アプリケーション についてさらに検索

タグ

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!