MATLAB Answers

Why report “/usr/loca​l/lib/MatL​abLib/myma​tlab.dylib​: no suitable image found. Did find: /usr/local​/lib/MatLa​bLib/mymat​lab.dylib: open() failed with errno=13”?

3 views (last 30 days)
Xiao Browley
Xiao Browley on 13 Aug 2021
Answered: Walter Roberson on 14 Aug 2021
I build one Matlab script to mymatlab.dylib, but as I invoke it, it reported:
/usr/local/lib/MatLabLib/mymatlab.dylib: no suitable image found. Did find: /usr/local/lib/MatLabLib/mymatlab.dylib: open() failed with errno=13”
/usr/local/lib/MatLabLib/mymatlab.dylib: stat() failed with errno=22
I'm using MATLAB_R2019a, what does these errorno (13 / 22) mean?

Answers (2)

Walter Roberson
Walter Roberson on 14 Aug 2021
Error 13 means "permission denied".
This error is not given for the case where a file is not found. The error is given if a file is found but the user does not have authorization to use it, or if there is a directory in the path to the file that the user does not have authorization to examine (no directory x permission for the user). When the user does not have x permission all the way to the file then permission denied can occur even if the file does not exist.
Error 22 means "invalid argument"
Did find: /usr/local/lib/MatLabLib/mymatlab.dylib: open() failed with errno=13”
That part tells us that you do have x permission on all the appropriate directories, but that you do not have read permission on mymatlib.dylib .
It is possible that /usr/local/lib/MatLabLib/mymatlab.dylib exists as a symbolic link to a file (possibly in a different directory) that you do not have read access to. You should use
!ls -ld /usr/local/lib/MatLabLib/mymatlab.dylib
to see what you can find out about the file.
The Error 22 is probably a consequence of not being able to read the dylib file.

Yongjian Feng
Yongjian Feng on 13 Aug 2021
So you are doing this on Mac, right? Did you try to use the env var LD_LIBRARY_PATH to point to your dylib?
Use this from a terminal can tell you if you dylib has more dependencies.
otool -L
  3 Comments
Xiao Browley
Xiao Browley on 14 Aug 2021
I found the reason at last, it's because the .dylib was set "Not Access", so report open failed, but "Did find".
Thanks for your help!

Sign in to comment.

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!